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 |  268 ++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 203 insertions(+), 65 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml
old mode 100644
new mode 100755
index 9cf24d3..d7c1572
--- a/java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml
@@ -40,36 +40,56 @@
     <!--淇濆瓨鏁版嵁鑷宠繃绋嬭〃 bo_cust 涓� -->
     <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>
     <!-- 淇濆瓨鏁版嵁鑷宠繃绋嬭〃bo_cust_attr 涓�-->
     <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>
     <!-- 淇濆瓨 瀹炰緥瀹㈡埛淇℃伅 cust -->
     <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>
     <!-- 鍒犻櫎瀹炰緥瀹㈡埛淇℃伅 cust -->
     <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>
 
     <!-- 淇濆瓨 瀹炰緥瀹㈡埛灞炴�т俊鎭� cust_attr -->
     <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>
     <!-- 鍒犻櫎瀹炰緥瀹㈡埛淇℃伅 cust -->
@@ -205,6 +225,9 @@
         <if test="tel !=null and tel != ''">
             ,u.tel= #{tel}
         </if>
+        <if test="score !=null and score != ''">
+            ,u.score= #{score}
+        </if>
         where 1 = 1
         <if test="bId != null and bId != ''">
             and u.b_id = #{bId}
@@ -299,6 +322,9 @@
         </if>
         <if test="attrId != null and attrId != ''">
             and u.attr_id = #{attrId}
+        </if>
+        <if test="specCd != null and specCd != ''">
+            and u.spec_cd = #{specCd}
         </if>
     </select>
 
@@ -439,65 +465,24 @@
 
     <!-- 鏌ヨ鍛樺伐鎬婚噺 -->
     <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
-            ,u_org uo
-            ,u_org_staff_rel uosr
-            ,u_org puo
+        from u_user u
+        inner join s_store_user su on su.user_id = u.user_id
+        <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>
         where u.level_cd = '01'
