WmScorePackageStatusMapper.xml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ~
  4. ~ Copyright (c) 2018-2025, hnqz All rights reserved.
  5. ~
  6. ~ Redistribution and use in source and binary forms, with or without
  7. ~ modification, are permitted provided that the following conditions are met:
  8. ~
  9. ~ Redistributions of source code must retain the above copyright notice,
  10. ~ this list of conditions and the following disclaimer.
  11. ~ Redistributions in binary form must reproduce the above copyright
  12. ~ notice, this list of conditions and the following disclaimer in the
  13. ~ documentation and/or other materials provided with the distribution.
  14. ~ Neither the name of the pig4cloud.com developer nor the names of its
  15. ~ contributors may be used to endorse or promote products derived from
  16. ~ this software without specific prior written permission.
  17. ~ Author: hnqz
  18. ~
  19. -->
  20. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  21. <mapper namespace="com.qunzhixinxi.hnqz.admin.mapper.WmScorePackageStatusMapper">
  22. <resultMap id="wmScorePackageStatusMap" type="com.qunzhixinxi.hnqz.admin.entity.WmScorePackageStatus">
  23. <id property="id" column="id"/>
  24. <result property="userId" column="user_id"/>
  25. <result property="packageId" column="package_id"/>
  26. <result property="status" column="status"/>
  27. <result property="deptId" column="dept_id"/>
  28. <result property="delFlag" column="del_flag"/>
  29. <result property="enableFlag" column="enable_flag"/>
  30. <result property="tenantId" column="tenant_id"/>
  31. <result property="createTime" column="create_time"/>
  32. <result property="createUser" column="create_user"/>
  33. <result property="updateTime" column="update_time"/>
  34. <result property="updateUser" column="update_user"/>
  35. <result property="phone" column="phone"/>
  36. <result property="userScore" column="user_score"/>
  37. <result property="enableType" column="enable_type"/>
  38. <result property="taskAddFlag" column="task_add_flag"/>
  39. <result property="taskNum" column="task_num"/>
  40. </resultMap>
  41. <select id="getPage" resultMap="wmScorePackageStatusMap">
  42. select u.realname as user_id,u.phone as phone,
  43. CONCAT(u.province,'-',u.city ) as address,
  44. p.score_package_name as package_id,
  45. s.id,s.`status`,s.dept_id,s.del_flag,s.enable_flag,s.create_time
  46. ,s.enable_type,s.user_id as task_user_id, s.task_num
  47. from wm_score_package_status s
  48. left join sys_user u on u.user_id=s.user_id
  49. left join wm_score_package p on p.id=s.package_id
  50. left join sys_user u1 on u1.user_id = s.user_id
  51. where s.del_flag=0
  52. <if test="query.id!=null and query.id!=''">
  53. and s.id=#{query.id}
  54. </if>
  55. <if test="query.userId!=null and query.userId!=''">
  56. and s.user_id=#{query.userId}
  57. </if>
  58. <if test="query.userRealName != null and query.userRealName != ''">
  59. and u1.realname like concat('%',#{query.userRealName},'%')
  60. </if>
  61. <if test="query.phone != null and query.phone != ''">
  62. and u1.phone like concat('%',#{query.phone},'%')
  63. </if>
  64. <if test="query.status!=null and query.status!=''">
  65. and s.`status` = #{query.status}
  66. </if>
  67. <if test="query.packageId!=null and query.packageId!=''">
  68. and s.package_id=#{query.packageId}
  69. </if>
  70. order by s.create_time
  71. </select>
  72. <select id="getByPackageId" resultMap="wmScorePackageStatusMap">
  73. select s.id, s.task_num, s.user_score, u.realname as user_id, s.user_id as task_user_id
  74. from wm_score_package_status s
  75. left join sys_user u on u.user_id=s.user_id
  76. where s.del_flag = '0' and s.enable_flag = '0'
  77. <if test="query.id!=null and query.id!=''">
  78. and s.id=#{query.id}
  79. </if>
  80. <if test="query.userId!=null and query.userId!=''">
  81. and s.user_id=#{query.userId}
  82. </if>
  83. <if test="query.packageId!=null and query.packageId!=''">
  84. and s.package_id=#{query.packageId}
  85. </if>
  86. <if test="query.status!=null and query.status!=''">
  87. and s.status=#{query.status}
  88. </if>
  89. order by s.create_time
  90. </select>
  91. <select id="getReceivedPackageList" resultType="com.qunzhixinxi.hnqz.admin.entity.input.WmScorePackageApiOutput">
  92. SELECT s.enable_flag,
  93. s.id statusId,
  94. p.id,
  95. p.score_package_name,
  96. p.send_package_dept_id,
  97. s.task_add_flag,
  98. p.create_time,
  99. p.package_type1,
  100. p.user_num,
  101. p.task_num,
  102. p.description,
  103. p.belong_date,
  104. p.pkg_sn as `packageSn`,
  105. p.score,
  106. s.enable_type,
  107. s.status,
  108. s.task_num taskNum2 ,
  109. s.create_time receiveTime,
  110. d.name packageEntName
  111. FROM
  112. wm_score_package_status s, wm_score_package p , sys_dept d
  113. WHERE s.package_id = p.id AND p.send_package_dept_id = d.dept_id
  114. AND s.del_flag = '0'
  115. <if test="query.scorePackageName != null and query.scorePackageName != ''">
  116. AND p.score_package_name like CONCAT('%',#{query.scorePackageName},'%') OR p.pkg_sn like CONCAT('%',#{query.scorePackageName},'%')
  117. </if>
  118. <if test="query.selDate != null and query.selDate != ''">
  119. AND p.belong_date= #{query.selDate}
  120. </if>
  121. <if test="query.typeid != null and query.typeid != ''">
  122. AND p.typeid= #{query.typeid}
  123. </if>
  124. <if test="query.packageType2 != null and query.packageType2 != ''">
  125. AND p.package_type2= #{query.packageType2}
  126. </if>
  127. <if test="query.userId != null and query.userId != ''">
  128. AND s.user_id= #{query.userId}
  129. </if>
  130. <if test="query.status != null and query.status != ''">
  131. AND s.status= #{query.status}
  132. </if>
  133. <if test="query.taskAddFlag != null and query.taskAddFlag != ''">
  134. AND s.task_add_flag= #{query.taskAddFlag}
  135. </if>
  136. order by s.create_time desc
  137. </select>
  138. <select id="getWmScorePackageStatusPage" resultMap="wmScorePackageStatusMap">
  139. select distinct s.*,p.score_package_name from wm_score_package_status s
  140. left join wm_score_package p on p.id=s.package_id
  141. left join sys_user u on u.dept_id=p.send_package_dept_id
  142. left join sys_user u1 on u1.user_id = s.user_id
  143. where s.del_flag=0 and p.del_flag=0
  144. and p.typeid=4
  145. and (p.source_type = '0' or p.source_type is null)
  146. <if test="query.id!=null and query.id!=''">
  147. and s.id=#{query.id}
  148. </if>
  149. <if test="query.userRealName != null and query.userRealName != ''">
  150. and u1.realname like concat('%',#{query.userRealName},'%')
  151. </if>
  152. <if test="query.scorePackageName != null and query.scorePackageName !=''">
  153. and p.score_package_name like concat('%',#{query.scorePackageName},'%')
  154. </if>
  155. <if test="query.userId!=null and query.userId!=''">
  156. and u.user_id=#{query.userId}
  157. </if>
  158. <if test="query.packageId!=null and query.packageId!=''">
  159. and s.package_id=#{query.packageId}
  160. </if>
  161. <if test="query.status !=null">
  162. and s.status = #{query.status}
  163. </if>
  164. <if test="query.teamIdList != null">
  165. and p.package_user_scope in
  166. <foreach item="teamId" index="index" collection="query.teamIdList" open="(" separator="," close=")">
  167. #{teamId}
  168. </foreach>
  169. </if>
  170. <if test="query.deptId != null">
  171. and p.dept_id = #{query.deptId}
  172. </if>
  173. order by s.create_time desc
  174. </select>
  175. <!-- 获取当前部门已接单人的列表 -->
  176. <select id="getDeptReceiveUserList" resultType="java.util.Map">
  177. SELECT DISTINCT
  178. s.user_id as userId,
  179. u.realname as realName
  180. FROM
  181. wm_score_package_status s
  182. LEFT JOIN wm_score_package p ON p.id = s.package_id
  183. LEFT JOIN sys_user u ON u.user_id = s.user_id
  184. WHERE
  185. s.del_flag = 0
  186. AND s.enable_flag = 0
  187. AND s.dept_id = #{deptId}
  188. AND p.package_type1 = #{packageType1}
  189. AND p.package_type2 = #{packageType2}
  190. </select>
  191. </mapper>