WmTaskV2Mapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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.qunzhixinxi.hnqz.admin.mapper.WmTaskV2Mapper">
  5. <resultMap id="wmTaskMap"
  6. type="com.qunzhixinxi.hnqz.admin.controller.task.vo.TaskRespVO$ToDirectCheck">
  7. <id property="taskId" column="id"/>
  8. <result property="taskNumber" column="task_number"/>
  9. <result property="taskTypeId" column="task_type_id"/>
  10. <result property="taskScore" column="score"/>
  11. <result property="taskStatus" column="task_status"/>
  12. <result property="createTime" column="create_time"/>
  13. <result property="taskUserId" column="task_user_id"/>
  14. <result property="taskContentId" column="task_content_id"/>
  15. <result property="entId" column="dept_id"/>
  16. <result property="pkgName" column="score_package_name"/>
  17. <result property="relPkgName" column="rel_pkg_name"/>
  18. <result property="pkgStartTime" column="start_time"/>
  19. <result property="pkgEndTime" column="end_time"/>
  20. <result property="provAbbr" column="prov_abbr"/>
  21. <result property="skuId" column="drugtable"/>
  22. <!-- <collection property="checkHistoryList" javaType="java.util.ArrayList" ofType="map"-->
  23. <!-- select="com.qunzhixinxi.hnqz.admin.mapper.SysCheckChainNodeCheckHistoryMapper.getTaskCheckHis"-->
  24. <!-- column="id"/>-->
  25. </resultMap>
  26. <select id="pageDirectCheck" resultMap="wmTaskMap">
  27. SELECT t.id,
  28. t.task_number,
  29. t.task_type_id,
  30. t.score,
  31. t.task_user_id,
  32. t.task_status,
  33. t.create_time,
  34. t.task_content_id,
  35. pkg.dept_id,
  36. pkg.score_package_name,
  37. ppkg.score_package_name AS rel_pkg_name,
  38. pkg.start_time,
  39. pkg.end_time,
  40. ppkg.prov_abbr,
  41. pkg.drugtable
  42. FROM wm_task AS t
  43. LEFT JOIN wm_score_package AS pkg ON pkg.id = t.score_package_id
  44. LEFT JOIN wm_score_package AS ppkg ON ppkg.id = pkg.relation_score_id
  45. INNER JOIN (SELECT DISTINCT tmp.target_id AS task_id
  46. FROM (SELECT h.target_id, SUM(DISTINCT h.node_id) AS node_sum
  47. FROM sys_chain_node_check_his AS h
  48. GROUP BY h.target_id) tmp
  49. WHERE tmp.node_sum IN
  50. <foreach collection="nodeIds" item="nodeId" open="(" close=")" separator=",">
  51. #{nodeId}
  52. </foreach>
  53. ORDER BY task_id) AS his
  54. ON his.task_id = t.id
  55. <where>
  56. t.del_flag = '0'
  57. AND pkg.enable_flag = '0'
  58. AND pkg.del_flag = '0'
  59. AND ppkg.enable_flag = '0'
  60. AND ppkg.del_flag = '0'
  61. <if test="pkgIssueDate != null and pkgExpiryDate != null">
  62. AND
  63. (pkg.start_time &gt;= #{pkgIssueDate} AND pkg.start_time &lt;= #{pkgExpiryDate}
  64. OR pkg.end_time &gt;= #{pkgIssueDate} AND pkg.end_time &lt;= #{pkgExpiryDate})
  65. </if>
  66. <if test="prov != null and prov != ''">
  67. AND ppkg.prov_abbr = #{prov}
  68. </if>
  69. <if test="vendorIds != null and vendorIds.size > 0">
  70. AND pkg.dept_id IN
  71. <foreach collection="vendorIds" item="vid" open="(" close=")" separator=",">
  72. #{vid}
  73. </foreach>
  74. </if>
  75. <if test="skuIds != null and skuIds.size > 0">
  76. AND pkg.drugtable IN
  77. <foreach collection="skuIds" item="skuId" open="(" close=")" separator=",">
  78. #{skuId}
  79. </foreach>
  80. </if>
  81. <if test="pkgIds != null and pkgIds.size > 0">
  82. AND t.score_package_id IN
  83. <foreach collection="pkgIds" item="pid" open="(" close=")" separator=",">
  84. #{pid}
  85. </foreach>
  86. </if>
  87. <if test="taskTypeId != null and taskTypeId != ''">
  88. AND t.task_type_id = #{taskTypeId}
  89. </if>
  90. <if test="salesId != null">
  91. AND t.task_user_id = #{salesId}
  92. </if>
  93. <if test="taskStatus != null and taskStatus != ''">
  94. AND t.task_status = #{taskStatus}
  95. </if>
  96. <if test="taskStartTime != null and taskEndTime != null">
  97. AND (t.create_time BETWEEN #{taskStartTime} AND #{taskEndTime})
  98. </if>
  99. </where>
  100. ORDER BY t.id
  101. </select>
  102. <select id="pageDirectChecked" resultMap="wmTaskMap">
  103. SELECT t.id,
  104. t.task_number,
  105. t.task_type_id,
  106. t.score,
  107. t.task_user_id,
  108. t.task_status,
  109. t.create_time,
  110. t.task_content_id,
  111. pkg.dept_id,
  112. pkg.score_package_name,
  113. ppkg.score_package_name AS rel_pkg_name,
  114. pkg.start_time,
  115. pkg.end_time,
  116. ppkg.prov_abbr,
  117. pkg.drugtable
  118. FROM wm_task AS t
  119. LEFT JOIN wm_score_package AS pkg ON pkg.id = t.score_package_id
  120. LEFT JOIN wm_score_package AS ppkg ON ppkg.id = pkg.relation_score_id
  121. <where>
  122. <if test="taskIds != null and taskIds.size > 0">
  123. t.id IN
  124. <foreach collection="taskIds" item="tid" open="(" close=")" separator=",">
  125. #{tid}
  126. </foreach>
  127. </if>
  128. <if test="pkgIssueDate != null and pkgExpiryDate != null">
  129. AND
  130. (pkg.start_time &gt;= #{pkgIssueDate} AND pkg.start_time &lt;= #{pkgExpiryDate}
  131. OR pkg.end_time &gt;= #{pkgIssueDate} AND pkg.end_time &lt;= #{pkgExpiryDate})
  132. </if>
  133. <if test="prov != null and prov != ''">
  134. AND ppkg.prov_abbr = #{prov}
  135. </if>
  136. <if test="vendorIds != null and vendorIds.size > 0">
  137. AND pkg.dept_id IN
  138. <foreach collection="vendorIds" item="vid" open="(" close=")" separator=",">
  139. #{vid}
  140. </foreach>
  141. </if>
  142. <if test="skuIds != null and skuIds.size > 0">
  143. AND pkg.drugtable IN
  144. <foreach collection="skuIds" item="skuId" open="(" close=")" separator=",">
  145. #{skuId}
  146. </foreach>
  147. </if>
  148. <if test="pkgIds != null and pkgIds.size > 0">
  149. AND t.score_package_id IN
  150. <foreach collection="pkgIds" item="pid" open="(" close=")" separator=",">
  151. #{pid}
  152. </foreach>
  153. </if>
  154. <if test="taskTypeId != null and taskTypeId != ''">
  155. AND t.task_type_id = #{taskTypeId}
  156. </if>
  157. <if test="salesId != null">
  158. AND t.task_user_id = #{salesId}
  159. </if>
  160. <if test="taskStartTime != null and taskEndTime != null">
  161. AND (t.create_time BETWEEN #{taskStartTime} AND #{taskEndTime})
  162. </if>
  163. <if test="taskStatus != null and taskStatus != ''">
  164. AND t.task_status = #{taskStatus}
  165. </if>
  166. </where>
  167. ORDER BY t.id
  168. </select>
  169. </mapper>