-            and u.user_id = uosr.staff_id
-            and uosr.store_id = #{storeId}
-            and uosr.org_id = uo.org_id
-            and uo.parent_org_id = puo.org_id
-            and puo.status_cd = '0'
-            and uo.status_cd = '0'
-        <if test="parentOrgId !=null and parentOrgId != ''">
-            and uo.parent_org_id = #{parentOrgId}
-        </if>
-        and a.status_cd = '0'
-        and uo.status_cd = '0'
-        and uosr.status_cd = '0'
-        <if test="tel !=null and tel != ''">
-            and a.tel= #{tel}
-        </if>
-        <if test="name !=null and name != ''">
-            and a.name like concat('%',#{name},'%')
-        </if>
-        <if test="staffName !=null and staffName != ''">
-            and a.name like concat('%',#{staffName},'%')
-        </if>
-        <if test="staffId != null and staffId !=''">
-            and uosr.staff_id = #{staffId}
+        <if test="storeId !=null and storeId != ''">
+            and su.store_id = #{storeId}
         </if>
         <if test="orgId !=null and orgId != ''">
-            and uo.org_id = #{orgId}
-        </if>
-    </select>
-
-    <!-- 鏌ヨ鍛樺伐鎬婚噺 -->
-    <select id="getStaffs" parameterType="Map" resultType="Map">
-        select uo.org_name,uo.org_name orgName,u.user_id, u.user_id userId,u.name,u.name
-        userName,u.email,u.address,u.location_cd,u.location_cd locationCd,
-        u.age,u.sex,u.tel,u.level_cd,u.b_id,puo.org_id parentOrgId,puo.org_name parentOrgName
-        from
-        u_user u
-        ,u_org uo
-        ,u_org_staff_rel uosr
-        ,u_org puo
-        where u.level_cd = '01'
-        and u.user_id = uosr.staff_id
-        and uosr.store_id = #{storeId}
-        and uosr.org_id = uo.org_id
-        and uo.parent_org_id = puo.org_id
-        and puo.status_cd = '0'
-        and uo.status_cd = '0'
-        <if test="parentOrgId !=null and parentOrgId != ''">
-            and uo.parent_org_id = #{parentOrgId}
+            and uosr.org_id = #{orgId}
         </if>
         and u.status_cd = '0'
-        and uo.status_cd = '0'
-        and uosr.status_cd = '0'
         <if test="tel !=null and tel != ''">
             and u.tel= #{tel}
         </if>
@@ -508,10 +493,89 @@
             and u.name like concat('%',#{staffName},'%')
         </if>
         <if test="staffId != null and staffId !=''">
-            and uosr.staff_id = #{staffId}
+            and u.user_id = #{staffId}
         </if>
         <if test="orgId !=null and orgId != ''">
             and uo.org_id = #{orgId}
+        </if>
+        <if test="bId != null and bId !=''">
+            and u.b_id = #{bId}
+        </if>
+        <if test="userIds != null and userIds != null">
+            and u.user_id in
+            <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>
+
+    <!-- 鏌ヨ鍛樺伐鎬婚噺 -->
+    <select id="getStaffs" parameterType="Map" resultType="Map">
+        select u.user_id, u.user_id userId,u.name,u.name
+        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,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 != '')||(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>
+        where u.level_cd = '01'
+        <if test="storeId !=null and storeId != ''">
+            and su.store_id = #{storeId}
+        </if>
+        <if test="orgId !=null and orgId != ''">
+            and uosr.org_id = #{orgId}
+        </if>
+        and u.status_cd = '0'
+        <if test="tel !=null and tel != ''">
+            and u.tel= #{tel}
+        </if>
+        <if test="name !=null and name != ''">
+            and u.name like concat('%',#{name},'%')
+        </if>
+        <if test="staffName !=null and staffName != ''">
+            and u.name like concat('%',#{staffName},'%')
+        </if>
+        <if test="staffId != null and staffId !=''">
+            and u.user_id = #{staffId}
+        </if>
+        <if test="orgId !=null and orgId != ''">
+            and uo.org_id = #{orgId}
+        </if>
+        <if test="bId != null and bId !=''">
+            and u.b_id = #{bId}
+        </if>
+        <if test="userIds != null and userIds != null">
+            and u.user_id in
+            <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 ">
@@ -523,17 +587,36 @@
     <select id="getUsers" parameterType="Map" resultType="Map">
         select u.user_id, u.user_id userId,u.name,u.name
         userName,u.email,u.address,u.password,u.location_cd,u.location_cd locationCd,
-        u.age,u.sex,u.tel,u.level_cd,u.b_id
+        u.age,u.sex,u.tel,u.level_cd,u.b_id,u.level_cd levelCd,u.score
         from u_user u
         <if test="openId != null and openId !=''">
             ,u_user_attr ua
         </if>
+        <if test="key != null and key !=''">
+            ,u_user_attr ub
+        </if>
+        <if test="unionId != null and unionId !=''">
+            ,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>
+        <if test="unionId != null and unionId != ''">
+            and u.user_id = ua.user_id
+            and ua.spec_cd = '100201911002'
+            and ua.value = #{unionId}
+            and ua.status_cd = '0'
+        </if>
+        <if test="key != null and key != ''">
+            and u.user_id = ub.user_id
+            and ub.spec_cd = '100202061602'
+            and ub.value = #{key}
+            and ub.status_cd = '0'
         </if>
         <if test="bId != null and bId !=''">
             and u.b_id = #{bId}
@@ -550,6 +633,43 @@
                 #{item}
             </foreach>
         </if>
+
+        <if test="name !=null and name != ''">
+            and u.name= #{name}
+        </if>
+        <if test="userName !=null and userName != ''">
+            and u.name= #{userName}
+        </if>
+        <if test="email !=null and email != ''">
+            and u.email= #{email}
+        </if>
+        <if test="password !=null and password != ''">
+            and u.password= #{password}
+        </if>
+        <if test="locationCd !=null and locationCd != ''">
+            and u.location_cd= #{locationCd}
+        </if>
+        <if test="age !=null and age != ''">
+            and u.age= #{age}
+        </if>
+        <if test="sex !=null and sex != ''">
+            and u.sex= #{sex}
+        </if>
+        <if test="tel !=null and tel != ''">
+            and u.tel= #{tel}
+        </if>
+        <if test="levelCd !=null and levelCd != ''">
+            and u.level_cd= #{levelCd}
+        </if>
+        <if test="levelCds != null">
+            and u.level_cd in
+            <foreach collection="levelCds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test='userFlag !=null and userFlag =="1"'>
+            and u.level_cd != '02'
+        </if>
         order by u.create_time desc
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
@@ -562,11 +682,20 @@
         <if test="openId != null and openId !=''">
             ,u_user_attr ua
         </if>
+        <if test="unionId != null and unionId !=''">
+            ,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.value = #{openId}
+            and ua.status_cd = '0'
+        </if>
+        <if test="unionId != null and unionId != ''">
+            and u.user_id = ua.user_id
+            and ua.spec_cd = '100201911002'
+            and ua.value = #{unionId}
             and ua.status_cd = '0'
         </if>
         <if test="bId != null and bId !=''">
@@ -596,6 +725,9 @@
         <if test="openId != null and openId !=''">
             ,u_user_attr ua
         </if>
+        <if test="unionId != null and unionId !=''">
+            ,u_user_attr ua
+        </if>
         where 1= 1
         <if test="openId != null and openId != ''">
             and u.user_id = ua.user_id
@@ -603,6 +735,12 @@
             and ua.value = #{openId}
             and ua.status_cd = '0'
         </if>
+        <if test="unionId != null and unionId != ''">
+            and u.user_id = ua.user_id
+            and ua.spec_cd = '100201911002'
+            and ua.value = #{unionId}
+            and ua.status_cd = '0'
+        </if>
         <if test="bId != null and bId !=''">
             and u.b_id = #{bId}
         </if>

--
Gitblit v1.8.0