CheckJobMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  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="sbNo != null and sbNo != ''">
  157. and sbInfo.no like concat('%',#{sbNo},'%')
  158. </if>
  159. <if test="periodType != null and periodType != ''">
  160. and standard.period_type = #{periodType}
  161. </if>
  162. <if test="standardLevel != null and standardLevel != ''">
  163. and standard.level = #{standardLevel}
  164. </if>
  165. <if test="standardLevelList != null and standardLevelList.size > 0">
  166. AND standard.level in
  167. <foreach item="item" index="index" collection="standardLevelList" open="(" close=")" separator=",">
  168. #{item}
  169. </foreach>
  170. </if>
  171. <if test="checkUserId != null and checkUserId != ''">
  172. and checkjob.check_user_id = #{checkUserId}
  173. </if>
  174. <if test="type != null and type != ''">
  175. and checkjob.type = #{type}
  176. </if>
  177. <if test="searchStartTime != null and ( status==null or status==1 or status==2)">
  178. and checkjob.start_time <![CDATA[ >= ]]> date_format(#{searchStartTime},'%Y-%m-%d')
  179. </if>
  180. <if test="searchEndTime != null and (status==null or status==1 or status==2)">
  181. and checkjob.start_time <![CDATA[ <= ]]> #{searchEndTime}
  182. </if>
  183. <if test="searchStartTime != null and status!=null and status==3">
  184. and checkjob.actual_start_time <![CDATA[ >= ]]> #{searchStartTime}
  185. </if>
  186. <if test="searchEndTime != null and status!=null and status==3">
  187. and checkjob.actual_start_time <![CDATA[ <= ]]> #{searchEndTime}
  188. </if>
  189. <if test="statusList != null and statusList.size > 0">
  190. AND checkjob.status in
  191. <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
  192. #{item}
  193. </foreach>
  194. </if>
  195. <if test="checkUserName != null and checkUserName != ''">
  196. and u.real_name like concat('%',#{checkUserName},'%')
  197. </if>
  198. <if test="actualUser != null and actualUser != ''">
  199. and checkjob.actual_user like concat('%',#{actualUser},'%')
  200. </if>
  201. <if test="positionId!=null and positionId!=''">
  202. and sbInfo.position_id = #{positionId}
  203. </if>
  204. <if test="periodTypeList != null and periodTypeList.size > 0">
  205. AND standard.period_type in
  206. <foreach item="item" index="index" collection="periodTypeList" open="(" close=")" separator=",">
  207. #{item}
  208. </foreach>
  209. </if>
  210. <if test="sbLevelList != null and sbLevelList.size > 0">
  211. AND sbInfo.level in
  212. <foreach item="item" index="index" collection="sbLevelList" open="(" close=")" separator=",">
  213. #{item}
  214. </foreach>
  215. </if>
  216. <if test="sbNotStatus!=null">
  217. and sbInfo.status !=#{sbNotStatus}
  218. </if>
  219. <if test="typeId != null and typeId != ''">
  220. and sbinfo.typeId = #{typeId}
  221. </if>
  222. </sql>
  223. <select id="selectList" parameterType="com.platform.dao.dto.check.CheckJobDTO"
  224. resultType="com.platform.dao.vo.query.check.CheckJobVO">
  225. select checkjob.*, u.real_name as checkUserName,
  226. sbinfo.name sbName, sbinfo.no sbNo, sbinfo.level sbLevel,sbinfo.id,
  227. partinfo.name partName,
  228. standard.no standardNo, standard.name standardName,standard.level standardLevel,
  229. standard.period period, standard.period_type periodType,position .id as positionId,position .name as positionName
  230. from t_check_job as checkjob
  231. left join t_sb_info sbinfo on sbinfo.id = checkjob.sb_id
  232. left join t_part_info partinfo on partinfo.id = checkjob.part_id
  233. left join t_check_standard standard on standard.id = checkjob.standard_id
  234. left join t_sys_user u on checkjob.check_user_id = u.user_id
  235. left join t_sb_position position on position.id = sbinfo.position_id
  236. <where>
  237. <include refid="List_Condition"/>
  238. </where>
  239. Order By
  240. checkjob.status asc,
  241. <if test="status==null or status==1 or status==2">
  242. checkjob.start_time asc,
  243. </if>
  244. sbinfo.level asc,
  245. sbinfo.no asc,
  246. standard.period_type asc,
  247. standard.period asc
  248. </select>
  249. <select id="selectList2" parameterType="com.platform.dao.dto.check.CheckJobDTO"
  250. resultType="com.platform.dao.vo.query.check.CheckJobVO">
  251. select checkjob.*, u.real_name as checkUserName,
  252. sbinfo.name sbName, sbinfo.no sbNo, sbinfo.level sbLevel,sbinfo.id,
  253. partinfo.name partName,
  254. standard.no standardNo, standard.name standardName,standard.level standardLevel,
  255. standard.period period, standard.period_type periodType,position .id as positionId,position .name as positionName
  256. from t_check_job as checkjob
  257. left join t_sb_info sbinfo on sbinfo.id = checkjob.sb_id
  258. left join t_part_info partinfo on partinfo.id = checkjob.part_id
  259. left join t_check_standard standard on standard.id = checkjob.standard_id
  260. left join t_sys_user u on checkjob.check_user_id = u.user_id
  261. left join t_sb_position position on position.id = sbinfo.position_id
  262. <where>
  263. <include refid="List_Condition"/>
  264. </where>
  265. </select>
  266. <select id="getScreenCountByTime" parameterType="com.platform.dao.dto.check.CheckJobDTO"
  267. resultType="com.platform.dao.vo.query.check.CheckJobVO">
  268. select count(checkjob.id) as countNum
  269. from t_check_job as checkjob
  270. <where>
  271. <if test="searchStartTime != null">
  272. and checkjob.start_time <![CDATA[ >= ]]> #{searchStartTime}
  273. </if>
  274. <if test="searchEndTime != null">
  275. and checkjob.start_time <![CDATA[ <= ]]> #{searchEndTime}
  276. </if>
  277. <if test="status != null">
  278. and checkjob.status = #{status}
  279. </if>
  280. </where>
  281. </select>
  282. <select id="selectDetail" resultType="com.platform.dao.vo.query.check.CheckJobVO">
  283. select checkjob.*,
  284. u.real_name as checkUserName,
  285. sbinfo.name sbName,
  286. sbinfo.no sbNo,
  287. sbinfo.level sbLevel,
  288. partinfo.name partName,
  289. standard.no standardNo,
  290. standard.name standardName,
  291. standard.level standardLevel,
  292. standard.period period,
  293. standard.period_type periodType
  294. from t_check_job as checkjob
  295. left join t_sb_info sbinfo on sbinfo.id = checkjob.sb_id
  296. left join t_part_info partinfo on partinfo.id = checkjob.part_id
  297. left join t_check_standard standard on standard.id = checkjob.standard_id
  298. left join t_sys_user u on checkjob.check_user_id = u.user_id
  299. where checkjob.id = #{id}
  300. </select>
  301. <select id="getNotFinishNumByDTO" resultType="java.lang.Integer">
  302. select count(checkjob.id)
  303. from t_check_job as checkjob
  304. left join t_sb_info sbinfo on sbinfo.id = checkjob.sb_id
  305. left join t_part_info partinfo on partinfo.id = checkjob.part_id
  306. left join t_check_standard standard on standard.id = checkjob.standard_id
  307. left join t_sys_user u on checkjob.check_user_id = u.user_id
  308. <where>
  309. <include refid="List_Condition"/>
  310. </where>
  311. </select>
  312. <select id="selectLastJob" parameterType="com.platform.dao.dto.check.CheckJobDTO"
  313. resultType="com.platform.dao.vo.query.check.CheckJobVO">
  314. select checkjob.*
  315. from t_check_job as checkjob
  316. where checkjob.sb_id = #{sbId}
  317. and checkjob.standard_id = #{standardId}
  318. order by checkjob.created_time desc limit 1
  319. </select>
  320. <update id="updateBatch" parameterType="java.util.List">
  321. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  322. update t_check_job
  323. <set>
  324. <if test="item.receiveOvertime != null">
  325. receive_overtime = #{item.receiveOvertime}
  326. </if>
  327. <if test="item.startTime != null">
  328. start_time = #{item.startTime}
  329. </if>
  330. </set>
  331. where id = #{item.id}
  332. </foreach>
  333. </update>
  334. </mapper>