SysWorkTimeMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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.SysWorkTimeMapper">
  6. <resultMap type="com.xunmei.system.domain.SysWorkTime" id="SysWorkTimeResult">
  7. <result property="id" column="id"/>
  8. <result property="createTime" column="create_time"/>
  9. <result property="modifiedId" column="modified_id"/>
  10. <result property="modifiedName" column="modified_name"/>
  11. <result property="updateTime" column="update_time"/>
  12. <result property="closeTime" column="close_time"/>
  13. <result property="isEnable" column="is_enable"/>
  14. <result property="openTime" column="open_time"/>
  15. <result property="noonbreakStart" column="noonbreak_start"/>
  16. <result property="noonbreakEnd" column="noonbreak_end"/>
  17. <result property="orgId" column="org_id"/>
  18. <result property="workOffTime" column="work_off_time"/>
  19. <result property="workTime" column="work_time"/>
  20. <result property="workTimeMonthId" column="work_time_month_id"/>
  21. <result property="ymdDate" column="ymd_date"/>
  22. <result property="ymdDay" column="ymd_day"/>
  23. <result property="ymdMonth" column="ymd_month"/>
  24. <result property="ymdQuarter" column="ymd_quarter"/>
  25. <result property="ymdWeek" column="ymd_week"/>
  26. <result property="ymdYear" column="ymd_year"/>
  27. <result property="ymdHalfyear" column="ymd_halfyear"/>
  28. <result property="isError" column="is_error"/>
  29. <result property="offDutyTime" column="off_duty_time"/>
  30. <result property="onDutyTime" column="on_duty_time"/>
  31. <result property="ymdHour" column="ymd_hour"/>
  32. <result property="ymdMinute" column="ymd_minute"/>
  33. <result property="isManual" column="is_manual"/>
  34. </resultMap>
  35. <sql id="selectSysWorkTimeVo">
  36. select id, create_time, modified_id, modified_name, update_time, close_time, is_enable, open_time, noonbreak_start, noonbreak_end, org_id, work_off_time, work_time, work_time_month_id, ymd_date, ymd_day, ymd_month, ymd_quarter, ymd_week, ymd_year, ymd_halfyear, is_error, off_duty_time, on_duty_time, ymd_hour, ymd_minute, is_manual
  37. from sys_work_time
  38. </sql>
  39. <select id="selectSysWorkTimeList" parameterType="com.xunmei.system.domain.SysWorkTime"
  40. resultMap="SysWorkTimeResult">
  41. <include refid="selectSysWorkTimeVo"/>
  42. <where>
  43. <if test="modifiedId != null ">
  44. and modified_id = #{modifiedId}
  45. </if>
  46. <if test="modifiedName != null and modifiedName != ''">
  47. and modified_name like concat('%', #{modifiedName}, '%')
  48. </if>
  49. <if test="closeTime != null and closeTime != ''">
  50. and close_time = #{closeTime}
  51. </if>
  52. <if test="isEnable != null ">
  53. and is_enable = #{isEnable}
  54. </if>
  55. <if test="openTime != null and openTime != ''">
  56. and open_time = #{openTime}
  57. </if>
  58. <if test="noonbreakStart != null and noonbreakStart != ''">
  59. and noonbreak_start = #{noonbreakStart}
  60. </if>
  61. <if test="noonbreakEnd != null and noonbreakEnd != ''">
  62. and noonbreak_end = #{noonbreakEnd}
  63. </if>
  64. <if test="orgId != null ">
  65. and org_id = #{orgId}
  66. </if>
  67. <if test="workOffTime != null and workOffTime != ''">
  68. and work_off_time = #{workOffTime}
  69. </if>
  70. <if test="workTime != null and workTime != ''">
  71. and work_time = #{workTime}
  72. </if>
  73. <if test="workTimeMonthId != null and workTimeMonthId != ''">
  74. and work_time_month_id = #{workTimeMonthId}
  75. </if>
  76. <if test="ymdDate != null ">
  77. and ymd_date = #{ymdDate}
  78. </if>
  79. <if test="ymdDay != null ">
  80. and ymd_day = #{ymdDay}
  81. </if>
  82. <if test="ymdMonth != null ">
  83. and ymd_month = #{ymdMonth}
  84. </if>
  85. <if test="ymdQuarter != null ">
  86. and ymd_quarter = #{ymdQuarter}
  87. </if>
  88. <if test="ymdWeek != null ">
  89. and ymd_week = #{ymdWeek}
  90. </if>
  91. <if test="ymdYear != null ">
  92. and ymd_year = #{ymdYear}
  93. </if>
  94. <if test="ymdHalfyear != null ">
  95. and ymd_halfyear = #{ymdHalfyear}
  96. </if>
  97. <if test="isError != null ">
  98. and is_error = #{isError}
  99. </if>
  100. <if test="offDutyTime != null ">
  101. and off_duty_time = #{offDutyTime}
  102. </if>
  103. <if test="onDutyTime != null ">
  104. and on_duty_time = #{onDutyTime}
  105. </if>
  106. <if test="ymdHour != null ">
  107. and ymd_hour = #{ymdHour}
  108. </if>
  109. <if test="ymdMinute != null ">
  110. and ymd_minute = #{ymdMinute}
  111. </if>
  112. <if test="isManual != null ">
  113. and is_manual = #{isManual}
  114. </if>
  115. </where>
  116. </select>
  117. <select id="selectSysWorkTimeById" parameterType="String"
  118. resultMap="SysWorkTimeResult">
  119. <include refid="selectSysWorkTimeVo"/>
  120. where id = #{id}
  121. </select>
  122. <select id="selectByPage" resultType="com.xunmei.system.dto.SysWorkTimeDto">
  123. SELECT
  124. t.*,
  125. o.NAME as orgName
  126. FROM
  127. sys_work_time t
  128. LEFT JOIN sys_org o ON t.org_id = o.id
  129. ${ew.customSqlSegment}
  130. </select>
  131. <select id="findByOrgAndMonth" resultType="com.xunmei.system.domain.SysWorkTime">
  132. select *
  133. from sys_work_time
  134. where org_id = #{orgId}
  135. and ymd_date like concat(#{monthStr}, '%')
  136. </select>
  137. <select id="findByYmd" resultType="com.xunmei.system.domain.SysWorkTime">
  138. select * from sys_work_time where org_id in
  139. <foreach item="orgId" collection="orgIds" open="(" separator="," close=")">
  140. #{orgId}
  141. </foreach>
  142. and ymd_date=#{date}
  143. </select>
  144. <select id="getOrgWorkTimeByMonth" resultType="com.xunmei.system.domain.SysWorkTime">
  145. select * from sys_work_time where is_manual=1 and ymd_date>=#{map.effectiveDate} and
  146. #{map.lastDayOfNextMonth}>=ymd_date
  147. and org_id in
  148. <foreach collection="map.orgIds" item="orgId" open="(" close=")" separator=",">
  149. #{orgId}
  150. </foreach>
  151. </select>
  152. <select id="findOrgIdsByYmd" resultType="java.lang.Long">
  153. select org_id from sys_work_time where ymd_date=#{data} and is_enable=1
  154. </select>
  155. <insert id="insertSysWorkTime" parameterType="com.xunmei.system.domain.SysWorkTime">
  156. insert into sys_work_time
  157. <trim prefix="(" suffix=")" suffixOverrides=",">
  158. <if test="id != null">id,
  159. </if>
  160. <if test="createTime != null">create_time,
  161. </if>
  162. <if test="modifiedId != null">modified_id,
  163. </if>
  164. <if test="modifiedName != null">modified_name,
  165. </if>
  166. <if test="updateTime != null">update_time,
  167. </if>
  168. <if test="closeTime != null">close_time,
  169. </if>
  170. <if test="isEnable != null">is_enable,
  171. </if>
  172. <if test="openTime != null">open_time,
  173. </if>
  174. <if test="noonbreakStart != null">noonbreak_start,
  175. </if>
  176. <if test="noonbreakEnd != null">noonbreak_end,
  177. </if>
  178. <if test="orgId != null">org_id,
  179. </if>
  180. <if test="workOffTime != null">work_off_time,
  181. </if>
  182. <if test="workTime != null">work_time,
  183. </if>
  184. <if test="workTimeMonthId != null">work_time_month_id,
  185. </if>
  186. <if test="ymdDate != null">ymd_date,
  187. </if>
  188. <if test="ymdDay != null">ymd_day,
  189. </if>
  190. <if test="ymdMonth != null">ymd_month,
  191. </if>
  192. <if test="ymdQuarter != null">ymd_quarter,
  193. </if>
  194. <if test="ymdWeek != null">ymd_week,
  195. </if>
  196. <if test="ymdYear != null">ymd_year,
  197. </if>
  198. <if test="ymdHalfyear != null">ymd_halfyear,
  199. </if>
  200. <if test="isError != null">is_error,
  201. </if>
  202. <if test="offDutyTime != null">off_duty_time,
  203. </if>
  204. <if test="onDutyTime != null">on_duty_time,
  205. </if>
  206. <if test="ymdHour != null">ymd_hour,
  207. </if>
  208. <if test="ymdMinute != null">ymd_minute,
  209. </if>
  210. <if test="isManual != null">is_manual,
  211. </if>
  212. </trim>
  213. <trim prefix="values (" suffix=")" suffixOverrides=",">
  214. <if test="id != null">#{id},
  215. </if>
  216. <if test="createTime != null">#{createTime},
  217. </if>
  218. <if test="modifiedId != null">#{modifiedId},
  219. </if>
  220. <if test="modifiedName != null">#{modifiedName},
  221. </if>
  222. <if test="updateTime != null">#{updateTime},
  223. </if>
  224. <if test="closeTime != null">#{closeTime},
  225. </if>
  226. <if test="isEnable != null">#{isEnable},
  227. </if>
  228. <if test="openTime != null">#{openTime},
  229. </if>
  230. <if test="noonbreakStart != null">#{noonbreakStart},
  231. </if>
  232. <if test="noonbreakEnd != null">#{noonbreakEnd},
  233. </if>
  234. <if test="orgId != null">#{orgId},
  235. </if>
  236. <if test="workOffTime != null">#{workOffTime},
  237. </if>
  238. <if test="workTime != null">#{workTime},
  239. </if>
  240. <if test="workTimeMonthId != null">#{workTimeMonthId},
  241. </if>
  242. <if test="ymdDate != null">#{ymdDate},
  243. </if>
  244. <if test="ymdDay != null">#{ymdDay},
  245. </if>
  246. <if test="ymdMonth != null">#{ymdMonth},
  247. </if>
  248. <if test="ymdQuarter != null">#{ymdQuarter},
  249. </if>
  250. <if test="ymdWeek != null">#{ymdWeek},
  251. </if>
  252. <if test="ymdYear != null">#{ymdYear},
  253. </if>
  254. <if test="ymdHalfyear != null">#{ymdHalfyear},
  255. </if>
  256. <if test="isError != null">#{isError},
  257. </if>
  258. <if test="offDutyTime != null">#{offDutyTime},
  259. </if>
  260. <if test="onDutyTime != null">#{onDutyTime},
  261. </if>
  262. <if test="ymdHour != null">#{ymdHour},
  263. </if>
  264. <if test="ymdMinute != null">#{ymdMinute},
  265. </if>
  266. <if test="isManual != null">#{isManual},
  267. </if>
  268. </trim>
  269. </insert>
  270. <update id="updateSysWorkTime" parameterType="com.xunmei.system.domain.SysWorkTime">
  271. update sys_work_time
  272. <trim prefix="SET" suffixOverrides=",">
  273. <if test="createTime != null">create_time =
  274. #{createTime},
  275. </if>
  276. <if test="modifiedId != null">modified_id =
  277. #{modifiedId},
  278. </if>
  279. <if test="modifiedName != null">modified_name =
  280. #{modifiedName},
  281. </if>
  282. <if test="updateTime != null">update_time =
  283. #{updateTime},
  284. </if>
  285. <if test="closeTime != null">close_time =
  286. #{closeTime},
  287. </if>
  288. <if test="isEnable != null">is_enable =
  289. #{isEnable},
  290. </if>
  291. <if test="openTime != null">open_time =
  292. #{openTime},
  293. </if>
  294. <if test="noonbreakStart != null">noonbreak_start =
  295. #{noonbreakStart},
  296. </if>
  297. <if test="noonbreakEnd != null">noonbreak_end =
  298. #{noonbreakEnd},
  299. </if>
  300. <if test="orgId != null">org_id =
  301. #{orgId},
  302. </if>
  303. <if test="workOffTime != null">work_off_time =
  304. #{workOffTime},
  305. </if>
  306. <if test="workTime != null">work_time =
  307. #{workTime},
  308. </if>
  309. <if test="workTimeMonthId != null">work_time_month_id =
  310. #{workTimeMonthId},
  311. </if>
  312. <if test="ymdDate != null">ymd_date =
  313. #{ymdDate},
  314. </if>
  315. <if test="ymdDay != null">ymd_day =
  316. #{ymdDay},
  317. </if>
  318. <if test="ymdMonth != null">ymd_month =
  319. #{ymdMonth},
  320. </if>
  321. <if test="ymdQuarter != null">ymd_quarter =
  322. #{ymdQuarter},
  323. </if>
  324. <if test="ymdWeek != null">ymd_week =
  325. #{ymdWeek},
  326. </if>
  327. <if test="ymdYear != null">ymd_year =
  328. #{ymdYear},
  329. </if>
  330. <if test="ymdHalfyear != null">ymd_halfyear =
  331. #{ymdHalfyear},
  332. </if>
  333. <if test="isError != null">is_error =
  334. #{isError},
  335. </if>
  336. <if test="offDutyTime != null">off_duty_time =
  337. #{offDutyTime},
  338. </if>
  339. <if test="onDutyTime != null">on_duty_time =
  340. #{onDutyTime},
  341. </if>
  342. <if test="ymdHour != null">ymd_hour =
  343. #{ymdHour},
  344. </if>
  345. <if test="ymdMinute != null">ymd_minute =
  346. #{ymdMinute},
  347. </if>
  348. <if test="isManual != null">is_manual =
  349. #{isManual},
  350. </if>
  351. </trim>
  352. where id = #{id}
  353. </update>
  354. <delete id="deleteSysWorkTimeById" parameterType="String">
  355. delete
  356. from sys_work_time where id = #{id}
  357. </delete>
  358. <delete id="deleteSysWorkTimeByIds" parameterType="String">
  359. delete from sys_work_time where id in
  360. <foreach item="id" collection="array" open="(" separator="," close=")">
  361. #{id}
  362. </foreach>
  363. </delete>
  364. </mapper>