From 73d958e6fc5c3cc3a74446b6cead4e3e8806ba84 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Fri, 07 May 2021 14:59:07 +0800
Subject: [PATCH] 保安筛选逻辑调整

---
 blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.xml |   43 ++++++++++++++++++++++++++-----------------
 1 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.xml b/blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.xml
index ad66bd4..3bede8c 100644
--- a/blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.xml
+++ b/blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.xml
@@ -55,6 +55,7 @@
         <result column="work_status" property="work_status"/>
         <result column="jd" property="jd"/>
         <result column="wd" property="wd"/>
+        <result column="dept_name" property="deptName"/>
     </resultMap>
 
     <select id="selectUserPage" resultMap="userResultMap">
@@ -96,24 +97,21 @@
         LEFT JOIN jfpt.sys_position p ON p.snumber = s.CODE
         LEFT JOIN jfpt.sys_enclosure e ON e.anumber = s.CODE
 
-        where is_deleted = 0
-        <if test="tenantId!=null and tenantId != ''">
-            and tenant_id = #{tenantId}
-        </if>
-        <if test="user.tenantId!=null and user.tenantId != ''">
-            and tenant_id = #{user.tenantId}
-        </if>
+        where s.is_deleted = 0
         <if test="user.account!=null and user.account != ''">
-            and account = #{user.account}
+            and s.account = #{user.account}
+        </if>
+        <if test="user.id!=null and user.id != ''">
+            and s.id = #{user.id}
         </if>
         <if test="user.realName!=null and user.realName != ''">
-            and real_name = #{user.realName}
+            and s.real_name = #{user.realName}
         </if>
         <if test="user.userType!=null and user.userType != ''">
-            and user_type = #{user.userType}
+            and s.user_type = #{user.userType}
         </if>
         <if test="deptIdList!=null and deptIdList.size>0">
-            and id in (
+            and s.id in (
             SELECT
             user_id
             FROM
@@ -142,14 +140,25 @@
     </select>
 
     <!--查询处警人员列表-->
-    <select id="selectSecurityUserPageList" resultType="org.springblade.system.user.vo.UsersVo">
-        SELECT bu.*,p.jd,p.wd FROM blade_user bu
-            LEFT JOIN
+    <select id="selectSecurityUserPageList" resultMap="userResultMaps">
+        SELECT bu.id,bu.name,bu.code,bu.real_name,bu.account,
+            bu.email,bu.phone,bu.birthday,bu.create_time,
+            bu.sex,ifnull(bu.online_status,0) online_status,
+        bd.dept_name,p.jd,p.wd FROM blade_user bu
+        LEFT JOIN
         jfpt.sys_position p
-            on
+        on
         p.snumber=bu.code
-            where
-        role_id = #{user.roleId}
+        left join
+        blade_dept bd
+        on
+        bd.id=bu.dept_id
+        left join
+        blade_role br
+        on
+        bu.role_id=br.id
+        where
+        br.role_alias ='处警员'
         <if test="user.realName!=null and user.realName !=''">
             <bind name="realName" value="'%'+user.realName+'%'"/>
             and bu.real_name like #{realName}

--
Gitblit v1.9.3