From b7df6735bcb2d447cae7fcfba2d12accf3dd2fcc Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Sat, 03 Feb 2024 17:27:21 +0800
Subject: [PATCH] 消防检查优化

---
 src/main/java/org/springblade/modules/system/mapper/UserMapper.xml |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
index 9a570ac..a3e9195 100644
--- a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -201,19 +201,31 @@
         where bu.is_deleted = 0 and bud.id is null
         and bu.dept_id!=''
     </select>
+    <select id="getUserListByDeptIds" resultType="org.springblade.modules.system.entity.User">
+        SELECT * FROM blade_user bu where is_deleted = 0
+        and dept_id in
+        <foreach collection="deptIds.split(',')" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </select>
 
     <select id="getUserInfoByPropertyId" resultType="org.springblade.modules.system.entity.User"
             parameterType="java.lang.String">
-                SELECT * from blade_user bu  where bu.dept_id in (
-        SELECT
+            SELECT
+            *
+            FROM
+            blade_user bu
+            WHERE
+            bu.role_id = #{roleId}
+            and bu.dept_id IN (
+            SELECT
             id
-        FROM
+            FROM
             ( SELECT id, parent_id FROM blade_dept ORDER BY parent_id, id ) org_query,
-            ( SELECT @id := #{deptId} ) initialisation
-        WHERE
-            FIND_IN_SET( parent_id, @id ) > 0
-            AND @id := CONCAT( @id, ',', id )
-        ) or bu.dept_id=#{deptId}
+            (SELECT	@id := #{deptId} ) initialisation
+            WHERE
+            FIND_IN_SET( parent_id, @id ) > 0 AND @id := CONCAT( @id, ',', id )
+            )
 
     </select>
 

--
Gitblit v1.9.3