SysOrgMapper.xml 19 KB

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