WmScorePackageStatusMapper.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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="packageSn" column="package_sn"/>
  39. <result property="taskAddFlag" column="task_add_flag"/>
  40. <result property="taskNum" column="task_num"/>
  41. </resultMap>
  42. <select id="getPage" resultMap="wmScorePackageStatusMap">
  43. select u.realname as user_id,u.phone as phone,
  44. CONCAT(u.province,'-',u.city ) as address,
  45. p.score_package_name as package_id,
  46. s.id,s.`status`,s.dept_id,s.del_flag,s.enable_flag,s.create_time
  47. ,s.enable_type,s.user_id as task_user_id, s.task_num
  48. from wm_score_package_status s
  49. left join sys_user u on u.user_id=s.user_id
  50. left join wm_score_package p on p.id=s.package_id
  51. left join sys_user u1 on u1.user_id = s.user_id
  52. where s.del_flag=0
  53. <if test="query.id!=null and query.id!=''">
  54. and s.id=#{query.id}
  55. </if>
  56. <if test="query.userId!=null and query.userId!=''">
  57. and s.user_id=#{query.userId}
  58. </if>
  59. <if test="query.userRealName != null and query.userRealName != ''">
  60. and u1.realname like concat('%',#{query.userRealName},'%')
  61. </if>
  62. <if test="query.phone != null and query.phone != ''">
  63. and u1.phone like concat('%',#{query.phone},'%')
  64. </if>
  65. <if test="query.status!=null and query.status!=''">
  66. and s.`status` = #{query.status}
  67. </if>
  68. <if test="query.packageId!=null and query.packageId!=''">
  69. and s.package_id=#{query.packageId}
  70. </if>
  71. order by s.create_time
  72. </select>
  73. <select id="getByPackageId" resultMap="wmScorePackageStatusMap">
  74. select s.id, s.task_num, s.user_score, u.realname as user_id, s.user_id as task_user_id
  75. from wm_score_package_status s
  76. left join sys_user u on u.user_id=s.user_id
  77. where s.del_flag = '0' and s.enable_flag = '0'
  78. <if test="query.id!=null and query.id!=''">
  79. and s.id=#{query.id}
  80. </if>
  81. <if test="query.userId!=null and query.userId!=''">
  82. and s.user_id=#{query.userId}
  83. </if>
  84. <if test="query.packageId!=null and query.packageId!=''">
  85. and s.package_id=#{query.packageId}
  86. </if>
  87. <if test="query.status!=null and query.status!=''">
  88. and s.status=#{query.status}
  89. </if>
  90. order by s.create_time
  91. </select>
  92. <select id="getReceivedPackageList" resultType="com.qunzhixinxi.hnqz.admin.entity.input.WmScorePackageApiOutput">
  93. SELECT s.enable_flag,
  94. s.id statusId,
  95. p.id,
  96. p.score_package_name,
  97. p.send_package_dept_id,
  98. s.task_add_flag,
  99. p.create_time,
  100. p.package_type1,
  101. p.user_num,
  102. p.task_num,
  103. p.description,
  104. p.belong_date,
  105. p.pkg_sn as `packageSn`,
  106. p.score,
  107. s.enable_type,
  108. s.status,
  109. s.task_num taskNum2 ,
  110. s.create_time receiveTime,
  111. d.name packageEntName
  112. FROM
  113. wm_score_package_status s, wm_score_package p , sys_dept d
  114. WHERE s.package_id = p.id AND p.send_package_dept_id = d.dept_id
  115. AND s.del_flag = '0'
  116. <if test="query.scorePackageName != null and query.scorePackageName != ''">
  117. AND p.score_package_name like CONCAT('%',#{query.scorePackageName},'%') OR p.pkg_sn like CONCAT('%',#{query.scorePackageName},'%')
  118. </if>
  119. <if test="query.selDate != null and query.selDate != ''">
  120. AND p.belong_date= #{query.selDate}
  121. </if>
  122. <if test="query.typeid != null and query.typeid != ''">
  123. AND p.typeid= #{query.typeid}
  124. </if>
  125. <if test="query.packageType2 != null and query.packageType2 != ''">
  126. AND p.package_type2= #{query.packageType2}
  127. </if>
  128. <if test="query.userId != null and query.userId != ''">
  129. AND s.user_id= #{query.userId}
  130. </if>
  131. <if test="query.status != null and query.status != ''">
  132. AND s.status= #{query.status}
  133. </if>
  134. <if test="query.taskAddFlag != null and query.taskAddFlag != ''">
  135. AND s.task_add_flag= #{query.taskAddFlag}
  136. </if>
  137. order by s.create_time desc
  138. </select>
  139. <select id="getWmScorePackageStatusPage" resultMap="wmScorePackageStatusMap">
  140. select distinct s.*,p.score_package_name, p.pkg_sn as package_sn, u1.username as phone from wm_score_package_status s
  141. left join wm_score_package p on p.id=s.package_id
  142. left join sys_user u on u.dept_id=p.send_package_dept_id
  143. left join sys_user u1 on u1.user_id = s.user_id
  144. where s.del_flag=0 and p.del_flag=0
  145. and p.typeid=4
  146. and (p.source_type = '0' or p.source_type is null)
  147. <if test="query.id!=null and query.id!=''">
  148. and s.id=#{query.id}
  149. </if>
  150. <if test="query.userRealName != null and query.userRealName != ''">
  151. and u1.realname like concat('%',#{query.userRealName},'%')
  152. </if>
  153. <if test="query.scorePackageName != null and query.scorePackageName !=''">
  154. and p.score_package_name like concat('%',#{query.scorePackageName},'%')
  155. </if>
  156. <if test="query.userId!=null and query.userId!=''">
  157. and u.user_id=#{query.userId}
  158. </if>
  159. <if test="query.packageId!=null and query.packageId!=''">
  160. and s.package_id=#{query.packageId}
  161. </if>
  162. <if test="query.status !=null">
  163. and s.status = #{query.status}
  164. </if>
  165. <if test="query.teamIdList != null">
  166. and p.package_user_scope in
  167. <foreach item="teamId" index="index" collection="query.teamIdList" open="(" separator="," close=")">
  168. #{teamId}
  169. </foreach>
  170. </if>
  171. <if test="query.deptId != null">
  172. and p.dept_id = #{query.deptId}
  173. </if>
  174. order by s.create_time desc
  175. </select>
  176. <!-- 获取当前部门已接单人的列表 -->
  177. <select id="getDeptReceiveUserList" resultType="java.util.Map">
  178. SELECT DISTINCT
  179. s.user_id as userId,
  180. u.realname as realName
  181. FROM
  182. wm_score_package_status s
  183. LEFT JOIN wm_score_package p ON p.id = s.package_id
  184. LEFT JOIN sys_user u ON u.user_id = s.user_id
  185. WHERE
  186. s.del_flag = 0
  187. AND s.enable_flag = 0
  188. AND s.dept_id = #{deptId}
  189. AND p.package_type1 = #{packageType1}
  190. AND p.package_type2 = #{packageType2}
  191. </select>
  192. </mapper>