WorkTaskV1ServiceDaoImplMapper.xml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="workTaskV1ServiceDaoImpl">
  6. <!-- 保存工作单任务信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveWorkTaskInfo" parameterType="Map">
  8. insert into work_task(
  9. staff_name,start_time,state,end_time,community_id,store_id,task_id,work_id,staff_id,org_staff_id,org_staff_name
  10. ) values (
  11. #{staffName},#{startTime},#{state},#{endTime},#{communityId},#{storeId},#{taskId},#{workId},#{staffId},#{orgStaffId},#{orgStaffName}
  12. )
  13. </insert>
  14. <!-- 查询工作单任务信息 add by wuxw 2018-07-03 -->
  15. <select id="getWorkTaskInfo" parameterType="Map" resultType="Map">
  16. select t.staff_name,t.staff_name staffName,t.start_time,t.start_time startTime,t.status_cd,t.status_cd
  17. statusCd,t.state,t.end_time,t.end_time endTime,t.community_id,t.community_id communityId,t.store_id,t.store_id
  18. storeId,t.task_id,t.task_id taskId,t.work_id,t.work_id workId,t.staff_id,t.staff_id staffId,t.create_time
  19. createTime,
  20. td.`name` stateName,
  21. wp.work_cycle workCycle,wp.create_user_id
  22. createUserId,wp.create_user_name createUserName,wp.work_name workName,wp.wt_id wtId,wp.create_user_tel createUserTel,
  23. wt.type_name typeName,t.finish_time finishTime,t.task_timeout taskTimeout,t.org_staff_id orgStaffId,t.org_staff_name orgStaffName
  24. from work_task t
  25. left join t_dict td on t.state = td.status_cd and td.table_name = 'work_pool' and td.table_columns = 'state'
  26. left join work_pool wp on t.work_id = wp.work_id and wp.status_cd = '0'
  27. left join work_type wt on wp.wt_id = wt.wt_id
  28. where 1=1
  29. and wp.status_cd = '0'
  30. <if test="createUserNameLike !=null and createUserNameLike != ''">
  31. and wp.create_user_name like concat('%', #{createUserNameLike},'%')
  32. </if>
  33. <if test="workNameLike !=null and workNameLike != ''">
  34. and wp.work_name like concat('%', #{workNameLike},'%')
  35. </if>
  36. <if test="staffName !=null and staffName != ''">
  37. and t.staff_name= #{staffName}
  38. </if>
  39. <if test="staffNameLike !=null and staffNameLike != ''">
  40. and t.staff_name like concat('%', #{staffNameLike},'%')
  41. </if>
  42. <if test="startTime !=null and startTime != ''">
  43. and t.start_time= #{startTime}
  44. </if>
  45. <if test="taskInsTime !=null and taskInsTime != ''">
  46. and DATE_FORMAT(t.start_time,'%Y-%m-%d')= #{taskInsTime}
  47. </if>
  48. <if test="statusCd !=null and statusCd != ''">
  49. and t.status_cd= #{statusCd}
  50. </if>
  51. <if test="state !=null and state != ''">
  52. and t.state= #{state}
  53. </if>
  54. <if test="endTime !=null and endTime != ''">
  55. and t.end_time= #{endTime}
  56. </if>
  57. <if test="communityId !=null and communityId != ''">
  58. and t.community_id= #{communityId}
  59. </if>
  60. <if test="storeId !=null and storeId != ''">
  61. and t.store_id= #{storeId}
  62. </if>
  63. <if test="taskId !=null and taskId != ''">
  64. and t.task_id= #{taskId}
  65. </if>
  66. <if test="workId !=null and workId != ''">
  67. and t.work_id= #{workId}
  68. </if>
  69. <if test="workIds !=null ">
  70. and t.work_id in
  71. <foreach collection="workIds" item="item" open="(" close=")" separator=",">
  72. #{item}
  73. </foreach>
  74. </if>
  75. <if test="staffId !=null and staffId != ''">
  76. and t.staff_id= #{staffId}
  77. </if>
  78. <if test="orgStaffId !=null and orgStaffId != ''">
  79. and t.org_staff_id= #{orgStaffId}
  80. </if>
  81. <if test="taskTimeout !=null and taskTimeout != ''">
  82. and t.task_timeout= #{taskTimeout}
  83. </if>
  84. <if test="queryStartTime !=null and queryStartTime != ''">
  85. and t.create_time &gt; #{queryStartTime}
  86. </if>
  87. <if test="queryEndTime !=null and queryEndTime != ''">
  88. and t.create_time &lt; #{queryEndTime}
  89. </if>
  90. order by t.create_time desc
  91. <if test="page != -1 and page != null ">
  92. limit #{page}, #{row}
  93. </if>
  94. </select>
  95. <!-- 修改工作单任务信息 add by wuxw 2018-07-03 -->
  96. <update id="updateWorkTaskInfo" parameterType="Map">
  97. update work_task t set t.status_cd = #{statusCd}
  98. <if test="newBId != null and newBId != ''">
  99. ,t.b_id = #{newBId}
  100. </if>
  101. <if test="staffName !=null and staffName != ''">
  102. , t.staff_name= #{staffName}
  103. </if>
  104. <if test="startTime !=null and startTime != ''">
  105. , t.start_time= #{startTime}
  106. </if>
  107. <if test="state !=null and state != ''">
  108. , t.state= #{state}
  109. </if>
  110. <if test="endTime !=null and endTime != ''">
  111. , t.end_time= #{endTime}
  112. </if>
  113. <if test="finishTime !=null and finishTime != ''">
  114. , t.finish_time = #{finishTime}
  115. </if>
  116. <if test="taskTimeout !=null and taskTimeout != ''">
  117. , t.task_timeout= #{taskTimeout}
  118. </if>
  119. <if test="staffId !=null and staffId != ''">
  120. , t.staff_id= #{staffId}
  121. </if>
  122. where 1=1
  123. <if test="taskId !=null and taskId != ''">
  124. and t.task_id= #{taskId}
  125. </if>
  126. <if test="communityId !=null and communityId != ''">
  127. and t.community_id= #{communityId}
  128. </if>
  129. <if test="storeId !=null and storeId != ''">
  130. and t.store_id= #{storeId}
  131. </if>
  132. <if test="workId !=null and workId != ''">
  133. and t.work_id= #{workId}
  134. </if>
  135. </update>
  136. <!-- 查询工作单任务数量 add by wuxw 2018-07-03 -->
  137. <select id="queryWorkTasksCount" parameterType="Map" resultType="Map">
  138. select count(1) count
  139. from work_task t
  140. left join t_dict td on t.state = td.status_cd and td.table_name = 'work_pool' and td.table_columns = 'state'
  141. left join work_pool wp on t.work_id = wp.work_id and wp.status_cd = '0'
  142. left join work_type wt on wp.wt_id = wt.wt_id
  143. where 1=1
  144. and wp.status_cd = '0'
  145. <if test="createUserNameLike !=null and createUserNameLike != ''">
  146. and wp.create_user_name like concat('%', #{createUserNameLike},'%')
  147. </if>
  148. <if test="workNameLike !=null and workNameLike != ''">
  149. and wp.work_name like concat('%', #{workNameLike},'%')
  150. </if>
  151. <if test="staffName !=null and staffName != ''">
  152. and t.staff_name= #{staffName}
  153. </if>
  154. <if test="staffNameLike !=null and staffNameLike != ''">
  155. and t.staff_name like concat('%', #{staffNameLike},'%')
  156. </if>
  157. <if test="startTime !=null and startTime != ''">
  158. and t.start_time= #{startTime}
  159. </if>
  160. <if test="statusCd !=null and statusCd != ''">
  161. and t.status_cd= #{statusCd}
  162. </if>
  163. <if test="state !=null and state != ''">
  164. and t.state= #{state}
  165. </if>
  166. <if test="endTime !=null and endTime != ''">
  167. and t.end_time= #{endTime}
  168. </if>
  169. <if test="communityId !=null and communityId != ''">
  170. and t.community_id= #{communityId}
  171. </if>
  172. <if test="storeId !=null and storeId != ''">
  173. and t.store_id= #{storeId}
  174. </if>
  175. <if test="taskId !=null and taskId != ''">
  176. and t.task_id= #{taskId}
  177. </if>
  178. <if test="workId !=null and workId != ''">
  179. and t.work_id= #{workId}
  180. </if>
  181. <if test="workIds !=null ">
  182. and t.work_id in
  183. <foreach collection="workIds" item="item" open="(" close=")" separator=",">
  184. #{item}
  185. </foreach>
  186. </if>
  187. <if test="staffId !=null and staffId != ''">
  188. and t.staff_id= #{staffId}
  189. </if>
  190. <if test="orgStaffId !=null and orgStaffId != ''">
  191. and t.org_staff_id= #{orgStaffId}
  192. </if>
  193. <if test="taskTimeout !=null and taskTimeout != ''">
  194. and t.task_timeout= #{taskTimeout}
  195. </if>
  196. <if test="queryStartTime !=null and queryStartTime != ''">
  197. and t.create_time &gt; #{queryStartTime}
  198. </if>
  199. <if test="queryEndTime !=null and queryEndTime != ''">
  200. and t.create_time &lt; #{queryEndTime}
  201. </if>
  202. </select>
  203. </mapper>