From 5bd79abfedcfb1cc4bfe06e2d68456e410f73cb9 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期日, 26 四月 2020 23:09:49 +0800
Subject: [PATCH] 优化员工公司显示

---
 java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml |  103 +++++++++++++++++++++++++++++----------------------
 1 files changed, 59 insertions(+), 44 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml
index 5b26193..9cf24d3 100644
--- a/java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml
@@ -74,33 +74,34 @@
     </insert>
     <!-- 鍒犻櫎瀹炰緥瀹㈡埛淇℃伅 cust -->
     <update id="deleteDataToCustAttr" parameterType="com.java110.entity.user.CustAttr">
-           delete * from cust_attr ct where 1=1
-           <if test="custId != null and custId != ''">
-               and ct.custId = #{custId}
-           </if>
-            <if test="attrCd != null and attrCd != ''">
-                and ct.attrCd = #{attrCd}
-            </if>
+        delete * from cust_attr ct where 1=1
+        <if test="custId != null and custId != ''">
+            and ct.custId = #{custId}
+        </if>
+        <if test="attrCd != null and attrCd != ''">
+            and ct.attrCd = #{attrCd}
+        </if>
     </update>
     <!--鏍规嵁瀹㈡埛ID 鏌ヨ瀹㈡埛淇℃伅锛屽叾涓寘鎷� cust 鍜宑ustAttr 鏁版嵁-->
     <select id="queryDataToCust" parameterType="com.java110.entity.user.Cust" resultMap="custMap">
 
-            select c.custId,c.name,c.email,c.cellphone,c.realName,c.sex,c.password,c.lanId,c.custAdress,c.custType,c.openId,
-            ca.custId,ca.attrCd,ca.value
-             from cust c, cust_attr ca where c.custId= ca.custId
+        select c.custId,c.name,c.email,c.cellphone,c.realName,c.sex,c.password,c.lanId,c.custAdress,c.custType,c.openId,
+        ca.custId,ca.attrCd,ca.value
+        from cust c, cust_attr ca where c.custId= ca.custId
         <if test="custId != null and custId != ''">
             and c.custId = #{custId}
         </if>
         <if test="versionId != null and versionId != ''">
             and c.versionId = #{versionId}
         </if>
-            and c.status_cd = '0'
+        and c.status_cd = '0'
 
     </select>
 
     <!-- 鏌ヨ瀹㈡埛杩囩▼鏁版嵁 -->
     <select id="queryBoCust" parameterType="com.java110.entity.user.BoCust" resultType="com.java110.entity.user.BoCust">
-        select bc.boId,bc.custId,bc.name,bc.email,bc.cellphone,bc.realName,bc.sex,bc.password,bc.lanId,bc.custAdress,bc.custType,bc.openId,bc.create_dt
+        select
+        bc.boId,bc.custId,bc.name,bc.email,bc.cellphone,bc.realName,bc.sex,bc.password,bc.lanId,bc.custAdress,bc.custType,bc.openId,bc.create_dt
         from bo_cust bc where 1=1
         <if test="boId != null and boId != ''">
             and bc.boId = #{boId}
@@ -117,7 +118,8 @@
         </if>
     </select>
     <!-- 鏌ヨ瀹㈡埛灞炴�ц繃绋嬭〃-->
-    <select id="queryBoCustAttr" parameterType="com.java110.entity.user.BoCustAttr" resultType="com.java110.entity.user.BoCustAttr">
+    <select id="queryBoCustAttr" parameterType="com.java110.entity.user.BoCustAttr"
+            resultType="com.java110.entity.user.BoCustAttr">
         select bca.boId,bca.custId,bca.attrCd,bca.value,bca.state,bca.create_dt from bo_cust_attr bca where 1=1
         <if test="boId !=null and boId != ''">
             and bca.boId = #{boId}
@@ -134,7 +136,8 @@
     </select>
 
     <!-- 鏌ヨ瀹㈡埛灞炴�т俊鎭� -->
-    <select id="queryDataToCustAttr" parameterType="com.java110.entity.user.CustAttr" resultType="com.java110.entity.user.CustAttr">
+    <select id="queryDataToCustAttr" parameterType="com.java110.entity.user.CustAttr"
+            resultType="com.java110.entity.user.CustAttr">
         select * from cust_attr ca where 1=1
         <if test="custId != null and custId != ''">
             and ca.custId = #{custId}
