SysWorkTimeSetMapper.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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.SysWorkTimeSetMapper">
  6. <resultMap type="com.xunmei.system.domain.SysWorkTimeSet" id="SysWorkTimeSetResult">
  7. <result property="id" column="id"/>
  8. <result property="orgId" column="org_id"/>
  9. <result property="orgName" column="org_name"/>
  10. <result property="monthEnable" column="month_enable"/>
  11. <result property="monday" column="monday"/>
  12. <result property="tuesday" column="tuesday"/>
  13. <result property="wednesday" column="wednesday"/>
  14. <result property="thursday" column="thursday"/>
  15. <result property="friday" column="friday"/>
  16. <result property="saturday" column="saturday"/>
  17. <result property="sunday" column="sunday"/>
  18. <result property="workTime" column="work_time"/>
  19. <result property="openTime" column="open_time"/>
  20. <result property="noonbreakStart" column="noonbreak_start"/>
  21. <result property="noonbreakEnd" column="noonbreak_end"/>
  22. <result property="closeTime" column="close_time"/>
  23. <result property="workOffTime" column="work_off_time"/>
  24. <result property="createTime" column="create_time"/>
  25. <result property="modifiedId" column="modified_id"/>
  26. <result property="modifiedName" column="modified_name"/>
  27. <result property="updateTime" column="update_time"/>
  28. <result property="year" column="year"/>
  29. <result property="deleted" column="deleted"/>
  30. <result property="effectiveDate" column="effective_date"/>
  31. </resultMap>
  32. <sql id="selectSysWorkTimeSetVo">
  33. select id, org_id, org_name, month_enable, monday, tuesday, wednesday, thursday, friday, saturday, sunday, work_time, open_time, noonbreak_start, noonbreak_end, close_time, work_off_time, create_time, modified_id, modified_name, update_time, year, deleted, effective_date
  34. from sys_work_time_set
  35. </sql>
  36. <select id="selectSysWorkTimeSetList" parameterType="com.xunmei.system.domain.SysWorkTimeSet"
  37. resultMap="SysWorkTimeSetResult">
  38. <include refid="selectSysWorkTimeSetVo"/>
  39. <where>
  40. <if test="orgId != null ">
  41. and org_id = #{orgId}
  42. </if>
  43. <if test="orgName != null and orgName != ''">
  44. and org_name like concat('%', #{orgName}, '%')
  45. </if>
  46. <if test="monthEnable != null ">
  47. and month_enable = #{monthEnable}
  48. </if>
  49. <if test="monday != null ">
  50. and monday = #{monday}
  51. </if>
  52. <if test="tuesday != null ">
  53. and tuesday = #{tuesday}
  54. </if>
  55. <if test="wednesday != null ">
  56. and wednesday = #{wednesday}
  57. </if>
  58. <if test="thursday != null ">
  59. and thursday = #{thursday}
  60. </if>
  61. <if test="friday != null ">
  62. and friday = #{friday}
  63. </if>
  64. <if test="saturday != null ">
  65. and saturday = #{saturday}
  66. </if>
  67. <if test="sunday != null ">
  68. and sunday = #{sunday}
  69. </if>
  70. <if test="workTime != null and workTime != ''">
  71. and work_time = #{workTime}
  72. </if>
  73. <if test="openTime != null and openTime != ''">
  74. and open_time = #{openTime}
  75. </if>
  76. <if test="noonbreakStart != null and noonbreakStart != ''">
  77. and noonbreak_start = #{noonbreakStart}
  78. </if>
  79. <if test="noonbreakEnd != null and noonbreakEnd != ''">
  80. and noonbreak_end = #{noonbreakEnd}
  81. </if>
  82. <if test="closeTime != null and closeTime != ''">
  83. and close_time = #{closeTime}
  84. </if>
  85. <if test="workOffTime != null and workOffTime != ''">
  86. and work_off_time = #{workOffTime}
  87. </if>
  88. <if test="modifiedId != null ">
  89. and modified_id = #{modifiedId}
  90. </if>
  91. <if test="modifiedName != null and modifiedName != ''">
  92. and modified_name like concat('%', #{modifiedName}, '%')
  93. </if>
  94. <if test="year != null ">
  95. and year = #{year}
  96. </if>
  97. <if test="deleted != null ">
  98. and deleted = #{deleted}
  99. </if>
  100. <if test="effectiveDate != null ">
  101. and effective_date = #{effectiveDate}
  102. </if>
  103. </where>
  104. </select>
  105. <select id="selectSysWorkTimeSetById" parameterType="Long"
  106. resultMap="SysWorkTimeSetResult">
  107. <include refid="selectSysWorkTimeSetVo"/>
  108. where id = #{id}
  109. </select>
  110. <select id="selectSysWorkTimeSetByOrgId" parameterType="Long"
  111. resultMap="SysWorkTimeSetResult">
  112. <include refid="selectSysWorkTimeSetVo"/>
  113. where org_id = #{orgId}
  114. </select>
  115. <select id="selectSysWorkTimeSetByOrgIdLimit1" parameterType="Long"
  116. resultMap="SysWorkTimeSetResult">
  117. <include refid="selectSysWorkTimeSetVo"/>
  118. where org_id = #{orgId} limit 1
  119. </select>
  120. <select id="selectByPage" resultType="com.xunmei.system.domain.SysWorkTimeSet">
  121. select * from sys_work_time_set
  122. </select>
  123. <select id="findWorkTimeForOrgIdsAndErrectiveDate" resultType="com.xunmei.system.domain.SysWorkTimeSet">
  124. select s.* from sys_work_time_set s where s.org_id in
  125. <foreach item="orgId" collection="orgIds" open="(" separator="," close=")">
  126. #{orgId}
  127. </foreach>
  128. and s.effective_date = #{effectiveDate} and s.deleted = false
  129. </select>
  130. <select id="checkData" resultType="java.lang.Integer">
  131. select count(*) from sys_work_time a
  132. where a.is_manual=1
  133. <if test="request.orgIds!=null and request.orgIds.size()>0">
  134. and a.org_id in
  135. <foreach collection="request.orgIds" item="orgId" open="(" close=")" separator=",">
  136. #{orgId}
  137. </foreach>
  138. </if>
  139. <if test="request.effectiveDate!=null">
  140. and ymd_date &gt;= #{request.effectiveDate}
  141. </if>
  142. </select>
  143. <select id="selectWorkTimeSetList" resultType="com.xunmei.system.domain.SysWorkTimeSet">
  144. select a.*,b.name as orgName from sys_work_time_set a left join sys_org b on a.org_id=b.id where a.deleted=0 and
  145. a.org_id in
  146. <foreach collection="request.orgIds" item="orgId" open="(" close=")" separator=",">
  147. #{orgId}
  148. </foreach>
  149. </select>
  150. <select id="selectWorkTimeSetPage" resultType="com.xunmei.system.domain.SysWorkTimeSet">
  151. SELECT
  152. t.*
  153. FROM
  154. sys_work_time_set t
  155. LEFT JOIN sys_org o ON t.org_id = o.id
  156. ${ew.customSqlSegment}
  157. </select>
  158. <insert id="insertSysWorkTimeSet" parameterType="com.xunmei.system.domain.SysWorkTimeSet" useGeneratedKeys="true" keyProperty="id">
  159. insert into sys_work_time_set
  160. <trim prefix="(" suffix=")" suffixOverrides=",">
  161. <if test="orgId != null">org_id,
  162. </if>
  163. <if test="orgName != null">org_name,
  164. </if>
  165. <if test="monthEnable != null">month_enable,
  166. </if>
  167. <if test="monday != null">monday,
  168. </if>
  169. <if test="tuesday != null">tuesday,
  170. </if>
  171. <if test="wednesday != null">wednesday,
  172. </if>
  173. <if test="thursday != null">thursday,
  174. </if>
  175. <if test="friday != null">friday,
  176. </if>
  177. <if test="saturday != null">saturday,
  178. </if>
  179. <if test="sunday != null">sunday,
  180. </if>
  181. <if test="workTime != null">work_time,
  182. </if>
  183. <if test="openTime != null">open_time,
  184. </if>
  185. <if test="noonbreakStart != null">noonbreak_start,
  186. </if>
  187. <if test="noonbreakEnd != null">noonbreak_end,
  188. </if>
  189. <if test="closeTime != null">close_time,
  190. </if>
  191. <if test="workOffTime != null">work_off_time,
  192. </if>
  193. <if test="createTime != null">create_time,
  194. </if>
  195. <if test="modifiedId != null">modified_id,
  196. </if>
  197. <if test="modifiedName != null">modified_name,
  198. </if>
  199. <if test="updateTime != null">update_time,
  200. </if>
  201. <if test="year != null">year,
  202. </if>
  203. <if test="deleted != null">deleted,
  204. </if>
  205. <if test="effectiveDate != null">effective_date,
  206. </if>
  207. </trim>
  208. <trim prefix="values (" suffix=")" suffixOverrides=",">
  209. <if test="orgId != null">#{orgId},
  210. </if>
  211. <if test="orgName != null">#{orgName},
  212. </if>
  213. <if test="monthEnable != null">#{monthEnable},
  214. </if>
  215. <if test="monday != null">#{monday},
  216. </if>
  217. <if test="tuesday != null">#{tuesday},
  218. </if>
  219. <if test="wednesday != null">#{wednesday},
  220. </if>
  221. <if test="thursday != null">#{thursday},
  222. </if>
  223. <if test="friday != null">#{friday},
  224. </if>
  225. <if test="saturday != null">#{saturday},
  226. </if>
  227. <if test="sunday != null">#{sunday},
  228. </if>
  229. <if test="workTime != null">#{workTime},
  230. </if>
  231. <if test="openTime != null">#{openTime},
  232. </if>
  233. <if test="noonbreakStart != null">#{noonbreakStart},
  234. </if>
  235. <if test="noonbreakEnd != null">#{noonbreakEnd},
  236. </if>
  237. <if test="closeTime != null">#{closeTime},
  238. </if>
  239. <if test="workOffTime != null">#{workOffTime},
  240. </if>
  241. <if test="createTime != null">#{createTime},
  242. </if>
  243. <if test="modifiedId != null">#{modifiedId},
  244. </if>
  245. <if test="modifiedName != null">#{modifiedName},
  246. </if>
  247. <if test="updateTime != null">#{updateTime},
  248. </if>
  249. <if test="year != null">#{year},
  250. </if>
  251. <if test="deleted != null">#{deleted},
  252. </if>
  253. <if test="effectiveDate != null">#{effectiveDate},
  254. </if>
  255. </trim>
  256. </insert>
  257. <update id="updateSysWorkTimeSet" parameterType="com.xunmei.system.domain.SysWorkTimeSet">
  258. update sys_work_time_set
  259. <trim prefix="SET" suffixOverrides=",">
  260. <if test="orgId != null">org_id =
  261. #{orgId},
  262. </if>
  263. <if test="orgName != null">org_name =
  264. #{orgName},
  265. </if>
  266. <if test="monthEnable != null">month_enable =
  267. #{monthEnable},
  268. </if>
  269. <if test="monday != null">monday =
  270. #{monday},
  271. </if>
  272. <if test="tuesday != null">tuesday =
  273. #{tuesday},
  274. </if>
  275. <if test="wednesday != null">wednesday =
  276. #{wednesday},
  277. </if>
  278. <if test="thursday != null">thursday =
  279. #{thursday},
  280. </if>
  281. <if test="friday != null">friday =
  282. #{friday},
  283. </if>
  284. <if test="saturday != null">saturday =
  285. #{saturday},
  286. </if>
  287. <if test="sunday != null">sunday =
  288. #{sunday},
  289. </if>
  290. <if test="workTime != null">work_time =
  291. #{workTime},
  292. </if>
  293. <if test="openTime != null">open_time =
  294. #{openTime},
  295. </if>
  296. <if test="noonbreakStart != null">noonbreak_start =
  297. #{noonbreakStart},
  298. </if>
  299. <if test="noonbreakEnd != null">noonbreak_end =
  300. #{noonbreakEnd},
  301. </if>
  302. <if test="closeTime != null">close_time =
  303. #{closeTime},
  304. </if>
  305. <if test="workOffTime != null">work_off_time =
  306. #{workOffTime},
  307. </if>
  308. <if test="createTime != null">create_time =
  309. #{createTime},
  310. </if>
  311. <if test="modifiedId != null">modified_id =
  312. #{modifiedId},
  313. </if>
  314. <if test="modifiedName != null">modified_name =
  315. #{modifiedName},
  316. </if>
  317. <if test="updateTime != null">update_time =
  318. #{updateTime},
  319. </if>
  320. <if test="year != null">year =
  321. #{year},
  322. </if>
  323. <if test="deleted != null">deleted =
  324. #{deleted},
  325. </if>
  326. <if test="effectiveDate != null">effective_date =
  327. #{effectiveDate},
  328. </if>
  329. </trim>
  330. where id = #{id}
  331. </update>
  332. <delete id="deleteSysWorkTimeSetById" parameterType="Long">
  333. delete
  334. from sys_work_time_set where id = #{id}
  335. </delete>
  336. <delete id="deleteSysWorkTimeSetByIds" parameterType="String">
  337. delete from sys_work_time_set where id in
  338. <foreach item="id" collection="array" open="(" separator="," close=")">
  339. #{id}
  340. </foreach>
  341. </delete>
  342. <insert id="batchInsertByXML">
  343. INSERT INTO sys_work_time_set (
  344. id,
  345. org_id,
  346. org_name,
  347. month_enable,
  348. monday,
  349. tuesday,
  350. wednesday,
  351. thursday,
  352. friday,
  353. saturday,
  354. sunday,
  355. work_time,
  356. open_time,
  357. noonbreak_start,
  358. noonbreak_end,
  359. close_time,
  360. work_off_time,
  361. create_time,
  362. modified_id,
  363. modified_name,
  364. update_time,
  365. year,
  366. deleted,
  367. effective_date,
  368. create_by,
  369. update_by
  370. ) VALUES
  371. <foreach item="item" index="index" collection="list" separator=",">
  372. (#{item.id},
  373. #{item.orgId},
  374. #{item.orgName},
  375. #{item.monthEnable},
  376. #{item.monday},
  377. #{item.tuesday},
  378. #{item.wednesday},
  379. #{item.thursday},
  380. #{item.friday},
  381. #{item.saturday},
  382. #{item.sunday},
  383. #{item.workTime},
  384. #{item.openTime},
  385. #{item.noonbreakStart},
  386. #{item.noonbreakEnd},
  387. #{item.closeTime},
  388. #{item.workOffTime},
  389. #{item.createTime},
  390. #{item.modifiedId},
  391. #{item.modifiedName},
  392. #{item.updateTime},
  393. #{item.year},
  394. #{item.deleted},
  395. #{item.effectiveDate},
  396. #{item.createBy},
  397. #{item.updateBy})
  398. </foreach>
  399. </insert>
  400. <update id="batchUpdateByXML">
  401. <foreach item="item" index="index" collection="list" separator=";">
  402. UPDATE sys_work_time_set
  403. <set>
  404. <if test="item.orgId != null">
  405. org_id = #{item.orgId},
  406. </if>
  407. <if test="item.orgName != null">
  408. org_name = #{item.orgName},
  409. </if>
  410. <if test="item.monthEnable != null">
  411. month_enable = #{item.monthEnable},
  412. </if>
  413. <if test="item.monday != null">
  414. monday = #{item.monday},
  415. </if>
  416. <if test="item.tuesday != null">
  417. tuesday = #{item.tuesday},
  418. </if>
  419. <if test="item.wednesday != null">
  420. wednesday = #{item.wednesday},
  421. </if>
  422. <if test="item.thursday != null">
  423. thursday = #{item.thursday},
  424. </if>
  425. <if test="item.friday != null">
  426. friday = #{item.friday},
  427. </if>
  428. <if test="item.saturday != null">
  429. saturday = #{item.saturday},
  430. </if>
  431. <if test="item.sunday != null">
  432. sunday = #{item.sunday},
  433. </if>
  434. <if test="item.workTime != null and item.workTime != ''">
  435. work_time = #{item.workTime},
  436. </if>
  437. <if test="item.openTime != null and item.openTime != ''">
  438. open_time = #{item.openTime},
  439. </if>
  440. <if test="item.noonbreakStart != null and item.noonbreakStart != ''">
  441. noonbreak_start = #{item.noonbreakStart},
  442. </if>
  443. <if test="item.noonbreakEnd != null and item.noonbreakEnd != ''">
  444. noonbreak_end = #{item.noonbreakEnd},
  445. </if>
  446. <if test="item.closeTime != null and item.closeTime != ''">
  447. close_time = #{item.closeTime},
  448. </if>
  449. <if test="item.workOffTime != null and item.workOffTime != ''">
  450. work_off_time = #{item.workOffTime},
  451. </if>
  452. <if test="item.createTime != null">
  453. create_time = #{item.createTime},
  454. </if>
  455. <if test="item.modifiedId != null">
  456. modified_id = #{item.modifiedId},
  457. </if>
  458. <if test="item.modifiedName != null">
  459. modified_name = #{item.modifiedName},
  460. </if>
  461. <if test="item.updateTime != null">
  462. update_time = #{item.updateTime},
  463. </if>
  464. <if test="item.year != null">
  465. year = #{item.year},
  466. </if>
  467. <if test="item.deleted != null">
  468. deleted = #{item.deleted},
  469. </if>
  470. <if test="item.effectiveDate != null">
  471. effective_date = #{item.effectiveDate},
  472. </if>
  473. <if test="item.createBy != null">
  474. create_by = #{item.createBy},
  475. </if>
  476. <if test="item.updateBy != null">
  477. update_by = #{item.updateBy},
  478. </if>
  479. </set>
  480. WHERE id = #{item.id}
  481. </foreach>
  482. </update>
  483. <select id="selectByOrgIdList" resultMap="SysWorkTimeSetResult">
  484. select * from sys_work_time_set where org_id in
  485. <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
  486. #{item}
  487. </foreach>
  488. </select>
  489. </mapper>