CheckJobMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.platform.dao.mapper.check.CheckJobMapper">
  4. <sql id="Base_Column_List">
  5. checkjob.id,
  6. checkjob.plan_id,
  7. checkstandard.standard_hours,
  8. checkstandard.real_hours,
  9. checkjob.start_time,
  10. checkjob.end_time,
  11. checkjob.actual_user,
  12. checkjob.type,
  13. checkjob.actual_start_time,
  14. checkjob.actual_end_time,
  15. checkjob.status,
  16. checkjob.sb_status,
  17. checkjob.receive_overtime,
  18. checkjob.check_user_id,
  19. checkjob.created_user_id,
  20. checkjob.update_user_id,
  21. checkjob.created_user_name,
  22. checkjob.update_user_name,
  23. checkjob.created_time,
  24. checkjob.update_time
  25. </sql>
  26. <sql id="Ref_Column_List">
  27. checkjob.plan_id,
  28. checkjob.actual_user,
  29. checkstandard.standard_hours,
  30. checkstandard.real_hours,
  31. checkjob.start_time,
  32. checkjob.type,
  33. checkjob.check_user_id,
  34. checkjob.end_time,
  35. checkjob.actual_start_time,
  36. checkjob.actual_end_time,
  37. checkjob.checked_num,
  38. checkjob.abnormal_num,
  39. checkjob.check_num,
  40. checkjob.status,
  41. checkjob.receive_overtime,
  42. checkjob.sb_status
  43. </sql>
  44. <sql id="List_Condition">
  45. <if test="id != null and id != ''">
  46. and checkjob.id = #{id}
  47. </if>
  48. <if test="receiveOvertime != null">
  49. and checkjob.receive_overtime = #{receiveOvertime}
  50. </if>
  51. <if test="planId != null and planId != ''">
  52. and checkjob.plan_id = #{planId}
  53. </if>
  54. <if test="sbId != null and sbId != ''">
  55. and checkjob.sb_id = #{sbId}
  56. </if>
  57. <if test="partId != null and partId != ''">
  58. and checkjob.part_id = #{partId}
  59. </if>
  60. <if test="standardId != null and standardId != ''">
  61. and checkjob.standard_id = #{standardId}
  62. </if>
  63. <if test="requirement != null and requirement != ''">
  64. and checkjob.requirement = #{requirement}
  65. </if>
  66. <if test="remark != null and remark != ''">
  67. and checkjob.remark = #{remark}
  68. </if>
  69. <if test="feedback != null and feedback != ''">
  70. and checkjob.feedback = #{feedback}
  71. </if>
  72. <if test="status ==null and startTimeStart != null ">
  73. and checkjob.start_time <![CDATA[>=]]>#{startTimeStart}
  74. </if>
  75. <if test="status ==null and startTimeEnd != null">
  76. and checkjob.start_time <![CDATA[<=]]> #{startTimeEnd}
  77. </if>
  78. <if test="startTime != null">
  79. and checkjob.start_time = #{startTime}
  80. </if>
  81. <if test="endTimeStart != null">
  82. and checkjob.end_time <![CDATA[>=]]>; #{endTimeStart}
  83. </if>
  84. <if test="endTimeEnd != null">
  85. and checkjob.end_time <![CDATA[<=]]> #{endTimeEnd}
  86. </if>
  87. <if test="endTime != null">
  88. and checkjob.end_time = #{endTime}
  89. </if>
  90. <if test="actualStartTimeStart != null">
  91. and checkjob.actual_start_time <![CDATA[>=]]>; #{actualStartTimeStart}
  92. </if>
  93. <if test="actualStartTimeEnd != null">
  94. and checkjob.actual_start_time <![CDATA[<=]]> #{actualStartTimeEnd}
  95. </if>
  96. <if test="actualStartTime != null">
  97. and checkjob.actual_start_time = #{actualStartTime}
  98. </if>
  99. <if test="actualEndTimeStart != null">
  100. and checkjob.actual_end_time <![CDATA[>=]]> #{actualEndTimeStart}
  101. </if>
  102. <if test="actualEndTimeEnd != null">
  103. and checkjob.actual_end_time <![CDATA[<=]]> #{actualEndTimeEnd}
  104. </if>
  105. <if test="actualEndTime != null">
  106. and checkjob.actual_end_time = #{actualEndTime}
  107. </if>
  108. <if test="status != null">
  109. and checkjob.status = #{status}
  110. </if>
  111. <if test="sbStatus != null">
  112. and checkjob.sb_status = #{sbStatus}
  113. </if>
  114. <if test="createdUserId != null and createdUserId != ''">
  115. and checkjob.created_user_id = #{createdUserId}
  116. </if>
  117. <if test="updateUserId != null and updateUserId != ''">
  118. and checkjob.update_user_id = #{updateUserId}
  119. </if>
  120. <if test="createdUserName != null and createdUserName != ''">
  121. and checkjob.created_user_name = #{createdUserName}
  122. </if>
  123. <if test="updateUserName != null and updateUserName != ''">
  124. and checkjob.update_user_name = #{updateUserName}
  125. </if>
  126. <if test="createdTimeStart != null">
  127. and checkjob.created_time <![CDATA[>=]]> #{createdTimeStart}
  128. </if>
  129. <if test="createdTimeEnd != null">
  130. and checkjob.created_time <![CDATA[<=]]> #{createdTimeEnd}
  131. </if>
  132. <if test="createdTime != null">
  133. and checkjob.created_time = #{createdTime}
  134. </if>
  135. <if test="updateTimeStart != null">
  136. and checkjob.update_time <![CDATA[>=]]> #{updateTimeStart}
  137. </if>
  138. <if test="updateTimeEnd != null">
  139. and checkjob.update_time <![CDATA[<=]]> #{updateTimeEnd}
  140. </if>
  141. <if test="updateTime != null">
  142. and checkjob.update_time = #{updateTime}
  143. </if>
  144. <if test="keyword != null and keyword != ''">
  145. and (
  146. standard.no like concat('%',#{keyword},'%') or
  147. sbinfo.name like concat('%',#{keyword},'%') or
  148. sbinfo.no like concat('%',#{keyword},'%') )
  149. </if>
  150. <if test="zbh != null and zbh != ''">
  151. and sbinfo.zbh = #{zbh}
  152. </if>
  153. <if test="sbLevel != null and sbLevel != ''">
  154. and sbinfo.level = #{sbLevel}
  155. </if>
  156. <if test="periodType != null and periodType != ''">
  157. and standard.period_type = #{periodType}
  158. </if>
  159. <if test="standardLevel != null and standardLevel != ''">
  160. and standard.level = #{standardLevel}
  161. </if>
  162. <if test="standardLevelList != null and standardLevelList.size > 0">
  163. AND standard.level in
  164. <foreach item="item" index="index" collection="standardLevelList" open="(" close=")" separator=",">
  165. #{item}
  166. </foreach>
  167. </if>
  168. <if test="checkUserId != null and checkUserId != ''">
  169. and checkjob.check_user_id = #{checkUserId}
  170. </if>
  171. <if test="type != null and type != ''">
  172. and checkjob.type = #{type}
  173. </if>
  174. <if test="searchStartTime != null and status==null or status==1 or status==2">
  175. and checkjob.start_time <![CDATA[ >= ]]> date_format(#{searchStartTime},'%Y-%m-%d')
  176. </if>
  177. <if test="searchEndTime != null and status==null or status==1 or status==2">
  178. and checkjob.start_time <![CDATA[ <= ]]> #{searchEndTime}
  179. </if>
  180. <if test="searchStartTime != null and status!=null and status==3">
  181. and checkjob.actual_start_time <![CDATA[ >= ]]> #{searchStartTime}
  182. </if>
  183. <if test="searchEndTime != null and status!=null and status==3">
  184. and checkjob.actual_start_time <![CDATA[ <= ]]> #{searchEndTime}
  185. </if>
  186. <if test="statusList != null and statusList.size > 0">
  187. AND checkjob.status in
  188. <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
  189. #{item}
  190. </foreach>
  191. </if>
  192. <if test="checkUserName != null and checkUserName != ''">
  193. and u.real_name like concat('%',#{checkUserName},'%')
  194. </if>
  195. <if test="actualUser != null and actualUser != ''">
  196. and checkjob.actual_user like concat('%',#{actualUser},'%')
  197. </if>
  198. <if test="positionId!=null and positionId!=''">
  199. and sbInfo.position_id = #{positionId}
  200. </if>
  201. </sql>
  202. <select id="selectList" parameterType="com.platform.dao.dto.check.CheckJobDTO"
  203. resultType="com.platform.dao.vo.query.check.CheckJobVO">
  204. select checkjob.*, u.real_name as checkUserName,
  205. sbinfo.name sbName, sbinfo.no sbNo, sbinfo.level sbLevel,sbinfo.id,
  206. partinfo.name partName,
  207. standard.no standardNo, standard.name standardName,standard.level standardLevel,
  208. standard.period period, standard.period_type periodType
  209. from t_check_job as checkjob
  210. left join t_sb_info sbinfo on sbinfo.id = checkjob.sb_id
  211. left join t_part_info partinfo on partinfo.id = checkjob.part_id
  212. left join t_check_standard standard on standard.id = checkjob.standard_id
  213. left join t_sys_user u on checkjob.check_user_id = u.user_id
  214. <where>
  215. <include refid="List_Condition"/>
  216. </where>
  217. Order By
  218. checkjob.status asc,
  219. sbinfo.level asc,
  220. sbinfo.no asc,
  221. standard.period_type asc,
  222. standard.period asc
  223. </select>
  224. <select id="getScreenCountByTime" parameterType="com.platform.dao.dto.check.CheckJobDTO"
  225. resultType="com.platform.dao.vo.query.check.CheckJobVO">
  226. select count(checkjob.id) as countNum
  227. from t_check_job as checkjob
  228. <where>
  229. <if test="searchStartTime != null">
  230. and checkjob.start_time <![CDATA[ >= ]]> #{searchStartTime}
  231. </if>
  232. <if test="searchEndTime != null">
  233. and checkjob.start_time <![CDATA[ <= ]]> #{searchEndTime}
  234. </if>
  235. <if test="status != null">
  236. and checkjob.status = #{status}
  237. </if>
  238. </where>
  239. </select>
  240. <select id="selectDetail" resultType="com.platform.dao.vo.query.check.CheckJobVO">
  241. select checkjob.*,
  242. u.real_name as checkUserName,
  243. sbinfo.name sbName,
  244. sbinfo.no sbNo,
  245. sbinfo.level sbLevel,
  246. partinfo.name partName,
  247. standard.no standardNo,
  248. standard.name standardName,
  249. standard.level standardLevel,
  250. standard.period period,
  251. standard.period_type periodType
  252. from t_check_job as checkjob
  253. left join t_sb_info sbinfo on sbinfo.id = checkjob.sb_id
  254. left join t_part_info partinfo on partinfo.id = checkjob.part_id
  255. left join t_check_standard standard on standard.id = checkjob.standard_id
  256. left join t_sys_user u on checkjob.check_user_id = u.user_id
  257. where checkjob.id = #{id}
  258. </select>
  259. <select id="getNotFinishNumByDTO" resultType="java.lang.Integer">
  260. select count(checkjob.id)
  261. from t_check_job as checkjob
  262. left join t_sb_info sbinfo on sbinfo.id = checkjob.sb_id
  263. left join t_part_info partinfo on partinfo.id = checkjob.part_id
  264. left join t_check_standard standard on standard.id = checkjob.standard_id
  265. left join t_sys_user u on checkjob.check_user_id = u.user_id
  266. <where>
  267. <include refid="List_Condition"/>
  268. </where>
  269. </select>
  270. <select id="selectLastJob" parameterType="com.platform.dao.dto.check.CheckJobDTO"
  271. resultType="com.platform.dao.vo.query.check.CheckJobVO">
  272. select checkjob.*
  273. from t_check_job as checkjob
  274. where checkjob.sb_id = #{sbId}
  275. and checkjob.standard_id = #{standardId}
  276. order by checkjob.created_time desc limit 1
  277. </select>
  278. <update id="updateBatch" parameterType="java.util.List">
  279. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  280. update t_check_job
  281. <set>
  282. <if test="item.receiveOvertime != null">
  283. receive_overtime = #{item.receiveOvertime}
  284. </if>
  285. <if test="item.startTime != null">
  286. start_time = #{item.startTime}
  287. </if>
  288. </set>
  289. where id = #{item.id}
  290. </foreach>
  291. </update>
  292. </mapper>