CheckJobMapper.xml 14 KB

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