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/UserServiceDaoImplMapper.xml |   62 ++++++++++++++++++++++++-------
 1 files changed, 48 insertions(+), 14 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml
index da3de3f..d7c1572 100755
--- a/java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml
@@ -41,8 +41,10 @@
     <insert id="saveDataToBoCust" parameterType="com.java110.entity.user.BoCust">
         <![CDATA[
 
-                    insert into bo_cust(boId,custId,name,email,cellphone,realName,sex,password,lanId,custAdress,custType,openId,state)
-                    values(#{boId},#{custId},#{name},#{email},#{cellphone},#{realName},#{sex},#{password},#{lanId},#{custAdress},#{custType},#{openId},#{state})
+
+                            insert into bo_cust(boId,custId,name,email,cellphone,realName,sex,password,lanId,custAdress,custType,openId,state)
+                            values(#{boId},#{custId},#{name},#{email},#{cellphone},#{realName},#{sex},#{password},#{lanId},#{custAdress},#{custType},#{openId},#{state})
+
 
         ]]>
     </insert>
@@ -50,8 +52,10 @@
     <insert id="saveDataToBoCustAttr" parameterType="com.java110.entity.user.BoCustAttr">
         <![CDATA[
 
-                    insert into bo_cust_attr(boId,custId,attrCd,value,state)
-                    values(#{boId},#{custId},#{attrCd},#{value},#{state})
+
+                            insert into bo_cust_attr(boId,custId,attrCd,value,state)
+                            values(#{boId},#{custId},#{attrCd},#{value},#{state})
+
 
         ]]>
     </insert>
@@ -59,8 +63,10 @@
     <insert id="saveDataToCust" parameterType="com.java110.entity.user.Cust">
         <![CDATA[
 
-                    insert into cust(custId,name,email,cellphone,realName,sex,password,lanId,custAdress,custType,openId,status_cd)
-                    values(#{custId},#{name},#{email},#{cellphone},#{realName},#{sex},#{password},#{lanId},#{custAdress},#{custType},#{openId},#{status_cd})
+
+                            insert into cust(custId,name,email,cellphone,realName,sex,password,lanId,custAdress,custType,openId,status_cd)
+                            values(#{custId},#{name},#{email},#{cellphone},#{realName},#{sex},#{password},#{lanId},#{custAdress},#{custType},#{openId},#{status_cd})
+
 
         ]]>
     </insert>
@@ -68,7 +74,9 @@
     <insert id="deleteDataToCust" parameterType="com.java110.entity.user.Cust">
         <![CDATA[
 
-                   delete * from cust c where c.custId = #{custId}
+
+                           delete * from cust c where c.custId = #{custId}
+
 
         ]]>
     </insert>
@@ -77,8 +85,10 @@
     <insert id="saveDataToCustAttr" parameterType="com.java110.entity.user.CustAttr">
         <![CDATA[
 
-                    insert into cust_attr(custId,attrCd,value,status_cd)
-                    values(#{custId},#{attrCd},#{value},#{status_cd})
+
+                            insert into cust_attr(custId,attrCd,value,status_cd)
+                            values(#{custId},#{attrCd},#{value},#{status_cd})
+
 
         ]]>
     </insert>
@@ -455,10 +465,13 @@
 
     <!-- 鏌ヨ鍛樺伐鎬婚噺 -->
     <select id="getStaffCount" parameterType="Map" resultType="Map">
+        <if test="orgIds != null and orgIds.length > 0">
+        select count(*) count from(
+        </if>
         select count(1) count
         from u_user u
         inner join s_store_user su on su.user_id = u.user_id
-        <if test="orgId !=null and orgId != ''">
+        <if test="(orgId !=null and orgId != '')||(orgIds != null and orgIds.length > 0)">
             left join u_org_staff_rel uosr on u.user_id = uosr.staff_id and uosr.status_cd = '0'
             left join u_org uo on uosr.org_id = uo.org_id and uo.status_cd = '0'
         </if>
@@ -493,6 +506,17 @@
             <foreach collection="userIds" item="item" open="(" close=")" separator=",">
                 #{item}
             </foreach>
+        </if>
+        <if test="orgIds != null and orgIds.length > 0">
+            and uosr.org_id in
+            <foreach collection="orgIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+            and uosr.status_cd =0
+            GROUP BY u.user_id
+        </if>
+        <if test="orgIds != null and orgIds.length > 0">
+            )a
         </if>
     </select>
 
@@ -502,13 +526,13 @@
         userName,u.email,u.address,u.location_cd,u.location_cd locationCd,
         u.age,u.sex,u.tel,u.level_cd levelCd,u.b_id,su.rel_cd relCd,td.name relCdName
         <if test="orgId !=null and orgId != ''">
-            ,uo.org_id orgId,uo.org_name,uo.org_name orgName,uosr.store_id storeId,
+            ,uo.org_id orgId,uo.org_name,uo.org_name orgName,uosr.store_id storeId,uosr.rel_id relId
         </if>
         from
         u_user u
         inner join s_store_user su on su.user_id = u.user_id
-        left join t_dict td on su.rel_cd =  td.status_cd and td.table_name='s_store_user'  and td.table_columns='rel_cd'
-        <if test="orgId !=null and orgId != ''">
+        left join t_dict td on su.rel_cd = td.status_cd and td.table_name='s_store_user' and td.table_columns='rel_cd'
+        <if test="(orgId !=null and orgId != '')||(orgIds != null and orgIds.length > 0)">
             left join u_org_staff_rel uosr on u.user_id = uosr.staff_id and uosr.status_cd = '0'
             left join u_org uo on uosr.org_id = uo.org_id and uo.status_cd = '0'
         </if>
@@ -543,6 +567,15 @@
             <foreach collection="userIds" item="item" open="(" close=")" separator=",">
                 #{item}
             </foreach>
+        </if>
+        <if test="orgIds != null and orgIds.length > 0">
+            and uosr.org_id in
+            <foreach collection="orgIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+            and uosr.status_cd =0
+            GROUP BY u.user_id u.name,u.email,u.address,u.location_cd,
+            u.age,u.sex,u.tel,u.level_cd ,u.b_id,su.rel_cd ,td.name
         </if>
         order by u.create_time desc
         <if test="page != -1 and page != null ">
@@ -566,9 +599,10 @@
             ,u_user_attr ua
         </if>
         where 1= 1
+
         <if test="openId != null and openId != ''">
             and u.user_id = ua.user_id
-            and ua.spec_cd = '100201911001'
+            and ua.spec_cd in ('100201911001','100201911003')
             and ua.value = #{openId}
             and ua.status_cd = '0'
         </if>

--
Gitblit v1.8.0