@@ -162,12 +165,15 @@
     <!-- 瀹炰緥鏁版嵁 -->
     <insert id="saveUserInfoInstance" parameterType="map">
         insert into u_user(user_id,name,email,address,password,location_cd,age,sex,tel,level_cd,b_id,status_cd)
-        select bu.user_id,bu.name,bu.email,bu.address,bu.password,bu.location_cd,bu.age,bu.sex,bu.tel,bu.level_cd,bu.b_id,'0' from business_user bu where bu.operate = 'ADD' and bu.b_id=#{b_id}
+        select
+        bu.user_id,bu.name,bu.email,bu.address,bu.password,bu.location_cd,bu.age,bu.sex,bu.tel,bu.level_cd,bu.b_id,'0'
+        from business_user bu where bu.operate = 'ADD' and bu.b_id=#{b_id}
     </insert>
 
     <insert id="saveUserAttrInstance" parameterType="map">
         insert into u_user_attr(attr_id,user_id,spec_cd,value,b_id,status_cd)
-        select bua.attr_id,bua.user_id,bua.spec_cd,bua.value,bua.b_id,'0' from business_user_attr bua where bua.operate='ADD' and bua.b_id=#{b_id}
+        select bua.attr_id,bua.user_id,bua.spec_cd,bua.value,bua.b_id,'0' from business_user_attr bua where
+        bua.operate='ADD' and bua.b_id=#{b_id}
     </insert>
 
     <update id="updateUserInfoInstance" parameterType="map">
@@ -222,14 +228,13 @@
     </update>
 
 
-
     <!-- 鏌ヨ鐢ㄦ埛淇℃伅 Business -->
     <select id="queryBusinessUserInfo" parameterType="map" resultType="map">
         select u.user_id,u.name,u.email,u.address,u.password,u.location_cd,
         u.age,u.sex,u.tel,u.level_cd,u.b_id,u.operate
         from business_user u where 1 = 1
         <if test="operate != null and operate != ''">
-           and u.operate = #{operate}
+            and u.operate = #{operate}
         </if>
         <if test="bId != null and bId !=''">
             and u.b_id = #{bId}
@@ -259,7 +264,8 @@
 
     <!-- 鏌ヨ鐢ㄦ埛淇℃伅 -->
     <select id="queryUserInfo" 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,
+        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
         from u_user u where 1= 1
         <if test="bId != null and bId !=''">
@@ -273,12 +279,11 @@
         </if>
         <if test="userIds != null and userIds != null">
             and u.user_id in
-                <foreach collection="userIds" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
+            <foreach collection="userIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
         </if>
     </select>
-
 
 
     <!-- 鏌ヨ鐢ㄦ埛灞炴�т俊鎭� -->
@@ -388,7 +393,6 @@
     </update>
 
 
-
     <!--淇濆瓨鐢ㄦ埛璇佷欢淇℃伅 add by wuxw 2018-06-29 -->
     <insert id="saveBusinessUserCredentials" parameterType="map">
         insert into business_user_credentials(credentials_id,b_id,user_id,credentials_cd,value,operate)
@@ -437,19 +441,23 @@
     <select id="getStaffCount" parameterType="Map" resultType="Map">
         select count(1) count
         from
-             u_user a
+            u_user u
             ,u_org uo
             ,u_org_staff_rel uosr
-        where a.level_cd = '01'
-            and a.user_id = uosr.staff_id
+            ,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}
         </if>
-            and a.status_cd = '0'
-            and uo.status_cd = '0'
-            and uosr.status_cd = '0'
+        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>
@@ -469,22 +477,27 @@
 
     <!-- 鏌ヨ鍛樺伐鎬婚噺 -->
     <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
+        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
-            where u.level_cd = '01'
-            and u.user_id = uosr.staff_id
-            and uosr.store_id = #{storeId}
-            and uosr.org_id = uo.org_id
+        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}
         </if>
-            and u.status_cd = '0'
-            and uo.status_cd = '0'
-            and uosr.status_cd = '0'
+        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,7 +521,8 @@
 
     <!-- 鏌ヨ鐢ㄦ埛 -->
     <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,
+        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
         from u_user u
         <if test="openId != null and openId !=''">
@@ -575,7 +589,8 @@
 
     <!-- 鏌ヨ鐢ㄦ埛瀵嗙爜 -->
     <select id="getUserHasPwd" 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,
+        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 levelCd,u.b_id,u.password
         from u_user u
         <if test="openId != null and openId !=''">

--
Gitblit v1.8.0