From cfed607d085002b737ff54992ebd469954362ab3 Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: 星期四, 26 一月 2023 01:19:02 +0800
Subject: [PATCH] 加入业主入驻申请功能

---
 java110-db/src/main/resources/mapper/user/UserV1ServiceDaoImplMapper.xml |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/user/UserV1ServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/user/UserV1ServiceDaoImplMapper.xml
index 1722ced..e1680b6 100644
--- a/java110-db/src/main/resources/mapper/user/UserV1ServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/user/UserV1ServiceDaoImplMapper.xml
@@ -163,24 +163,43 @@
     </select>
 
     <select id="queryStaffsNoInOrgCount" parameterType="Map" resultType="Map">
-        select count(1) count
+        select count(DISTINCT t.user_id) count
         from u_user t
         inner join s_store_user su on t.user_id = su.user_id and su.status_cd = '0'
         LEFT JOIN u_org_staff_rel osr on su.user_id = osr.staff_id and osr.status_cd = '0'
         where t.level_cd = '01'
         and su.store_id = #{storeId}
         and (osr.org_id != #{orgId} or osr.org_id is null)
+        <if test="staffName !=null and staffName != ''">
+            and t.name like concat('%', #{staffName},'%')
+        </if>
+        <if test="orgIds != null and orgIds.length > 0">
+            and osr.org_id in
+            <foreach collection="orgIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+
     </select>
 
     <select id="queryStaffsNoInOrg" parameterType="Map" resultType="Map">
-        select t.address,t.sex,t.status_cd,t.status_cd statusCd,t.user_id,t.user_id userId,t.level_cd,t.level_cd
-        levelCd,t.location_cd,t.location_cd locationCd,t.score,t.password,t.name,t.tel,t.b_id,t.b_id bId,t.email,t.age
+        select DISTINCT t.address,t.sex,t.status_cd,t.status_cd statusCd,t.user_id,t.user_id userId,t.level_cd,t.level_cd
+        levelCd,t.location_cd,t.location_cd locationCd,t.score,t.name,t.tel,t.b_id,t.b_id bId,t.email,t.age,t.create_time
         from u_user t
         inner join s_store_user su on t.user_id = su.user_id and su.status_cd = '0'
         LEFT JOIN u_org_staff_rel osr on su.user_id = osr.staff_id and osr.status_cd = '0'
         where t.level_cd = '01'
         and su.store_id = #{storeId}
         and (osr.org_id != #{orgId} or osr.org_id is null)
+        <if test="staffName !=null and staffName != ''">
+            and t.name like concat('%', #{staffName},'%')
+        </if>
+        <if test="orgIds != null and orgIds.length > 0">
+            and osr.org_id in
+            <foreach collection="orgIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         order by t.create_time desc
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}

--
Gitblit v1.8.0