WmScorePackageStatusMapper.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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, s.id statusId, p.id, p.score_package_name, p.send_package_dept_id, s.task_add_flag,
  93. p.create_time, p.package_type1, p.user_num, p.task_num, p.description, p.belong_date,
  94. p.score, s.enable_type, s.status, s.task_num taskNum2 , s.create_time receiveTime, d.name packageEntName
  95. FROM
  96. wm_score_package_status s, wm_score_package p , sys_dept d
  97. WHERE s.package_id = p.id AND p.send_package_dept_id = d.dept_id
  98. AND s.del_flag = '0'
  99. <if test="query.scorePackageName != null and query.scorePackageName != ''">
  100. AND p.score_package_name like CONCAT('%',#{query.scorePackageName},'%')
  101. </if>
  102. <if test="query.selDate != null and query.selDate != ''">
  103. AND p.belong_date= #{query.selDate}
  104. </if>
  105. <if test="query.typeid != null and query.typeid != ''">
  106. AND p.typeid= #{query.typeid}
  107. </if>
  108. <if test="query.packageType2 != null and query.packageType2 != ''">
  109. AND p.package_type2= #{query.packageType2}
  110. </if>
  111. <if test="query.userId != null and query.userId != ''">
  112. AND s.user_id= #{query.userId}
  113. </if>
  114. <if test="query.status != null and query.status != ''">
  115. AND s.status= #{query.status}
  116. </if>
  117. <if test="query.taskAddFlag != null and query.taskAddFlag != ''">
  118. AND s.task_add_flag= #{query.taskAddFlag}
  119. </if>
  120. order by s.create_time desc
  121. </select>
  122. <select id="getWmScorePackageStatusPage" resultMap="wmScorePackageStatusMap">
  123. select s.*,p.score_package_name from wm_score_package_status s
  124. left join wm_score_package p on p.id=s.package_id
  125. left join sys_user u on u.dept_id=p.send_package_dept_id
  126. left join sys_user u1 on u1.user_id = s.user_id
  127. where s.del_flag=0 and p.del_flag=0
  128. and p.typeid=4
  129. and p.source_type = '0'
  130. /* 判断接单对象范围package_user_scope小于1000则是普通任务,大于1000则是团队发的包。如果adminUserId不是任何一个团队的负责人则可以查看全部;
  131. 如果adminUserId是团队负责人且是下发该包的团队的,则可以看到该包对应的任务 */
  132. and (p.package_user_scope &lt; '1000'
  133. and (SELECT COUNT(1) FROM wm_team WHERE del_flag=0 and enable_flag=0 and dept_id=#{query.deptId} and FIND_IN_SET(#{query.adminUserId}, leader)) = 0
  134. or (p.package_user_scope &gt;='1000'
  135. and FIND_IN_SET(#{query.adminUserId}, (SELECT leader FROM wm_team WHERE id = p.package_user_scope))))
  136. <if test="query.id!=null and query.id!=''">
  137. and s.id=#{query.id}
  138. </if>
  139. <if test="query.userRealName != null and query.userRealName != ''">
  140. and u1.realname like concat('%',#{query.userRealName},'%')
  141. </if>
  142. <if test="query.scorePackageName != null and query.scorePackageName !=''">
  143. and p.score_package_name like concat('%',#{query.scorePackageName},'%')
  144. </if>
  145. <if test="query.userId!=null and query.userId!=''">
  146. and u.user_id=#{query.userId}
  147. </if>
  148. <if test="query.packageId!=null and query.packageId!=''">
  149. and s.package_id=#{query.packageId}
  150. </if>
  151. <if test="query.status !=null">
  152. and s.status = #{query.status}
  153. </if>
  154. order by s.create_time desc
  155. </select>
  156. <!-- 获取当前部门已接单人的列表 -->
  157. <select id="getDeptReceiveUserList" resultType="java.util.Map">
  158. SELECT DISTINCT
  159. s.user_id as userId,
  160. u.realname as realName
  161. FROM
  162. wm_score_package_status s
  163. LEFT JOIN wm_score_package p ON p.id = s.package_id
  164. LEFT JOIN sys_user u ON u.user_id = s.user_id
  165. WHERE
  166. s.del_flag = 0
  167. AND s.enable_flag = 0
  168. AND s.dept_id = #{deptId}
  169. AND p.package_type1 = #{packageType1}
  170. AND p.package_type2 = #{packageType2}
  171. </select>
  172. </mapper>