TodoMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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.TodoMapper">
  4. <resultMap id="TodoDtoResultMap" type="com.zhyc.xps.sys.dto.TodoDto">
  5. <result column="oc_id" property="ocId" jdbcType="BIGINT" /><!--单位ID-->
  6. <result column="todo_id" property="todoId" jdbcType="BIGINT" /><!---->
  7. <result column="todo_title" property="todoTitle" jdbcType="VARCHAR" />
  8. <result column="todo_desc" property="todoDesc" jdbcType="VARCHAR" />
  9. <result column="status" property="status" jdbcType="BIGINT" />
  10. <result column="handle_remark" property="handleRemark" jdbcType="VARCHAR" />
  11. <result column="task_id" property="taskId" jdbcType="BIGINT" />
  12. <result column="task_title" property="taskTitle" jdbcType="VARCHAR" />
  13. <result column="task_desc" property="taskDesc" jdbcType="VARCHAR" />
  14. <result column="task_cat_id" property="taskCatId" jdbcType="BIGINT" />
  15. <result column="task_cat_title" property="taskCatTitle" jdbcType="VARCHAR" />
  16. <result column="task_type_id" property="taskTypeId" jdbcType="BIGINT" />
  17. <result column="expected_start_time" property="expectedStartTime" jdbcType="DATE" />
  18. <result column="expected_end_time" property="expectedEndTime" jdbcType="DATE" />
  19. <result column="actual_start_time" property="actualStartTime" jdbcType="DATE" />
  20. <result column="actual_end_time" property="actualEndTime" jdbcType="DATE" />
  21. <result column="task_priority" property="taskPriority" 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="DATE" />
  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="handle_time" property="handleTime" jdbcType="DATE" />
  36. <result column="parent_id" property="parentId" jdbcType="BIGINT" />
  37. <result column="root_id" property="rootId" jdbcType="BIGINT" />
  38. <result column="task_origin" property="taskOrigin" jdbcType="BIGINT" />
  39. <result column="wf_def_id" property="wfDefId" jdbcType="BIGINT" />
  40. <result column="wf_ins_id" property="wfInsId" jdbcType="BIGINT" />
  41. <result column="status" property="status" jdbcType="BIGINT" />
  42. <result column="cur_activity_ins_id" property="curActivityInsId" jdbcType="BIGINT" />
  43. <result column="cur_activity_code" property="curActivityCode" jdbcType="VARCHAR" />
  44. <result column="cur_activity_title" property="curActivityTitle" jdbcType="VARCHAR" />
  45. <result column="cur_activity_begin_time" property="curActivityBeginTime" jdbcType="TIMESTAMP"/>
  46. <result column="cur_form_code" property="curFormCode" jdbcType="VARCHAR" />
  47. <result column="cur_group_id" property="curGroupId" jdbcType="BIGINT" />
  48. <result column="cur_position_id" property="curPositionId" jdbcType="BIGINT" />
  49. <result column="cur_account_id" property="curAccountId" jdbcType="BIGINT" />
  50. <result column="cur_group_name" property="curGroupName" jdbcType="VARCHAR" />
  51. <result column="cur_position_name" property="curPositionName" jdbcType="VARCHAR" />
  52. <result column="cur_account_name" property="curAccountName" jdbcType="VARCHAR" />
  53. </resultMap>
  54. <sql id="TodoDto_Cols">
  55. A.oc_id,
  56. A.todo_id,
  57. A.todo_desc,
  58. A.todo_title,
  59. A.handle_remark,
  60. B.task_id,
  61. B.task_title,
  62. B.task_desc,
  63. B.task_cat_id,
  64. C.task_cat_title,
  65. B.task_type_id,
  66. B.expected_start_time,
  67. B.expected_end_time,
  68. B.actual_start_time,
  69. B.actual_end_time,
  70. B.task_priority,
  71. B.parent_id,
  72. B.root_id,
  73. B.task_origin,
  74. B.launch_group_id,
  75. B.launch_group_name,
  76. B.launch_position_id,
  77. B.launch_position_name,
  78. B.launch_account_id,
  79. B.launch_account_name,
  80. B.launch_time,
  81. B.handle_group_id,
  82. B.handle_group_name,
  83. B.handle_position_id,
  84. B.handle_position_name,
  85. B.handle_account_id,
  86. B.handle_account_name,
  87. B.handle_time,
  88. W.wf_def_id,
  89. W.wf_ins_id,
  90. W.status,
  91. W.cur_activity_title,
  92. W.cur_activity_code,
  93. W.cur_form_code,
  94. W.cur_activity_ins_id,
  95. W.cur_activity_begin_time,
  96. W.cur_group_id,
  97. W.cur_group_name,
  98. W.cur_position_id,
  99. W.cur_position_name,
  100. W.cur_account_id,
  101. W.cur_account_name
  102. </sql>
  103. <!--基于ID查询-->
  104. <select id="getById" resultMap="TodoDtoResultMap">
  105. SELECT
  106. <include refid="TodoDto_Cols"/>
  107. FROM todo AS A
  108. LEFT JOIN task AS B ON (A.oc_id = B.oc_id AND A.todo_id = B.task_id )
  109. LEFT JOIN task_cat AS C ON (B.oc_id = C.oc_id AND B.task_cat_id = C.task_cat_id )
  110. LEFT JOIN wf_ins AS W ON (A.oc_id = W.oc_id AND A.todo_id = W.wf_ins_id )
  111. WHERE A.oc_id = #{ocId ,jdbcType=BIGINT} AND A.todo_id = #{todoId ,jdbcType=BIGINT}
  112. </select>
  113. <!--列表查询-->
  114. <select id="getByList" parameterType="java.util.Map" resultMap="TodoDtoResultMap" >
  115. SELECT
  116. <include refid="TodoDto_Cols"/>
  117. FROM todo AS A
  118. LEFT JOIN task AS B ON (A.oc_id = B.oc_id AND A.todo_id = B.task_id )
  119. LEFT JOIN task_cat AS C ON (B.oc_id = C.oc_id AND B.task_cat_id = C.task_cat_id )
  120. LEFT JOIN wf_ins AS W ON (A.oc_id = W.oc_id AND A.todo_id = W.wf_ins_id )
  121. WHERE A.oc_id = #{ocId ,jdbcType=BIGINT} AND A.deleted_flag = 0
  122. <if test="todoId !=null">
  123. AND A.todo_id = #{todoId ,jdbcType=BIGINT}
  124. </if>
  125. <if test="keywords != null and keywords != ''">
  126. AND A.todo_title like "%"#{keywords}"%"
  127. </if>
  128. <if test="taskTypeId != null">
  129. AND B.task_type_id = #{taskTypeId ,jdbcType=BIGINT}
  130. </if>
  131. <if test="taskCatId != null">
  132. AND B.task_cat_id = #{taskCatId ,jdbcType=BIGINT}
  133. </if>
  134. <if test="status != null">
  135. AND D.status = #{status ,jdbcType=BIGINT}
  136. </if>
  137. <if test="day != null">
  138. AND date_format(B.launch_time, '%Y-%m-%d') = #{day}
  139. </if>
  140. <if test="startDate != null and endDate != null">
  141. AND B.launch_time BETWEEN #{startDate} and #{endDate}
  142. </if>
  143. <if test="handleGroupNodeLeft != null and handleGroupNodeRight != null">
  144. <![CDATA[
  145. AND C.node_left >= #{handleGroupNodeLeft, jdbcType=BIGINT}
  146. AND C.node_right <= #{handleGroupNodeRight, jdbcType=BIGINT}
  147. ]]>
  148. </if>
  149. <if test="curGroupNodeLeft != null and curGroupNodeRight != null">
  150. <![CDATA[
  151. AND X.node_left >= #{curGroupNodeLeft, jdbcType=BIGINT}
  152. AND X.node_right <= #{curGroupNodeRight, jdbcType=BIGINT}
  153. ]]>
  154. </if>
  155. ORDER BY B.launch_time DESC
  156. </select>
  157. <!--分页查询-->
  158. <select id="getByPage" parameterType="java.util.Map" resultMap="TodoDtoResultMap">
  159. SELECT
  160. <include refid="TodoDto_Cols"/>
  161. FROM todo AS A
  162. LEFT JOIN task AS B ON (A.oc_id = B.oc_id AND A.todo_id = B.task_id )
  163. LEFT JOIN task_cat AS C ON (B.oc_id = C.oc_id AND B.task_cat_id = C.task_cat_id )
  164. LEFT JOIN wf_ins AS W ON (A.oc_id = W.oc_id AND A.todo_id = W.wf_ins_id )
  165. WHERE A.oc_id = #{ocId ,jdbcType=BIGINT} AND A.deleted_flag = 0
  166. <if test="todoId !=null">
  167. AND A.todo_id = #{todoId ,jdbcType=BIGINT}
  168. </if>
  169. <if test="keywords != null and keywords != ''">
  170. AND A.todo_title like "%"#{keywords}"%"
  171. </if>
  172. <if test="taskTypeId != null">
  173. AND B.task_type_id = #{taskTypeId ,jdbcType=BIGINT}
  174. </if>
  175. <if test="taskCatId != null">
  176. AND B.task_cat_id = #{taskCatId ,jdbcType=BIGINT}
  177. </if>
  178. <if test="status != null">
  179. AND D.status = #{status ,jdbcType=BIGINT}
  180. </if>
  181. <if test="day != null">
  182. AND date_format(B.launch_time , '%Y-%m-%d') = #{day}
  183. </if>
  184. <if test="startDate != null and endDate != null">
  185. AND A.launch_time BETWEEN #{startDate} and #{endDate}
  186. </if>
  187. <if test="nodeLeft != null and nodeRight != null">
  188. <![CDATA[
  189. AND C.node_left >= #{nodeLeft ,jdbcType=BIGINT}
  190. AND C.node_right <= #{nodeRight ,jdbcType=BIGINT}
  191. ]]>
  192. </if>
  193. ORDER BY B.launch_time DESC
  194. </select>
  195. <!--Create-->
  196. <insert id="create" parameterType="com.zhyc.xps.sys.entity.Todo">
  197. INSERT INTO todo
  198. <trim prefix="(" suffix=")" suffixOverrides=",">
  199. <if test="ocId != null">
  200. oc_id,
  201. </if>
  202. <if test="todoId != null">
  203. todo_id,
  204. </if>
  205. <if test="todoTitle != null and todoTitle!=''">
  206. todo_title,
  207. </if>
  208. <if test="todoDesc != null and todoDesc != ''">
  209. todo_desc,
  210. </if>
  211. <if test="handleRemark != null">
  212. handle_remark,
  213. </if>
  214. <if test="createdBy != null">
  215. created_by,
  216. </if>
  217. <if test="createdAt != null">
  218. created_at,
  219. </if>
  220. </trim>
  221. <trim prefix="values (" suffix=")" suffixOverrides=",">
  222. <if test="ocId != null">
  223. #{ocId ,jdbcType=BIGINT},
  224. </if>
  225. <if test="todoId != null">
  226. #{todoId ,jdbcType=BIGINT},
  227. </if>
  228. <if test="todoTitle != null and todoTitle!=''">
  229. #{todoTitle ,jdbcType=VARCHAR},
  230. </if>
  231. <if test="todoDesc != null and todoDesc != ''">
  232. #{todoDesc ,jdbcType=VARCHAR},
  233. </if>
  234. <if test="handleRemark != null">
  235. #{handleRemark ,jdbcType=VARCHAR},
  236. </if>
  237. <if test="createdBy != null">
  238. #{createdBy ,jdbcType=BIGINT},
  239. </if>
  240. <if test="createdAt != null">
  241. #{createdAt ,jdbcType=TIMESTAMP},
  242. </if>
  243. </trim>
  244. </insert>
  245. <!--更新-->
  246. <update id="update" parameterType="com.zhyc.xps.sys.entity.Todo">
  247. UPDATE todo
  248. <trim suffixOverrides=",">
  249. <set>
  250. <if test="todoTitle != null">
  251. todo_title =#{todoTitle ,jdbcType=VARCHAR},
  252. </if>
  253. <if test="todoDesc != null and todoDesc != ''">
  254. todo_desc = #{todoDesc ,jdbcType=VARCHAR},
  255. </if>
  256. <if test="handleRemark != null">
  257. handle_remark = #{handleRemark ,jdbcType=VARCHAR},
  258. </if>
  259. <if test="updatedBy != null">
  260. updated_by = #{updatedBy ,jdbcType=BIGINT},
  261. </if>
  262. <if test="updatedAt != null">
  263. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  264. </if>
  265. </set>
  266. </trim>
  267. WHERE oc_id = #{ocId, jdbcType=BIGINT} AND todo_id = #{todoId, jdbcType=BIGINT}
  268. </update>
  269. <!--删除 -->
  270. <update id="delete" parameterType="java.util.Map">
  271. UPDATE todo
  272. <trim suffixOverrides=",">
  273. <set>
  274. <if test="deletedBy != null">
  275. deleted_by = #{deletedBy ,jdbcType=BIGINT},
  276. </if>
  277. <if test="deletedAt != null">
  278. deleted_at = #{deletedAt ,jdbcType=DATE},
  279. </if>
  280. <if test="deletedFlag != null">
  281. deleted_flag = #{deletedFlag ,jdbcType=BIGINT},
  282. </if>
  283. </set>
  284. </trim>
  285. WHERE oc_id = #{ocId ,jdbcType=BIGINT} AND deleted_flag = 0
  286. <if test="todoId != null ">
  287. AND todo_id = #{todoId ,jdbcType=BIGINT}
  288. </if>
  289. </update>
  290. </mapper>