CheckTaskMapper.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  4. <mapper namespace="com.zhyc.xps.aqpt.mapper.CheckTaskMapper">
  5. <resultMap id="CheckTaskDtoMap" type="com.zhyc.xps.aqpt.dto.CheckTaskDto">
  6. <result column="oc_id" property="ocId" jdbcType="BIGINT" />
  7. <result column="task_id" property="taskId" jdbcType="BIGINT" />
  8. <result column="task_code" property="taskCode" jdbcType="VARCHAR" />
  9. <result column="task_title" property="taskTitle" jdbcType="VARCHAR" />
  10. <result column="task_desc" property="taskDesc" jdbcType="VARCHAR" />
  11. <result column="task_cat_id" property="taskCatId" jdbcType="BIGINT" />
  12. <result column="task_type_id" property="taskTypeId" jdbcType="BIGINT" />
  13. <result column="expected_start_time" property="expectedStartTime" jdbcType="TIMESTAMP"/>
  14. <result column="expected_end_time" property="expectedEndTime" jdbcType="TIMESTAMP"/>
  15. <result column="actual_start_time" property="actualStartTime" jdbcType="TIMESTAMP"/>
  16. <result column="actual_end_time" property="actualEndTime" jdbcType="TIMESTAMP"/>
  17. <result column="task_priority" property="taskPriority" jdbcType="BIGINT" />
  18. <result column="status" property="status" jdbcType="BIGINT" />
  19. <result column="parent_id" property="parentId" jdbcType="BIGINT" />
  20. <result column="root_id" property="rootId" jdbcType="BIGINT" />
  21. <result column="task_origin" property="taskOrigin" jdbcType="BIGINT" />
  22. <result column="launch_group_id" property="launchGroupId" jdbcType="BIGINT" />
  23. <result column="launch_position_id" property="launchPositionId" jdbcType="BIGINT" />
  24. <result column="launch_account_id" property="launchAccountId" jdbcType="BIGINT" />
  25. <result column="launch_group_name" property="launchGroupName" jdbcType="VARCHAR" />
  26. <result column="launch_position_name" property="launchPositionName" jdbcType="VARCHAR" />
  27. <result column="launch_account_name" property="launchAccountName" jdbcType="VARCHAR" />
  28. <result column="launch_time" property="launchTime" jdbcType="TIMESTAMP"/>
  29. <result column="handle_group_id" property="handleGroupId" jdbcType="BIGINT" />
  30. <result column="handle_position_id" property="handlePositionId" jdbcType="BIGINT" />
  31. <result column="handle_account_id" property="handleAccountId" jdbcType="BIGINT" />
  32. <result column="handle_group_name" property="handleGroupName" jdbcType="VARCHAR" />
  33. <result column="handle_position_name" property="handlePositionName" jdbcType="VARCHAR" />
  34. <result column="handle_account_name" property="handleAccountName" jdbcType="VARCHAR" />
  35. <result column="risk_point_id" property="riskPointId" jdbcType="BIGINT" />
  36. <result column="risk_point_title" property="riskPointTitle" jdbcType="VARCHAR" />
  37. <result column="check_def_id" property="checkDefId" jdbcType="BIGINT" />
  38. <result column="check_cat_id" property="checkCatId" jdbcType="BIGINT" />
  39. <result column="check_cat_title" property="checkCatTitle" jdbcType="VARCHAR" />
  40. <result column="check_type_id" property="checkTypeId" jdbcType="BIGINT" />
  41. <result column="checklist_type_id" property="checklistTypeId" jdbcType="BIGINT" />
  42. <result column="checklist_title" property="checklistTitle" jdbcType="VARCHAR" />
  43. <result column="checklist_cat_id" property="checklistCatId" jdbcType="BIGINT" />
  44. <result column="checklist_cat_title" property="checklistCatTitle" jdbcType="VARCHAR" />
  45. <result column="checklist_desc" property="checklistDesc" jdbcType="VARCHAR" />
  46. <result column="checklist_version" property="checklistVersion" jdbcType="VARCHAR" />
  47. <result column="check_status" property="checkStatus" jdbcType="BIGINT" />
  48. </resultMap>
  49. <sql id="CheckTaskDto_Cols">
  50. A.oc_id,
  51. B.task_id,
  52. B.task_code,
  53. B.task_title,
  54. B.task_desc,
  55. B.task_type_id,
  56. B.task_cat_id,
  57. C.task_cat_title,
  58. B.task_priority,
  59. B.launch_group_id,
  60. D.group_name AS launch_group_name,
  61. B.launch_position_id,
  62. E.position_name AS launch_position_name,
  63. B.launch_account_id,
  64. F.account_name AS launch_account_name,
  65. B.launch_time,
  66. B.expected_start_time,
  67. B.expected_end_time,
  68. B.actual_start_time,
  69. B.actual_end_time,
  70. B.handle_group_id,
  71. B.handle_group_name,
  72. B.handle_position_id,
  73. B.handle_position_name,
  74. B.handle_account_id,
  75. B.handle_account_name,
  76. B.status,
  77. A.risk_point_id,
  78. G.risk_point_title,
  79. A.check_def_id,
  80. A.check_type_id,
  81. A.check_cat_id,
  82. N.check_cat_title,
  83. A.check_status,
  84. A.checklist_id,
  85. A.check_count,
  86. H.checklist_title,
  87. H.checklist_type_id,
  88. H.checklist_desc,
  89. H.checklist_cat_id,
  90. M.checklist_cat_title,
  91. H.version AS checklist_version
  92. </sql>
  93. <!--基于ID查询-->
  94. <select id="getById" resultMap="CheckTaskDtoMap">
  95. SELECT
  96. <include refid="CheckTaskDto_Cols"/>
  97. FROM check_task AS A
  98. LEFT JOIN task AS B ON (A.oc_id = B.oc_id AND A.task_id = B.task_id )
  99. LEFT JOIN task_cat AS C ON (B.oc_id = C.oc_id AND B.task_cat_id = C.task_cat_id )
  100. LEFT JOIN s_group AS D ON (B.oc_id = D.oc_id AND B.launch_group_id = D.group_id )
  101. LEFT JOIN s_position AS E ON (B.oc_id = E.oc_id AND B.launch_position_id = E.position_id )
  102. LEFT JOIN account AS F ON (B.oc_id = F.oc_id AND B.launch_account_id = F.account_id )
  103. LEFT JOIN ent_risk_point AS G ON (A.oc_id = G.oc_id AND A.risk_point_id = G.risk_point_id )
  104. LEFT JOIN checklist AS H ON (A.oc_id = H.oc_id AND A.checklist_id = H.checklist_id )
  105. LEFT JOIN checklist_cat AS M ON (H.oc_id = M.oc_id AND H.checklist_cat_id = M.checklist_cat_id )
  106. LEFT JOIN check_cat AS N ON (A.oc_id = N.oc_id AND A.check_cat_id = N.check_cat_id )
  107. WHERE A.deleted_flag = 0
  108. <if test="ocId != null">
  109. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  110. </if>
  111. <if test="taskId != null">
  112. AND A.task_id = #{taskId ,jdbcType=BIGINT}
  113. </if>
  114. ORDER BY A.task_id DESC
  115. </select>
  116. <!--列表:任务信息-->
  117. <select id="getByList" resultMap="CheckTaskDtoMap" parameterType="java.util.Map">
  118. SELECT
  119. <include refid="CheckTaskDto_Cols"/>
  120. FROM check_task AS A
  121. LEFT JOIN task AS B ON (A.oc_id = B.oc_id AND A.task_id = B.task_id )
  122. LEFT JOIN task_cat AS C ON (B.oc_id = C.oc_id AND B.task_cat_id = C.task_cat_id )
  123. LEFT JOIN s_group AS D ON (B.oc_id = D.oc_id AND B.launch_group_id = D.group_id )
  124. LEFT JOIN s_position AS E ON (B.oc_id = E.oc_id AND B.launch_position_id = E.position_id )
  125. LEFT JOIN account AS F ON (B.oc_id = F.oc_id AND B.launch_account_id = F.account_id )
  126. LEFT JOIN ent_risk_point AS G ON (A.oc_id = G.oc_id AND A.risk_point_id = G.risk_point_id )
  127. LEFT JOIN checklist AS H ON (A.oc_id = H.oc_id AND A.checklist_id = H.checklist_id )
  128. LEFT JOIN checklist_cat AS M ON (H.oc_id = M.oc_id AND H.checklist_cat_id = M.checklist_cat_id )
  129. LEFT JOIN check_cat AS N ON (A.oc_id = N.oc_id AND A.check_cat_id = N.check_cat_id )
  130. WHERE A.deleted_flag = 0
  131. <if test="ocId != null">
  132. AND A.oc_id = #{ocId, jdbcType=BIGINT}
  133. </if>
  134. <if test="taskId != null">
  135. AND A.task_id = #{taskId ,jdbcType=BIGINT}
  136. </if>
  137. <if test="checklistId != null">
  138. AND A.checklist_id = #{checklistId, jdbcType=BIGINT}
  139. </if>
  140. <if test="keywords != null and keywords != ''">
  141. AND ( H.checklist_title like "%"#{keywords}"%"
  142. OR B.task_title like "%"#{keywords}"%" )
  143. </if>
  144. <if test="status != null">
  145. AND B.status = #{status ,jdbcType=BIGINT}
  146. </if>
  147. <if test="checkStatus != null">
  148. AND A.check_status = #{checkStatus ,jdbcType=BIGINT}
  149. </if>
  150. <if test="riskPointId != null">
  151. AND A.risk_point_id = #{riskPointId ,jdbcType=BIGINT}
  152. </if>
  153. <if test="launchAccountId != null">
  154. AND B.launch_account_id = #{launchAccountId,jdbcType=BIGINT}
  155. </if>
  156. <if test="launchPositionId != null">
  157. AND B.launch_position_id = #{launchPositionId,jdbcType=BIGINT}
  158. </if>
  159. <if test="launchGroupId != null">
  160. AND B.launch_group_id = #{launchGroupId,jdbcType=BIGINT}
  161. </if>
  162. <if test="handleAccountId != null">
  163. AND B.handle_account_id = #{handleAccountId,jdbcType=BIGINT}
  164. </if>
  165. <if test="handlePositionId != null">
  166. AND B.handle_position_id = #{handlePositionId,jdbcType=BIGINT}
  167. </if>
  168. <if test="handleGroupId != null">
  169. AND B.handle_group_id = #{handleGroupId,jdbcType=BIGINT}
  170. </if>
  171. <if test="isExceed != null and isExceed == 1">
  172. <![CDATA[
  173. AND B.expected_end_time < now()
  174. AND (B.status = 1 OR B.status = 0)
  175. ]]>
  176. </if>
  177. <if test="startLaunchTime != null">
  178. <![CDATA[
  179. AND B.launch_time >= #{startLaunchTime ,jdbcType=TIMESTAMP}
  180. ]]>
  181. </if>
  182. <if test="endLaunchTime != null">
  183. <![CDATA[
  184. AND B.launch_time <= #{endLaunchTime, jdbcType=TIMESTAMP}
  185. ]]>
  186. </if>
  187. ORDER BY A.task_id DESC
  188. </select>
  189. <!--分页:任务信息-->
  190. <select id="getByPage" resultMap="CheckTaskDtoMap" parameterType="java.util.Map">
  191. SELECT
  192. <include refid="CheckTaskDto_Cols"/>
  193. FROM check_task AS A
  194. LEFT JOIN task AS B ON (A.oc_id = B.oc_id AND A.task_id = B.task_id )
  195. LEFT JOIN task_cat AS C ON (B.oc_id = C.oc_id AND B.task_cat_id = C.task_cat_id )
  196. LEFT JOIN s_group AS D ON (B.oc_id = D.oc_id AND B.launch_group_id = D.group_id )
  197. LEFT JOIN s_position AS E ON (B.oc_id = E.oc_id AND B.launch_position_id = E.position_id )
  198. LEFT JOIN account AS F ON (B.oc_id = F.oc_id AND B.launch_account_id = F.account_id )
  199. LEFT JOIN ent_risk_point AS G ON (A.oc_id = G.oc_id AND A.risk_point_id = G.risk_point_id )
  200. LEFT JOIN checklist AS H ON (A.oc_id = H.oc_id AND A.checklist_id = H.checklist_id )
  201. LEFT JOIN checklist_cat AS M ON (H.oc_id = M.oc_id AND H.checklist_cat_id = M.checklist_cat_id )
  202. LEFT JOIN check_cat AS N ON (A.oc_id = N.oc_id AND A.check_cat_id = N.check_cat_id )
  203. WHERE A.deleted_flag = 0
  204. <if test="ocId != null">
  205. AND A.oc_id = #{ocId, jdbcType=BIGINT}
  206. </if>
  207. <if test="taskId != null">
  208. AND A.task_id = #{taskId ,jdbcType=BIGINT}
  209. </if>
  210. <if test="checklistId != null">
  211. AND A.checklist_id = #{checklistId, jdbcType=BIGINT}
  212. </if>
  213. <if test="keywords != null and keywords != ''">
  214. AND ( H.checklist_title like "%"#{keywords}"%"
  215. OR B.task_title like "%"#{keywords}"%" )
  216. </if>
  217. <if test="status != null">
  218. AND B.status = #{status, jdbcType=BIGINT}
  219. </if>
  220. <if test="checkStatus != null">
  221. AND A.check_status = #{checkStatus, jdbcType=BIGINT}
  222. </if>
  223. <if test="launchAccountId != null">
  224. AND B.launch_account_id = #{launchAccountId, jdbcType=BIGINT}
  225. </if>
  226. <if test="launchPositionId != null">
  227. AND B.launch_position_id = #{launchPositionId, jdbcType=BIGINT}
  228. </if>
  229. <if test="launchGroupId != null">
  230. AND B.launch_group_id = #{launchGroupId, jdbcType=BIGINT}
  231. </if>
  232. <if test="handleAccountId != null">
  233. AND B.handle_account_id = #{handleAccountId, jdbcType=BIGINT}
  234. </if>
  235. <if test="handlePositionId != null">
  236. AND B.handle_position_id = #{handlePositionId, jdbcType=BIGINT}
  237. </if>
  238. <if test="handleGroupId != null">
  239. AND B.handle_group_id = #{handleGroupId, jdbcType=BIGINT}
  240. </if>
  241. <if test="riskPointId != null">
  242. AND A.risk_point_id = #{riskPointId, jdbcType=BIGINT}
  243. </if>
  244. <if test="startLaunchTime != null">
  245. <![CDATA[
  246. AND B.launch_time >= #{startLaunchTime, jdbcType=TIMESTAMP}
  247. ]]>
  248. </if>
  249. <if test="endLaunchTime != null">
  250. <![CDATA[
  251. AND B.launch_time <= #{endLaunchTime, jdbcType=TIMESTAMP}
  252. ]]>
  253. </if>
  254. ORDER BY A.task_id DESC
  255. </select>
  256. <!--getCheckTaskExceedList-->
  257. <select id="getCheckTaskExceedList" resultType="com.zhyc.xps.aqpt.dto.CheckTaskDetailDto">
  258. SELECT ct.task_id,
  259. ct.risk_point_id,
  260. t.task_title,
  261. t.oc_id,
  262. t.handle_account_id,
  263. t.handle_position_id,
  264. t.handle_group_id,
  265. t.expected_end_time
  266. FROM check_task ct
  267. LEFT JOIN task t ON (t.task_id = ct.task_id AND t.oc_id = ct.oc_id)
  268. WHERE ct.deleted_flag = 0
  269. AND t.deleted_flag = 0
  270. <![CDATA[
  271. AND t.expected_end_time <= now()
  272. ]]>
  273. AND t.STATUS = 1
  274. </select>
  275. <!--Create-->
  276. <insert id="create" parameterType="com.zhyc.xps.aqpt.entity.CheckTask">
  277. INSERT INTO check_task
  278. <trim prefix="(" suffix=")" suffixOverrides=",">
  279. <if test="ocId != null">
  280. oc_id,
  281. </if>
  282. <if test="taskId != null">
  283. task_id,
  284. </if>
  285. <if test="riskPointId != null">
  286. risk_point_id,
  287. </if>
  288. <if test="checkDefId != null">
  289. check_def_id,
  290. </if>
  291. <if test="checkCatId != null">
  292. check_cat_id,
  293. </if>
  294. <if test="checkTypeId != null">
  295. check_type_id,
  296. </if>
  297. <if test="checkTitle != null and checkTitle!=''">
  298. check_title,
  299. </if>
  300. <if test="checkDesc != null and checkDesc != ''">
  301. check_desc,
  302. </if>
  303. <if test="checklistId != null">
  304. checklist_id,
  305. </if>
  306. <if test="checkCount != null">
  307. check_count,
  308. </if>
  309. <if test="checkStatus != null">
  310. check_status,
  311. </if>
  312. <if test="createdBy != null">
  313. created_by,
  314. </if>
  315. <if test="createdAt != null">
  316. created_at,
  317. </if>
  318. </trim>
  319. <trim prefix="values (" suffix=")" suffixOverrides=",">
  320. <if test="ocId != null">
  321. #{ocId ,jdbcType=BIGINT},
  322. </if>
  323. <if test="taskId != null">
  324. #{taskId ,jdbcType=BIGINT},
  325. </if>
  326. <if test="riskPointId != null">
  327. #{riskPointId ,jdbcType=BIGINT},
  328. </if>
  329. <if test="checkDefId != null">
  330. #{checkDefId ,jdbcType=BIGINT},
  331. </if>
  332. <if test="checkCatId != null">
  333. #{checkCatId ,jdbcType=BIGINT},
  334. </if>
  335. <if test="checkTypeId != null">
  336. #{checkTypeId ,jdbcType=BIGINT},
  337. </if>
  338. <if test="checkTitle != null and checkTitle!=''">
  339. #{checkTitle ,jdbcType=VARCHAR},
  340. </if>
  341. <if test="checkDesc != null and checkDesc != ''">
  342. #{checkDesc ,jdbcType=VARCHAR},
  343. </if>
  344. <if test="checklistId != null">
  345. #{checklistId ,jdbcType=BIGINT},
  346. </if>
  347. <if test="checkCount != null">
  348. #{checkCount ,jdbcType=BIGINT},
  349. </if>
  350. <if test="checkStatus != null">
  351. #{checkStatus ,jdbcType=BIGINT},
  352. </if>
  353. <if test="createdBy != null">
  354. #{createdBy ,jdbcType=BIGINT},
  355. </if>
  356. <if test="createdAt != null">
  357. #{createdAt ,jdbcType=TIMESTAMP},
  358. </if>
  359. </trim>
  360. </insert>
  361. <!--更新-->
  362. <update id="update" parameterType="com.zhyc.xps.aqpt.entity.CheckTask">
  363. UPDATE check_task
  364. <trim suffixOverrides=",">
  365. <set>
  366. <if test="checkTitle != null and checkTitle!=''">
  367. check_title = #{checkTitle ,jdbcType=VARCHAR},
  368. </if>
  369. <if test="checkDesc != null and checkDesc != ''">
  370. check_desc = #{checkDesc ,jdbcType=VARCHAR},
  371. </if>
  372. <if test="checklistId != null">
  373. checklist_id = #{checklistId ,jdbcType=BIGINT},
  374. </if>
  375. <if test="checkCatId != null">
  376. check_cat_id = #{checkCatId ,jdbcType=BIGINT},
  377. </if>
  378. <if test="checkTypeId != null">
  379. check_type_id = #{checkTypeId ,jdbcType=BIGINT},
  380. </if>
  381. <if test="checkCount != null">
  382. check_count = #{checkCount ,jdbcType=INTEGER},
  383. </if>
  384. <if test="checkStatus != null">
  385. check_status = #{checkStatus ,jdbcType=BIGINT},
  386. </if>
  387. <if test="updatedBy != null">
  388. updated_by = #{updatedBy ,jdbcType=BIGINT},
  389. </if>
  390. <if test="updatedAt != null">
  391. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  392. </if>
  393. </set>
  394. </trim>
  395. WHERE 1 = 1
  396. <if test="ocId != null">
  397. AND oc_id = #{ocId ,jdbcType=BIGINT}
  398. </if>
  399. <if test="taskId != null">
  400. AND task_id = #{taskId ,jdbcType=BIGINT}
  401. </if>
  402. </update>
  403. <!--删除 -->
  404. <delete id="delete" parameterType="java.util.Map">
  405. DELETE FROM check_task
  406. WHERE 1 = 1
  407. <if test="ocId != null">
  408. AND oc_id = #{ocId,jdbcType=BIGINT}
  409. </if>
  410. <if test="taskId != null ">
  411. AND task_id = #{taskId ,jdbcType=BIGINT}
  412. </if>
  413. <if test="checkDefId != null ">
  414. AND check_def_id = #{checkDefId ,jdbcType=BIGINT}
  415. </if>
  416. </delete>
  417. </mapper>