BdglLeaveMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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.supervision.peopleChuRu.mapper.BdglLeaveMapper">
  6. <resultMap type="BdglLeave" id="BdglLeaveResult">
  7. <result property="id" column="id" />
  8. <result property="peopleId" column="people_id" />
  9. <result property="unitId" column="unit_id" />
  10. <result property="startTime" column="start_time" />
  11. <result property="endTime" column="end_time" />
  12. <result property="leaveType" column="leave_type" />
  13. <result property="leaveReason" column="leave_reason" />
  14. <result property="departureTime" column="departure_time" />
  15. <result property="returnTime" column="return_time" />
  16. <result property="returnStatus" column="return_status" />
  17. <result property="isReturn" column="is_return" />
  18. <result property="updatetime" column="updatetime" />
  19. <result property="adminId" column="admin_id" />
  20. <result property="createtime" column="createtime" />
  21. <result property="peopleId1" column="people_id1" />
  22. <result property="postId" column="post_id" />
  23. <result property="peopleId2" column="people_id2" />
  24. <result property="peopleId3" column="people_id3" />
  25. <result property="peopleId4" column="people_id4" />
  26. <result property="status1" column="status1" />
  27. <result property="status2" column="status2" />
  28. <result property="status3" column="status3" />
  29. <result property="status4" column="status4" />
  30. <result property="contents" column="contents" />
  31. <result property="statusd" column="statusd" />
  32. <result property="rejoin" column="rejoin" />
  33. <result property="unitName" column="unit_name" />
  34. <result property="peopleName" column="people_name" />
  35. <result property="peopleName1" column="people_name1" />
  36. <result property="peopleName2" column="people_name2" />
  37. <result property="peopleName3" column="people_name3" />
  38. <result property="peopleName4" column="people_name4" />
  39. <result property="reasons" column="reasons" />
  40. <result property="specialApproval" column="special_approval" />
  41. <result property="actualreturntime" column="actualreturntime" />
  42. </resultMap>
  43. <sql id="selectBdglLeaveVo">
  44. select id, people_id, unit_id, start_time, end_time, leave_type, leave_reason, departure_time, return_time, return_status, is_return, updatetime, admin_id, createtime, people_id1, post_id, people_id2, people_id3, people_id4, status1, status2, status3, status4, contents, statusd, rejoin, unit_name, people_name, people_name1, people_name2, people_name3, people_name4,reasons,special_approval,actualreturntime from bdgl_leave
  45. </sql>
  46. <select id="selectBdglLeaveList" parameterType="BdglLeave" resultMap="BdglLeaveResult">
  47. <include refid="selectBdglLeaveVo"/>
  48. <where>
  49. <if test="peopleId != null "> and people_id = #{peopleId}</if>
  50. <if test="unitId != null "> and unit_id = #{unitId}</if>
  51. <if test="startTime != null "> and start_time = #{startTime}</if>
  52. <if test="endTime != null "> and end_time = #{endTime}</if>
  53. <if test="leaveType != null and leaveType != ''"> and leave_type = #{leaveType}</if>
  54. <if test="leaveReason != null and leaveReason != ''"> and leave_reason = #{leaveReason}</if>
  55. <if test="departureTime != null and departureTime != ''"> and departure_time = #{departureTime}</if>
  56. <if test="returnTime != null and returnTime != ''"> and return_time = #{returnTime}</if>
  57. <if test="returnStatus != null and returnStatus != ''"> and return_status = #{returnStatus}</if>
  58. <if test="isReturn != null and isReturn != ''"> and is_return = #{isReturn}</if>
  59. <if test="updatetime != null and updatetime != ''"> and updatetime = #{updatetime}</if>
  60. <if test="adminId != null "> and admin_id = #{adminId}</if>
  61. <if test="createtime != null and createtime != ''"> and createtime = #{createtime}</if>
  62. <if test="peopleId1 != null "> and people_id1 = #{peopleId1}</if>
  63. <if test="postId != null "> and post_id = #{postId}</if>
  64. <if test="peopleId2 != null "> and people_id2 = #{peopleId2}</if>
  65. <if test="peopleId3 != null "> and people_id3 = #{peopleId3}</if>
  66. <if test="peopleId4 != null "> and people_id4 = #{peopleId4}</if>
  67. <if test="status1 != null "> and status1 = #{status1}</if>
  68. <if test="status2 != null "> and status2 = #{status2}</if>
  69. <if test="status3 != null "> and status3 = #{status3}</if>
  70. <if test="status4 != null "> and status4 = #{status4}</if>
  71. <if test="contents != null and contents != ''"> and contents = #{contents}</if>
  72. <if test="statusd != null "> and statusd = #{statusd}</if>
  73. <if test="rejoin != null "> and rejoin = #{rejoin}</if>
  74. <if test="unitName != null and unitName != ''"> and unit_name like concat('%', #{unitName}, '%')</if>
  75. <if test="peopleName != null and peopleName != ''"> and people_name like concat('%', #{peopleName}, '%')</if>
  76. <if test="peopleName1 != null and peopleName1 != ''"> and people_name1 = #{peopleName1}</if>
  77. <if test="peopleName2 != null and peopleName2 != ''"> and people_name2 = #{peopleName2}</if>
  78. <if test="peopleName3 != null and peopleName3 != ''"> and people_name3 = #{peopleName3}</if>
  79. <if test="peopleName4 != null and peopleName4 != ''"> and people_name4 = #{peopleName4}</if>
  80. <if test="reasons != null and reasons != ''"> and reasons = #{reasons}</if>
  81. <if test="specialApproval != null and specialApproval != ''"> and special_approval = #{specialApproval}</if>
  82. <if test="actualreturntime != null "> and actualreturntime = #{actualreturntime}</if>
  83. <if test="names != null "> and people_id in
  84. <foreach item="names" collection="names" open="(" separator="," close=")">
  85. #{names}
  86. </foreach></if>
  87. </where>
  88. order by id desc
  89. </select>
  90. <select id="selectBdglLeaveById" parameterType="Long" resultMap="BdglLeaveResult">
  91. <include refid="selectBdglLeaveVo"/>
  92. where id = #{id}
  93. </select>
  94. <select id="selectBdglLeavePeopless" resultMap="BdglLeaveResult">
  95. <include refid="selectBdglLeaveVo"/>
  96. where
  97. <![CDATA[
  98. start_time <= #{startTime} and end_time>=#{startTime}
  99. ]]>
  100. and unit_id=#{unitId}
  101. and leave_type in('1','8')
  102. and (status4=1 or status4=3)
  103. </select>
  104. <select id="selectBdglLeaveListes" resultMap="BdglLeaveResult">
  105. <include refid="selectBdglLeaveVo"/>
  106. where to_days(createtime) = to_days(now())
  107. AND departure_time is null
  108. </select>
  109. <select id="selectBdglLeaveLists" resultMap="BdglLeaveResult">
  110. <include refid="selectBdglLeaveVo"/>
  111. WHERE departure_time is not null
  112. AND return_time is null
  113. </select>
  114. <select id="selectBdglLeaveListsss" parameterType="BdglLeave" resultMap="BdglLeaveResult">
  115. <include refid="selectBdglLeaveVo"/>
  116. <where>
  117. and DATE(start_time) = DATE(NOW())
  118. <if test="peopleId != null "> and people_id = #{peopleId}</if>
  119. <if test="unitId != null "> and unit_id = #{unitId}</if>
  120. <if test="endTime != null "> and end_time = #{endTime}</if>
  121. <if test="leaveType != null and leaveType != ''"> and leave_type = #{leaveType}</if>
  122. <if test="leaveReason != null and leaveReason != ''"> and leave_reason = #{leaveReason}</if>
  123. <if test="departureTime != null and departureTime != ''"> and departure_time = #{departureTime}</if>
  124. <if test="returnTime != null and returnTime != ''"> and return_time = #{returnTime}</if>
  125. <if test="returnStatus != null and returnStatus != ''"> and return_status = #{returnStatus}</if>
  126. <if test="isReturn != null and isReturn != ''"> and is_return = #{isReturn}</if>
  127. <if test="updatetime != null and updatetime != ''"> and updatetime = #{updatetime}</if>
  128. <if test="adminId != null "> and admin_id = #{adminId}</if>
  129. <if test="createtime != null and createtime != ''"> and createtime = #{createtime}</if>
  130. <if test="peopleId1 != null "> and people_id1 = #{peopleId1}</if>
  131. <if test="postId != null "> and post_id = #{postId}</if>
  132. <if test="peopleId2 != null "> and people_id2 = #{peopleId2}</if>
  133. <if test="peopleId3 != null "> and people_id3 = #{peopleId3}</if>
  134. <if test="peopleId4 != null "> and people_id4 = #{peopleId4}</if>
  135. <if test="status1 != null "> and status1 = #{status1}</if>
  136. <if test="status2 != null "> and status2 = #{status2}</if>
  137. <if test="status3 != null "> and status3 = #{status3}</if>
  138. <if test="status4 != null "> and status4 = #{status4}</if>
  139. <if test="contents != null and contents != ''"> and contents = #{contents}</if>
  140. <if test="statusd != null "> and statusd = #{statusd}</if>
  141. <if test="rejoin != null "> and rejoin = #{rejoin}</if>
  142. <if test="unitName != null and unitName != ''"> and unit_name like concat('%', #{unitName}, '%')</if>
  143. <if test="peopleName != null and peopleName != ''"> and people_name like concat('%', #{peopleName}, '%')</if>
  144. <if test="peopleName1 != null and peopleName1 != ''"> and people_name1 = #{peopleName1}</if>
  145. <if test="peopleName2 != null and peopleName2 != ''"> and people_name2 = #{peopleName2}</if>
  146. <if test="peopleName3 != null and peopleName3 != ''"> and people_name3 = #{peopleName3}</if>
  147. <if test="peopleName4 != null and peopleName4 != ''"> and people_name4 = #{peopleName4}</if>
  148. <if test="reasons != null and reasons != ''"> and reasons = #{reasons}</if>
  149. <if test="specialApproval != null and specialApproval != ''"> and special_approval = #{specialApproval}</if>
  150. <if test="actualreturntime != null "> and actualreturntime = #{actualreturntime}</if>
  151. <if test="names != null "> and people_id in
  152. <foreach item="names" collection="names" open="(" separator="," close=")">
  153. #{names}
  154. </foreach></if>
  155. </where>
  156. order by id desc
  157. </select>
  158. <insert id="insertBdglLeave" parameterType="BdglLeave" useGeneratedKeys="true" keyProperty="id">
  159. insert into bdgl_leave
  160. <trim prefix="(" suffix=")" suffixOverrides=",">
  161. <if test="peopleId != null">people_id,</if>
  162. <if test="unitId != null">unit_id,</if>
  163. <if test="startTime != null">start_time,</if>
  164. <if test="endTime != null">end_time,</if>
  165. <if test="leaveType != null">leave_type,</if>
  166. <if test="leaveReason != null">leave_reason,</if>
  167. <if test="departureTime != null">departure_time,</if>
  168. <if test="returnTime != null">return_time,</if>
  169. <if test="returnStatus != null">return_status,</if>
  170. <if test="isReturn != null">is_return,</if>
  171. <if test="updatetime != null">updatetime,</if>
  172. <if test="adminId != null">admin_id,</if>
  173. <if test="createtime != null">createtime,</if>
  174. <if test="peopleId1 != null">people_id1,</if>
  175. <if test="postId != null">post_id,</if>
  176. <if test="peopleId2 != null">people_id2,</if>
  177. <if test="peopleId3 != null">people_id3,</if>
  178. <if test="peopleId4 != null">people_id4,</if>
  179. <if test="status1 != null">status1,</if>
  180. <if test="status2 != null">status2,</if>
  181. <if test="status3 != null">status3,</if>
  182. <if test="status4 != null">status4,</if>
  183. <if test="contents != null">contents,</if>
  184. <if test="statusd != null">statusd,</if>
  185. <if test="rejoin != null">rejoin,</if>
  186. <if test="unitName != null">unit_name,</if>
  187. <if test="peopleName != null">people_name,</if>
  188. <if test="peopleName1 != null">people_name1,</if>
  189. <if test="peopleName2 != null">people_name2,</if>
  190. <if test="peopleName3 != null">people_name3,</if>
  191. <if test="peopleName4 != null">people_name4,</if>
  192. <if test="reasons != null">reasons,</if>
  193. <if test="specialApproval != null">special_approval,</if>
  194. <if test="actualreturntime != null">actualreturntime,</if>
  195. </trim>
  196. <trim prefix="values (" suffix=")" suffixOverrides=",">
  197. <if test="peopleId != null">#{peopleId},</if>
  198. <if test="unitId != null">#{unitId},</if>
  199. <if test="startTime != null">#{startTime},</if>
  200. <if test="endTime != null">#{endTime},</if>
  201. <if test="leaveType != null">#{leaveType},</if>
  202. <if test="leaveReason != null">#{leaveReason},</if>
  203. <if test="departureTime != null">#{departureTime},</if>
  204. <if test="returnTime != null">#{returnTime},</if>
  205. <if test="returnStatus != null">#{returnStatus},</if>
  206. <if test="isReturn != null">#{isReturn},</if>
  207. <if test="updatetime != null">#{updatetime},</if>
  208. <if test="adminId != null">#{adminId},</if>
  209. <if test="createtime != null">#{createtime},</if>
  210. <if test="peopleId1 != null">#{peopleId1},</if>
  211. <if test="postId != null">#{postId},</if>
  212. <if test="peopleId2 != null">#{peopleId2},</if>
  213. <if test="peopleId3 != null">#{peopleId3},</if>
  214. <if test="peopleId4 != null">#{peopleId4},</if>
  215. <if test="status1 != null">#{status1},</if>
  216. <if test="status2 != null">#{status2},</if>
  217. <if test="status3 != null">#{status3},</if>
  218. <if test="status4 != null">#{status4},</if>
  219. <if test="contents != null">#{contents},</if>
  220. <if test="statusd != null">#{statusd},</if>
  221. <if test="rejoin != null">#{rejoin},</if>
  222. <if test="unitName != null">#{unitName},</if>
  223. <if test="peopleName != null">#{peopleName},</if>
  224. <if test="peopleName1 != null">#{peopleName1},</if>
  225. <if test="peopleName2 != null">#{peopleName2},</if>
  226. <if test="peopleName3 != null">#{peopleName3},</if>
  227. <if test="peopleName4 != null">#{peopleName4},</if>
  228. <if test="reasons != null">#{reasons},</if>
  229. <if test="specialApproval != null">#{specialApproval},</if>
  230. <if test="actualreturntime != null">#{actualreturntime},</if>
  231. </trim>
  232. </insert>
  233. <update id="updateBdglLeave" parameterType="BdglLeave">
  234. update bdgl_leave
  235. <trim prefix="SET" suffixOverrides=",">
  236. <if test="peopleId != null">people_id = #{peopleId},</if>
  237. <if test="unitId != null">unit_id = #{unitId},</if>
  238. <if test="startTime != null">start_time = #{startTime},</if>
  239. <if test="endTime != null">end_time = #{endTime},</if>
  240. <if test="leaveType != null">leave_type = #{leaveType},</if>
  241. <if test="leaveReason != null">leave_reason = #{leaveReason},</if>
  242. <if test="departureTime != null">departure_time = #{departureTime},</if>
  243. <if test="returnTime != null">return_time = #{returnTime},</if>
  244. <if test="returnStatus != null">return_status = #{returnStatus},</if>
  245. <if test="isReturn != null">is_return = #{isReturn},</if>
  246. <if test="updatetime != null">updatetime = #{updatetime},</if>
  247. <if test="adminId != null">admin_id = #{adminId},</if>
  248. <if test="createtime != null">createtime = #{createtime},</if>
  249. <if test="peopleId1 != null">people_id1 = #{peopleId1},</if>
  250. <if test="postId != null">post_id = #{postId},</if>
  251. <if test="peopleId2 != null">people_id2 = #{peopleId2},</if>
  252. <if test="peopleId3 != null">people_id3 = #{peopleId3},</if>
  253. <if test="peopleId4 != null">people_id4 = #{peopleId4},</if>
  254. <if test="status1 != null">status1 = #{status1},</if>
  255. <if test="status2 != null">status2 = #{status2},</if>
  256. <if test="status3 != null">status3 = #{status3},</if>
  257. <if test="status4 != null">status4 = #{status4},</if>
  258. <if test="contents != null">contents = #{contents},</if>
  259. <if test="statusd != null">statusd = #{statusd},</if>
  260. <if test="rejoin != null">rejoin = #{rejoin},</if>
  261. <if test="unitName != null">unit_name = #{unitName},</if>
  262. <if test="peopleName != null">people_name = #{peopleName},</if>
  263. <if test="peopleName1 != null">people_name1 = #{peopleName1},</if>
  264. <if test="peopleName2 != null">people_name2 = #{peopleName2},</if>
  265. <if test="peopleName3 != null">people_name3 = #{peopleName3},</if>
  266. <if test="peopleName4 != null">people_name4 = #{peopleName4},</if>
  267. <if test="reasons != null">reasons = #{reasons},</if>
  268. <if test="specialApproval != null">special_approval = #{specialApproval},</if>
  269. <if test="actualreturntime != null">actualreturntime = #{actualreturntime},</if>
  270. </trim>
  271. where id = #{id}
  272. </update>
  273. <delete id="deleteBdglLeaveById" parameterType="Long">
  274. delete from bdgl_leave where id = #{id}
  275. </delete>
  276. <delete id="deleteBdglLeaveByIds" parameterType="String">
  277. delete from bdgl_leave where id in
  278. <foreach item="id" collection="array" open="(" separator="," close=")">
  279. #{id}
  280. </foreach>
  281. </delete>
  282. </mapper>