SysOrgMapper.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.xunmei.system.mapper.SysOrgMapper">
  6. <resultMap type="com.xunmei.system.api.domain.SysOrg" id="SysOrgResult">
  7. <result property="id" column="id"/>
  8. <result property="address" column="address"/>
  9. <result property="code" column="code"/>
  10. <result property="guid" column="guid"/>
  11. <result property="isLock" column="is_lock"/>
  12. <result property="manager" column="manager"/>
  13. <result property="managerPhone" column="manager_phone"/>
  14. <result property="name" column="name"/>
  15. <result property="parentId" column="parent_id"/>
  16. <result property="phone" column="phone"/>
  17. <result property="cityCode" column="city_code"/>
  18. <result property="type" column="type"/>
  19. <result property="createTime" column="create_time"/>
  20. <result property="updateTime" column="update_time"/>
  21. <result property="path" column="path"/>
  22. <result property="parentGuid" column="parent_guid"/>
  23. <result property="deleted" column="deleted"/>
  24. <result property="sort" column="sort"/>
  25. <result property="source" column="source"/>
  26. <result property="shortName" column="short_name"/>
  27. <result property="remark" column="remark"/>
  28. <result property="source" column="source"/>
  29. <result property="createBy" column="create_by"/>
  30. <result property="updateBy" column="update_by"/>
  31. </resultMap>
  32. <sql id="selectSysOrgVo">
  33. select id, address, code, guid, is_lock, manager, manager_phone, name, parent_id, phone, city_code , type, create_time, update_time, parent_guid, deleted, sort, create_by, update_by,weather_city_code,org_extend_id,source,short_name,remark
  34. from sys_org
  35. </sql>
  36. <select id="selectSysOrgList" parameterType="com.xunmei.system.api.domain.SysOrg"
  37. resultMap="SysOrgResult">
  38. <include refid="selectSysOrgVo"/>
  39. <where>
  40. <if test="address != null and address != ''">
  41. and address = #{address}
  42. </if>
  43. <if test="code != null and code != ''">
  44. and code = #{code}
  45. </if>
  46. <!-- <if test="deviceCount != null ">-->
  47. <!-- and device_count = #{deviceCount}-->
  48. <!-- </if>-->
  49. <if test="guid != null and guid != ''">
  50. and guid = #{guid}
  51. </if>
  52. <if test="isLock != null ">
  53. and is_lock = #{isLock}
  54. </if>
  55. <if test="manager != null and manager != ''">
  56. and manager = #{manager}
  57. </if>
  58. <if test="managerPhone != null and managerPhone != ''">
  59. and manager_phone = #{managerPhone}
  60. </if>
  61. <if test="name != null and name != ''">
  62. and name like concat('%', #{name}, '%')
  63. </if>
  64. <if test="parentId != null ">
  65. and parent_id = #{parentId}
  66. </if>
  67. <if test="phone != null and phone != ''">
  68. and phone = #{phone}
  69. </if>
  70. <if test="cityCode != null and cityCode != ''">
  71. and city_code = #{cityCode}
  72. </if>
  73. <!-- <if test="openYear != null ">-->
  74. <!-- and open_year = #{openYear}-->
  75. <!-- </if>-->
  76. <!-- <if test="fitYear != null ">-->
  77. <!-- and fit_year = #{fitYear}-->
  78. <!-- </if>-->
  79. <!-- <if test="floorage != null and floorage != ''">-->
  80. <!-- and floorage = #{floorage}-->
  81. <!-- </if>-->
  82. <!-- <if test="employee != null ">-->
  83. <!-- and employee = #{employee}-->
  84. <!-- </if>-->
  85. <!-- <if test="isOwnRight != null ">-->
  86. <!-- and is_own_right = #{isOwnRight}-->
  87. <!-- </if>-->
  88. <!-- <if test="isRent != null ">-->
  89. <!-- and is_rent = #{isRent}-->
  90. <!-- </if>-->
  91. <!-- <if test="isOnly != null ">-->
  92. <!-- and is_only = #{isOnly}-->
  93. <!-- </if>-->
  94. <!-- <if test="buildYear != null ">-->
  95. <!-- and build_year = #{buildYear}-->
  96. <!-- </if>-->
  97. <!-- <if test="placeType != null ">-->
  98. <!-- and place_type = #{placeType}-->
  99. <!-- </if>-->
  100. <!-- <if test="buildHeight != null ">-->
  101. <!-- and build_height = #{buildHeight}-->
  102. <!-- </if>-->
  103. <!-- <if test="social != null ">-->
  104. <!-- and social = #{social}-->
  105. <!-- </if>-->
  106. <!-- <if test="naturalEnvir != null ">-->
  107. <!-- and natural_envir = #{naturalEnvir}-->
  108. <!-- </if>-->
  109. <if test="type != null ">
  110. and type = #{type}
  111. </if>
  112. <if test="updateBy != null and updateBy != ''">
  113. and update_by like concat('%', #{updateBy}, '%')
  114. </if>
  115. <!-- <if test="modifiedId != null ">-->
  116. <!-- and modified_id = #{modifiedId}-->
  117. <!-- </if>-->
  118. <if test="path != null and path != ''">
  119. and path = #{path}
  120. </if>
  121. <!-- <if test="vid != null ">-->
  122. <!-- and vid = #{vid}-->
  123. <!-- </if>-->
  124. <!-- <if test="level != null ">-->
  125. <!-- and level = #{level}-->
  126. <!-- </if>-->
  127. <!-- <if test="oid != null and oid != ''">-->
  128. <!-- and oid = #{oid}-->
  129. <!-- </if>-->
  130. <if test="parentGuid != null and parentGuid != ''">
  131. and parent_guid = #{parentGuid}
  132. </if>
  133. <if test="deleted != null ">
  134. and deleted = #{deleted}
  135. </if>
  136. <if test="sort != null ">
  137. and sort = #{sort}
  138. </if>
  139. <!-- <if test="location != null ">-->
  140. <!-- and location = #{location}-->
  141. <!-- </if>-->
  142. </where>
  143. </select>
  144. <select id="selectSysOrgById" parameterType="Long"
  145. resultMap="SysOrgResult">
  146. <include refid="selectSysOrgVo"/>
  147. where id = #{id}
  148. </select>
  149. <select id="selectCheckSubOrgIdList" resultType="java.lang.Long">
  150. select id
  151. from sys_org
  152. where path like concat((select path from sys_org where id = #{orgId}), '%')
  153. and deleted = 0
  154. </select>
  155. <select id="findListByOrgType" resultType="java.lang.Long">
  156. select a.id from sys_org a where a.type = #{execOrgType} and a.deleted=0 and a.is_lock=0 and a.temporarily_closed=0
  157. </select>
  158. <insert id="insertSysOrg" parameterType="com.xunmei.system.api.domain.SysOrg" useGeneratedKeys="true" keyProperty="id">
  159. insert into sys_org
  160. <trim prefix="(" suffix=")" suffixOverrides=",">
  161. <if test="address != null">address,
  162. </if>
  163. <if test="code != null">code,
  164. </if>
  165. <!-- <if test="deviceCount != null">device_count,-->
  166. <!-- </if>-->
  167. <if test="guid != null">guid,
  168. </if>
  169. <if test="isLock != null">is_lock,
  170. </if>
  171. <if test="manager != null">manager,
  172. </if>
  173. <if test="managerPhone != null">manager_phone,
  174. </if>
  175. <if test="name != null">name,
  176. </if>
  177. <if test="shortName != null">short_name,
  178. </if>
  179. <if test="parentId != null">parent_id,
  180. </if>
  181. <if test="phone != null">phone,
  182. </if>
  183. <if test="cityCode != null">city_code,
  184. </if>
  185. <!-- <if test="openYear != null">open_year,-->
  186. <!-- </if>-->
  187. <!-- <if test="fitYear != null">fit_year,-->
  188. <!-- </if>-->
  189. <!-- <if test="floorage != null">floorage,-->
  190. <!-- </if>-->
  191. <!-- <if test="employee != null">employee,-->
  192. <!-- </if>-->
  193. <!-- <if test="isOwnRight != null">is_own_right,-->
  194. <!-- </if>-->
  195. <!-- <if test="isRent != null">is_rent,-->
  196. <!-- </if>-->
  197. <!-- <if test="isOnly != null">is_only,-->
  198. <!-- </if>-->
  199. <!-- <if test="buildYear != null">build_year,-->
  200. <!-- </if>-->
  201. <!-- <if test="placeType != null">place_type,-->
  202. <!-- </if>-->
  203. <!-- <if test="buildHeight != null">build_height,-->
  204. <!-- </if>-->
  205. <!-- <if test="social != null">social,-->
  206. <!-- </if>-->
  207. <!-- <if test="naturalEnvir != null">natural_envir,-->
  208. <!-- </if>-->
  209. <if test="type != null">type,
  210. </if>
  211. <if test="createTime != null">create_time,
  212. </if>
  213. <if test="updateBy != null">update_by,
  214. </if>
  215. <if test="updateTime != null">update_time,
  216. </if>
  217. <!-- <if test="modifiedId != null">modified_id,-->
  218. <!-- </if>-->
  219. <if test="path != null">path,
  220. </if>
  221. <!-- <if test="vid != null">vid,-->
  222. <!-- </if>-->
  223. <!-- <if test="level != null">level,-->
  224. <!-- </if>-->
  225. <if test="oid != null">oid,
  226. </if>
  227. <if test="parentGuid != null">parent_guid,
  228. </if>
  229. <if test="deleted != null">deleted,
  230. </if>
  231. <if test="sort != null">sort,
  232. </if>
  233. <if test="source != null">source,
  234. </if>
  235. <if test="remark != null">remark,
  236. </if>
  237. <!-- <if test="location != null">location,-->
  238. <!-- </if>-->
  239. <if test="createBy != null">create_by,
  240. </if>
  241. <if test="updateBy != null">update_by,
  242. </if>
  243. </trim>
  244. <trim prefix="values (" suffix=")" suffixOverrides=",">
  245. <if test="address != null">#{address},
  246. </if>
  247. <if test="code != null">#{code},
  248. </if>
  249. <!-- <if test="deviceCount != null">#{deviceCount},-->
  250. <!-- </if>-->
  251. <if test="guid != null">#{guid},
  252. </if>
  253. <if test="isLock != null">#{isLock},
  254. </if>
  255. <if test="manager != null">#{manager},
  256. </if>
  257. <if test="managerPhone != null">#{managerPhone},
  258. </if>
  259. <if test="name != null">#{name},
  260. </if>
  261. <if test="shortName != null">#{shortName},
  262. </if>
  263. <if test="parentId != null">#{parentId},
  264. </if>
  265. <if test="phone != null">#{phone},
  266. </if>
  267. <if test="cityCode != null">#{cityCode},
  268. </if>
  269. <!-- <if test="openYear != null">#{openYear},-->
  270. <!-- </if>-->
  271. <!-- <if test="fitYear != null">#{fitYear},-->
  272. <!-- </if>-->
  273. <!-- <if test="floorage != null">#{floorage},-->
  274. <!-- </if>-->
  275. <!-- <if test="employee != null">#{employee},-->
  276. <!-- </if>-->
  277. <!-- <if test="isOwnRight != null">#{isOwnRight},-->
  278. <!-- </if>-->
  279. <!-- <if test="isRent != null">#{isRent},-->
  280. <!-- </if>-->
  281. <!-- <if test="isOnly != null">#{isOnly},-->
  282. <!-- </if>-->
  283. <!-- <if test="buildYear != null">#{buildYear},-->
  284. <!-- </if>-->
  285. <!-- <if test="placeType != null">#{placeType},-->
  286. <!-- </if>-->
  287. <!-- <if test="buildHeight != null">#{buildHeight},-->
  288. <!-- </if>-->
  289. <!-- <if test="social != null">#{social},-->
  290. <!-- </if>-->
  291. <!-- <if test="naturalEnvir != null">#{naturalEnvir},-->
  292. <!-- </if>-->
  293. <if test="type != null">#{type},
  294. </if>
  295. <if test="createTime != null">#{createTime},
  296. </if>
  297. <if test="updateBy != null">#{updateBy},
  298. </if>
  299. <if test="updateTime != null">#{updateTime},
  300. </if>
  301. <!-- <if test="modifiedId != null">#{modifiedId},-->
  302. <!-- </if>-->
  303. <if test="path != null">#{path},
  304. </if>
  305. <!-- <if test="vid != null">#{vid},-->
  306. <!-- </if>-->
  307. <!-- <if test="level != null">#{level},-->
  308. <!-- </if>-->
  309. <!-- <if test="oid != null">#{oid},-->
  310. <!-- </if>-->
  311. <if test="parentGuid != null">#{parentGuid},
  312. </if>
  313. <if test="deleted != null">#{deleted},
  314. </if>
  315. <if test="sort != null">#{sort},
  316. </if>
  317. <if test="source != null">#{source},
  318. </if>
  319. <if test="remark != null">#{remark},
  320. </if>
  321. <!-- <if test="location != null">#{location},-->
  322. <!-- </if>-->
  323. <if test="createBy != null">#{createBy},
  324. </if>
  325. <if test="updateBy != null">#{updateBy},
  326. </if>
  327. </trim>
  328. </insert>
  329. <update id="updateSysOrg" parameterType="com.xunmei.system.api.domain.SysOrg">
  330. update sys_org
  331. <trim prefix="SET" suffixOverrides=",">
  332. <if test="address != null">address =
  333. #{address},
  334. </if>
  335. <if test="code != null">code =
  336. #{code},
  337. </if>
  338. <!-- <if test="deviceCount != null">device_count =-->
  339. <!-- #{deviceCount},-->
  340. <!-- </if>-->
  341. <if test="guid != null">guid =
  342. #{guid},
  343. </if>
  344. <if test="isLock != null">is_lock =
  345. #{isLock},
  346. </if>
  347. <if test="manager != null">manager =
  348. #{manager},
  349. </if>
  350. <if test="managerPhone != null">manager_phone =
  351. #{managerPhone},
  352. </if>
  353. <if test="name != null">name =
  354. #{name},
  355. </if>
  356. <if test="shortName != null">short_name =
  357. #{shortName},
  358. </if>
  359. <if test="parentId != null">parent_id =
  360. #{parentId},
  361. </if>
  362. <if test="phone != null">phone =
  363. #{phone},
  364. </if>
  365. <if test="cityCode != null">city_code =
  366. #{cityCode},
  367. </if>
  368. <!-- <if test="openYear != null">open_year =-->
  369. <!-- #{openYear},-->
  370. <!-- </if>-->
  371. <!-- <if test="fitYear != null">fit_year =-->
  372. <!-- #{fitYear},-->
  373. <!-- </if>-->
  374. <!-- <if test="floorage != null">floorage =-->
  375. <!-- #{floorage},-->
  376. <!-- </if>-->
  377. <!-- <if test="employee != null">employee =-->
  378. <!-- #{employee},-->
  379. <!-- </if>-->
  380. <!-- <if test="isOwnRight != null">is_own_right =-->
  381. <!-- #{isOwnRight},-->
  382. <!-- </if>-->
  383. <!-- <if test="isRent != null">is_rent =-->
  384. <!-- #{isRent},-->
  385. <!-- </if>-->
  386. <!-- <if test="isOnly != null">is_only =-->
  387. <!-- #{isOnly},-->
  388. <!-- </if>-->
  389. <!-- <if test="buildYear != null">build_year =-->
  390. <!-- #{buildYear},-->
  391. <!-- </if>-->
  392. <!-- <if test="placeType != null">place_type =-->
  393. <!-- #{placeType},-->
  394. <!-- </if>-->
  395. <!-- <if test="buildHeight != null">build_height =-->
  396. <!-- #{buildHeight},-->
  397. <!-- </if>-->
  398. <!-- <if test="social != null">social =-->
  399. <!-- #{social},-->
  400. <!-- </if>-->
  401. <!-- <if test="naturalEnvir != null">natural_envir =-->
  402. <!-- #{naturalEnvir},-->
  403. <!-- </if>-->
  404. <if test="type != null">type =
  405. #{type},
  406. </if>
  407. <if test="createTime != null">create_time =
  408. #{createTime},
  409. </if>
  410. <if test="updateBy != null">update_by =
  411. #{updateBy},
  412. </if>
  413. <if test="updateTime != null">update_time =
  414. #{updateTime},
  415. </if>
  416. <!-- <if test="modifiedId != null">modified_id =-->
  417. <!-- #{modifiedId},-->
  418. <!-- </if>-->
  419. <if test="path != null">path =
  420. #{path},
  421. </if>
  422. <!-- <if test="vid != null">vid =-->
  423. <!-- #{vid},-->
  424. <!-- </if>-->
  425. <!-- <if test="level != null">level =-->
  426. <!-- #{level},-->
  427. <!-- </if>-->
  428. <!-- <if test="oid != null">oid =-->
  429. <!-- #{oid},-->
  430. <!-- </if>-->
  431. <if test="parentGuid != null">parent_guid =
  432. #{parentGuid},
  433. </if>
  434. <if test="deleted != null">deleted =
  435. #{deleted},
  436. </if>
  437. <if test="sort != null">sort =
  438. #{sort},
  439. </if>
  440. <if test="source != null">source =
  441. #{source},
  442. </if>
  443. <if test="remark != null">remark =
  444. #{remark},
  445. </if>
  446. <!-- <if test="location != null">location =-->
  447. <!-- #{location},-->
  448. <!-- </if>-->
  449. <if test="createBy != null">create_by =
  450. #{createBy},
  451. </if>
  452. <if test="updateBy != null">update_by =
  453. #{updateBy},
  454. </if>
  455. </trim>
  456. where id = #{id}
  457. </update>
  458. <delete id="deleteSysOrgById" parameterType="Long">
  459. delete
  460. from sys_org where id = #{id}
  461. </delete>
  462. <delete id="deleteSysOrgByIds" parameterType="String">
  463. delete from sys_org where id in
  464. <foreach item="id" collection="array" open="(" separator="," close=")">
  465. #{id}
  466. </foreach>
  467. </delete>
  468. </mapper>