TaskMapper.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  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.zhyc.xps.sys.mapper.TaskMapper">
  4. <resultMap id="TaskDtoResultMap" type="com.zhyc.xps.sys.dto.TaskDto">
  5. <result column="oc_id" property="ocId" jdbcType="BIGINT" />
  6. <result column="task_id" property="taskId" jdbcType="BIGINT" />
  7. <result column="task_title" property="taskTitle" jdbcType="VARCHAR" />
  8. <result column="task_desc" property="taskDesc" jdbcType="VARCHAR" />
  9. <result column="task_cat_id" property="taskCatId" jdbcType="BIGINT" />
  10. <result column="task_cat_title" property="taskCatTitle" jdbcType="VARCHAR" />
  11. <result column="task_type_id" property="taskTypeId" jdbcType="BIGINT" />
  12. <result column="expected_start_time" property="expectedStartTime" jdbcType="DATE" />
  13. <result column="expected_end_time" property="expectedEndTime" jdbcType="DATE" />
  14. <result column="actual_start_time" property="actualStartTime" jdbcType="DATE" />
  15. <result column="actual_end_time" property="actualEndTime" jdbcType="DATE" />
  16. <result column="task_priority" property="taskPriority" jdbcType="BIGINT" />
  17. <result column="status" property="status" jdbcType="BIGINT" />
  18. <result column="launch_group_id" property="launchGroupId" jdbcType="BIGINT" />
  19. <result column="launch_position_id" property="launchPositionId" jdbcType="BIGINT" />
  20. <result column="launch_account_id" property="launchAccountId" jdbcType="BIGINT" />
  21. <result column="launch_group_name" property="launchGroupName" jdbcType="VARCHAR" />
  22. <result column="launch_position_name" property="launchPositionName" jdbcType="VARCHAR" />
  23. <result column="launch_account_name" property="launchAccountName" jdbcType="VARCHAR" />
  24. <result column="launch_time" property="launchTime" jdbcType="DATE" />
  25. <result column="parent_id" property="parentId" jdbcType="BIGINT" />
  26. <result column="root_id" property="rootId" jdbcType="BIGINT" />
  27. <result column="task_origin" property="taskOrigin" jdbcType="BIGINT" />
  28. <result column="handle_group_id" property="handleGroupId" jdbcType="BIGINT" />
  29. <result column="handle_position_id" property="handlePositionId" jdbcType="BIGINT" />
  30. <result column="handle_account_id" property="handleAccountId" jdbcType="BIGINT" />
  31. <result column="handle_group_name" property="handleGroupName" jdbcType="VARCHAR" />
  32. <result column="handle_position_name" property="handlePositionName" jdbcType="VARCHAR" />
  33. <result column="handle_account_name" property="handleAccountName" jdbcType="VARCHAR" />
  34. <result column="handle_time" property="handleTime" jdbcType="DATE" />
  35. <result column="wf_def_id" property="wfDefId" jdbcType="BIGINT" />
  36. <result column="wf_ins_id" property="wfInsId" jdbcType="BIGINT" />
  37. <result column="cur_activity_ins_id" property="curActivityInsId" jdbcType="BIGINT" />
  38. <result column="cur_activity_code" property="curActivityCode" jdbcType="VARCHAR" />
  39. <result column="cur_activity_title" property="curActivityTitle" jdbcType="VARCHAR" />
  40. <result column="cur_activity_begin_time" property="curActivityBeginTime" jdbcType="TIMESTAMP"/>
  41. <result column="cur_form_code" property="curFormCode" jdbcType="VARCHAR" />
  42. <result column="cur_group_id" property="curGroupId" jdbcType="BIGINT" />
  43. <result column="cur_position_id" property="curPositionId" jdbcType="BIGINT" />
  44. <result column="cur_account_id" property="curAccountId" jdbcType="BIGINT" />
  45. <result column="cur_group_name" property="curGroupName" jdbcType="VARCHAR" />
  46. <result column="cur_position_name" property="curPositionName" jdbcType="VARCHAR" />
  47. <result column="cur_account_name" property="curAccountName" jdbcType="VARCHAR" />
  48. </resultMap>
  49. <sql id="TaskDto_Cols">
  50. A.oc_id,
  51. A.task_id,
  52. A.task_title,
  53. A.task_desc,
  54. A.task_cat_id,
  55. B.task_cat_title,
  56. A.task_type_id,
  57. A.expected_start_time,
  58. A.expected_end_time,
  59. A.actual_start_time,
  60. A.actual_end_time,
  61. A.task_priority,
  62. A.parent_id,
  63. A.root_id,
  64. A.status,
  65. A.task_origin,
  66. A.launch_group_id,
  67. A.launch_group_name,
  68. A.launch_position_id,
  69. A.launch_position_name,
  70. A.launch_account_id,
  71. A.launch_account_name,
  72. A.launch_time,
  73. A.handle_group_id,
  74. A.handle_group_name,
  75. A.handle_position_id,
  76. A.handle_position_name,
  77. A.handle_account_id,
  78. A.handle_account_name,
  79. A.handle_time,
  80. W.wf_def_id,
  81. W.wf_ins_id,
  82. W.cur_activity_title,
  83. W.cur_activity_code,
  84. W.cur_form_code,
  85. W.cur_activity_ins_id,
  86. W.cur_activity_begin_time,
  87. W.cur_group_id,
  88. W.cur_group_name,
  89. W.cur_position_id,
  90. W.cur_position_name,
  91. W.cur_account_id,
  92. W.cur_account_name
  93. </sql>
  94. <!--基于ID查询-->
  95. <select id="getById" resultMap="TaskDtoResultMap">
  96. SELECT
  97. <include refid="TaskDto_Cols"/>
  98. FROM task AS A
  99. LEFT JOIN task_cat AS B ON (A.task_cat_id = B.task_cat_id )
  100. LEFT JOIN wf_ins AS W ON (A.oc_id = W.oc_id AND A.task_id = W.wf_ins_id )
  101. WHERE A.deleted_flag = 0
  102. AND A.oc_id = #{ocId, jdbcType=BIGINT}
  103. AND A.task_id = #{taskId, jdbcType=BIGINT}
  104. </select>
  105. <!--分页查询-->
  106. <select id="getByPage" parameterType="java.util.Map" resultMap="TaskDtoResultMap">
  107. SELECT
  108. <include refid="TaskDto_Cols"/>
  109. FROM task AS A
  110. LEFT JOIN task_cat AS B ON (A.task_cat_id = B.task_cat_id )
  111. LEFT JOIN s_group AS C ON (A.oc_id = C.oc_id AND A.handle_group_id = C.group_id )
  112. LEFT JOIN wf_ins AS W ON (A.oc_id = W.oc_id AND A.task_id = W.wf_ins_id )
  113. WHERE A.deleted_flag = 0
  114. <if test="ocId != null">
  115. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  116. </if>
  117. <if test="taskId != null">
  118. AND A.task_id = #{taskId ,jdbcType=BIGINT}
  119. </if>
  120. <if test="taskTypeId != null">
  121. AND A.task_type_id = #{taskTypeId ,jdbcType=BIGINT}
  122. </if>
  123. <if test="taskCatId != null">
  124. AND A.task_cat_id = #{taskCatId ,jdbcType=BIGINT}
  125. </if>
  126. <if test="keywords != null and keywords != ''">
  127. AND A.task_title like "%"#{keywords}"%"
  128. </if>
  129. <if test="launchAccountId != null">
  130. AND A.launch_account_id = #{launchAccountId,jdbcType=BIGINT}
  131. </if>
  132. <if test="launchPositionId != null">
  133. AND A.launch_position_id = #{launchPositionId,jdbcType=BIGINT}
  134. </if>
  135. <if test="launchGroupId != null">
  136. AND A.launch_group_id = #{launchGroupId,jdbcType=BIGINT}
  137. </if>
  138. <if test="handleAccountId != null">
  139. AND A.handle_account_id = #{handleAccountId,jdbcType=BIGINT}
  140. </if>
  141. <if test="handlePositionId != null">
  142. AND A.handle_position_id = #{handlePositionId,jdbcType=BIGINT}
  143. </if>
  144. <if test="handleGroupId != null">
  145. AND A.handle_group_id = #{handleGroupId,jdbcType=BIGINT}
  146. </if>
  147. <if test="handleGroupNodeLeft != null and handleGroupNodeRight != null">
  148. <![CDATA[
  149. AND C.node_left >= #{handleGroupNodeLeft, jdbcType=BIGINT}
  150. AND C.node_right <= #{handleGroupNodeRight, jdbcType=BIGINT}
  151. ]]>
  152. </if>
  153. <if test="curAccountId != null">
  154. AND W.cur_account_id = #{curAccountId, jdbcType=BIGINT}
  155. </if>
  156. <if test="status != null">
  157. AND A.status = #{status ,jdbcType=BIGINT}
  158. </if>
  159. ORDER BY A.task_id ASC
  160. </select>
  161. <!--列表查询-->
  162. <select id="getByList" parameterType="java.util.Map" resultMap="TaskDtoResultMap">
  163. SELECT
  164. <include refid="TaskDto_Cols"/>
  165. FROM task AS A
  166. LEFT JOIN task_cat AS B ON (A.task_cat_id = B.task_cat_id )
  167. LEFT JOIN wf_ins AS W ON (A.oc_id = W.oc_id AND A.task_id = W.wf_ins_id)
  168. WHERE A.deleted_flag = 0
  169. <if test="ocId != null">
  170. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  171. </if>
  172. <if test="taskTypeId != null">
  173. AND A.task_type_id = #{taskTypeId ,jdbcType=BIGINT}
  174. </if>
  175. <if test="taskCatId != null">
  176. AND A.task_cat_id = #{taskCatId ,jdbcType=BIGINT}
  177. </if>
  178. <if test="keywords != null and keywords != ''">
  179. AND A.task_title like "%"#{keywords}"%"
  180. </if>
  181. <if test="launchAccountId != null">
  182. AND A.launch_account_id = #{launchAccountId,jdbcType=BIGINT}
  183. </if>
  184. <if test="launchPositionId != null">
  185. AND A.launch_position_id = #{launchPositionId,jdbcType=BIGINT}
  186. </if>
  187. <if test="launchGroupId != null">
  188. AND A.launch_group_id = #{launchGroupId,jdbcType=BIGINT}
  189. </if>
  190. <if test="handleAccountId != null">
  191. AND A.handle_account_id = #{handleAccountId,jdbcType=BIGINT}
  192. </if>
  193. <if test="handlePositionId != null">
  194. AND A.handle_position_id = #{handlePositionId,jdbcType=BIGINT}
  195. </if>
  196. <if test="handleGroupId != null">
  197. AND A.handle_group_id = #{handleGroupId,jdbcType=BIGINT}
  198. </if>
  199. <if test="handleGroupNodeLeft != null and handleGroupNodeRight != null">
  200. <![CDATA[
  201. AND C.node_left >= #{handleGroupNodeLeft, jdbcType=BIGINT}
  202. AND C.node_right <= #{handleGroupNodeRight, jdbcType=BIGINT}
  203. ]]>
  204. </if>
  205. <if test="status != null">
  206. AND A.status = #{status ,jdbcType=BIGINT}
  207. </if>
  208. ORDER BY A.expected_end_time DESC
  209. <if test="limit!=null">
  210. LIMIT 0, #{limit, jdbcType=BIGINT}
  211. </if>
  212. </select>
  213. <insert id="create" parameterType="com.zhyc.xps.sys.entity.Task">
  214. INSERT INTO task
  215. <trim prefix="(" suffix=")" suffixOverrides=",">
  216. <if test="ocId != null">
  217. oc_id ,
  218. </if>
  219. <if test="taskId != null">
  220. task_id,
  221. </if>
  222. <if test="taskCode != null and taskCode != ''">
  223. task_code,
  224. </if>
  225. <if test="taskTitle != null and taskTitle != ''">
  226. task_title,
  227. </if>
  228. <if test="taskDesc != null and taskDesc != ''">
  229. task_desc,
  230. </if>
  231. <if test="taskCatId != null">
  232. task_cat_id,
  233. </if>
  234. <if test="taskTypeId != null">
  235. task_type_id,
  236. </if>
  237. <if test="expectedStartTime != null">
  238. expected_start_time,
  239. </if>
  240. <if test="expectedEndTime != null">
  241. expected_end_time,
  242. </if>
  243. <if test="actualStartTime != null">
  244. actual_start_time,
  245. </if>
  246. <if test="actualEndTime != null">
  247. actual_end_time,
  248. </if>
  249. <if test="taskPriority!= null">
  250. task_priority,
  251. </if>
  252. <if test="parentId != null">
  253. parent_id,
  254. </if>
  255. <if test="rootId != null">
  256. root_id,
  257. </if>
  258. <if test="taskOrigin != null">
  259. task_origin,
  260. </if>
  261. <if test="launchGroupId != null">
  262. launch_group_id,
  263. </if>
  264. <if test="launchPositionId != null">
  265. launch_position_id,
  266. </if>
  267. <if test="launchAccountId != null">
  268. launch_account_id,
  269. </if>
  270. <if test="launchGroupName != null and launchGroupName != ''">
  271. launch_group_name,
  272. </if>
  273. <if test="launchPositionName != null and launchPositionName != ''">
  274. launch_position_name,
  275. </if>
  276. <if test="launchAccountName != null and launchAccountName != ''">
  277. launch_account_name,
  278. </if>
  279. <if test="launchTime != null">
  280. launch_time,
  281. </if>
  282. <if test="handleGroupId != null">
  283. handle_group_id,
  284. </if>
  285. <if test="handlePositionId != null">
  286. handle_position_id,
  287. </if>
  288. <if test="handleAccountId != null">
  289. handle_account_id,
  290. </if>
  291. <if test="handleGroupName != null and handleGroupName != ''">
  292. handle_group_name,
  293. </if>
  294. <if test="handlePositionName != null and handlePositionName != ''">
  295. handle_position_name,
  296. </if>
  297. <if test="handleAccountName != null and handleAccountName != ''">
  298. handle_account_name,
  299. </if>
  300. <if test="handleTime != null">
  301. handle_time,
  302. </if>
  303. <if test="status != null">
  304. status,
  305. </if>
  306. <if test="createdBy != null">
  307. created_by,
  308. </if>
  309. <if test="createdAt != null">
  310. created_at,
  311. </if>
  312. </trim>
  313. <trim prefix="values (" suffix=")" suffixOverrides=",">
  314. <if test="ocId != null">
  315. #{ocId ,jdbcType=BIGINT},
  316. </if>
  317. <if test="taskId != null">
  318. #{taskId ,jdbcType=BIGINT},
  319. </if>
  320. <if test="taskCode != null and taskCode != ''">
  321. #{taskCode ,jdbcType=VARCHAR},
  322. </if>
  323. <if test="taskTitle != null and taskTitle != ''">
  324. #{taskTitle ,jdbcType=VARCHAR},
  325. </if>
  326. <if test="taskDesc != null and taskDesc != ''">
  327. #{taskDesc ,jdbcType=VARCHAR},
  328. </if>
  329. <if test="taskCatId != null">
  330. #{taskCatId ,jdbcType=BIGINT},
  331. </if>
  332. <if test="taskTypeId != null">
  333. #{taskTypeId ,jdbcType=BIGINT},
  334. </if>
  335. <if test="expectedStartTime != null">
  336. #{expectedStartTime ,jdbcType=DATE},
  337. </if>
  338. <if test="expectedEndTime != null">
  339. #{expectedEndTime ,jdbcType=DATE},
  340. </if>
  341. <if test="actualStartTime != null">
  342. #{actualStartTime ,jdbcType=DATE},
  343. </if>
  344. <if test="actualEndTime != null">
  345. #{actualEndTime ,jdbcType=DATE},
  346. </if>
  347. <if test="taskPriority!= null">
  348. #{taskPriority ,jdbcType=BIGINT},
  349. </if>
  350. <if test="parentId != null">
  351. #{parentId ,jdbcType=BIGINT},
  352. </if>
  353. <if test="rootId != null">
  354. #{rootId ,jdbcType=BIGINT},
  355. </if>
  356. <if test="taskOrigin != null">
  357. #{taskOrigin ,jdbcType=BIGINT},
  358. </if>
  359. <if test="launchGroupId != null">
  360. #{launchGroupId ,jdbcType=BIGINT},
  361. </if>
  362. <if test="launchPositionId != null">
  363. #{launchPositionId ,jdbcType=BIGINT},
  364. </if>
  365. <if test="launchAccountId != null">
  366. #{launchAccountId ,jdbcType=BIGINT},
  367. </if>
  368. <if test="launchGroupName != null and launchGroupName != ''">
  369. #{launchGroupName ,jdbcType=VARCHAR},
  370. </if>
  371. <if test="launchPositionName != null and launchPositionName != ''">
  372. #{launchPositionName ,jdbcType=VARCHAR},
  373. </if>
  374. <if test="launchAccountName != null and launchAccountName != ''">
  375. #{launchAccountName ,jdbcType=VARCHAR},
  376. </if>
  377. <if test="launchTime != null">
  378. #{launchTime ,jdbcType=DATE},
  379. </if>
  380. <if test="handleGroupId != null">
  381. #{handleGroupId ,jdbcType=BIGINT},
  382. </if>
  383. <if test="handlePositionId != null">
  384. #{handlePositionId ,jdbcType=BIGINT},
  385. </if>
  386. <if test="handleAccountId != null">
  387. #{handleAccountId ,jdbcType=BIGINT},
  388. </if>
  389. <if test="handleGroupName != null and handleGroupName != ''">
  390. #{handleGroupName ,jdbcType=VARCHAR},
  391. </if>
  392. <if test="handlePositionName != null and handlePositionName != ''">
  393. #{handlePositionName ,jdbcType=VARCHAR},
  394. </if>
  395. <if test="handleAccountName != null and handleAccountName != ''">
  396. #{handleAccountName ,jdbcType=VARCHAR},
  397. </if>
  398. <if test="handleTime != null">
  399. #{handleTime ,jdbcType=DATE},
  400. </if>
  401. <if test="status != null">
  402. #{status ,jdbcType=BIGINT},
  403. </if>
  404. <if test="createdBy != null">
  405. #{createdBy ,jdbcType=BIGINT},
  406. </if>
  407. <if test="createdAt != null">
  408. #{createdAt ,jdbcType=DATE},
  409. </if>
  410. </trim>
  411. </insert>
  412. <!--更新-->
  413. <update id="update" parameterType="com.zhyc.xps.sys.entity.Task">
  414. UPDATE task
  415. <trim suffixOverrides=",">
  416. <set>
  417. <if test="taskCode != null and taskCode != ''">
  418. task_code = #{taskCode ,jdbcType=VARCHAR},
  419. </if>
  420. <if test="taskTitle != null and taskTitle != ''">
  421. task_title = #{taskTitle, jdbcType=VARCHAR},
  422. </if>
  423. <if test="taskDesc != null and taskDesc != ''">
  424. task_desc = #{taskDesc, jdbcType=VARCHAR},
  425. </if>
  426. <if test="taskCatId != null">
  427. task_cat_id = #{taskCatId ,jdbcType=BIGINT},
  428. </if>
  429. <if test="taskTypeId != null">
  430. task_type_id = #{taskTypeId ,jdbcType=BIGINT},
  431. </if>
  432. <if test="expectedStartTime != null">
  433. expected_start_time = #{expectedStartTime ,jdbcType=DATE},
  434. </if>
  435. <if test="expectedEndTime != null">
  436. expected_end_time = #{expectedEndTime ,jdbcType=DATE},
  437. </if>
  438. <if test="actualStartTime != null">
  439. actual_start_time = #{actualStartTime ,jdbcType=DATE},
  440. </if>
  441. <if test="actualEndTime != null">
  442. actual_end_time = #{actualEndTime ,jdbcType=DATE},
  443. </if>
  444. <if test="taskPriority!= null">
  445. task_priority = #{taskPriority ,jdbcType=BIGINT},
  446. </if>
  447. <if test="parentId != null">
  448. parent_id = #{parentId ,jdbcType=BIGINT},
  449. </if>
  450. <if test="rootId != null">
  451. root_id = #{rootId ,jdbcType=BIGINT},
  452. </if>
  453. <if test="taskOrigin != null">
  454. task_origin = #{taskOrigin ,jdbcType=BIGINT},
  455. </if>
  456. <if test="handleGroupId != null">
  457. handle_group_id = #{handleGroupId ,jdbcType=BIGINT},
  458. </if>
  459. <if test="handlePositionId != null">
  460. handle_position_id = #{handlePositionId ,jdbcType=BIGINT},
  461. </if>
  462. <if test="handleAccountId != null">
  463. handle_account_id = #{handleAccountId ,jdbcType=BIGINT},
  464. </if>
  465. <if test="handleGroupName != null and handleGroupName != ''">
  466. handle_group_name = #{handleGroupName ,jdbcType=VARCHAR},
  467. </if>
  468. <if test="handlePositionName != null and handlePositionName != ''">
  469. handle_position_name = #{handlePositionName ,jdbcType=VARCHAR},
  470. </if>
  471. <if test="handleAccountName != null and handleAccountName != ''">
  472. handle_account_name = #{handleAccountName ,jdbcType=VARCHAR},
  473. </if>
  474. <if test="handleTime != null">
  475. handle_time = #{handleTime ,jdbcType=DATE},
  476. </if>
  477. <if test="status != null">
  478. status = #{status ,jdbcType=BIGINT},
  479. </if>
  480. <if test="updatedBy != null ">
  481. updated_by = #{updatedBy ,jdbcType=BIGINT},
  482. </if>
  483. <if test="updatedAt != null">
  484. updated_at = #{updatedAt ,jdbcType=DATE},
  485. </if>
  486. </set>
  487. </trim>
  488. WHERE oc_id = #{ocId, jdbcType=BIGINT}
  489. AND task_id = #{taskId, jdbcType=BIGINT}
  490. </update>
  491. <!--删除-->
  492. <update id="delete" parameterType="java.util.Map">
  493. UPDATE task
  494. <trim suffixOverrides=",">
  495. <set>
  496. <if test="deletedFlag != null">
  497. deleted_flag = #{deletedFlag,jdbcType=BIGINT},
  498. </if>
  499. <if test="deletedTime != null">
  500. deleted_time = #{deletedTime,jdbcType=DATE},
  501. </if>
  502. <if test="deletedBy != null">
  503. deleted_by = #{deletedBy,jdbcType=BIGINT},
  504. </if>
  505. </set>
  506. </trim>
  507. WHERE oc_id = #{ocId ,jdbcType=BIGINT}
  508. <if test="rootId != null">
  509. AND root_id = #{rootId ,jdbcType=BIGINT}
  510. </if>
  511. <if test="parentId != null">
  512. AND parent_id = #{parentId ,jdbcType=BIGINT}
  513. </if>
  514. <if test="taskCatId != null">
  515. AND task_cat_id = #{taskCatId ,jdbcType=BIGINT}
  516. </if>
  517. <if test="taskId != null">
  518. AND task_id = #{taskId ,jdbcType=BIGINT}
  519. </if>
  520. </update>
  521. </mapper>