From de09889cb97fcd7e9ae3236d3cb0d9f2f752e439 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Wed, 22 Apr 2026 15:26:30 +0800
Subject: [PATCH] fix: 删除机构异常
---
drone-service/drone-system/src/main/java/org/sxkj/system/mapper/UserMapper.xml | 37 ++++++++++++++++++++++++++++---------
1 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/drone-service/drone-system/src/main/java/org/sxkj/system/mapper/UserMapper.xml b/drone-service/drone-system/src/main/java/org/sxkj/system/mapper/UserMapper.xml
index beac3f5..a732567 100644
--- a/drone-service/drone-system/src/main/java/org/sxkj/system/mapper/UserMapper.xml
+++ b/drone-service/drone-system/src/main/java/org/sxkj/system/mapper/UserMapper.xml
@@ -30,25 +30,35 @@
<!--用户自定义列表查询(不展示 admin 超级管理员账号)-->
<select id="selectUserPage" resultMap="userResultMap">
- select * from blade_user where is_deleted = 0
- and id != 1123598821738675201
+ SELECT
+ u.*,
+ string_agg(r.id::varchar, ',') AS roleId
+ FROM blade_user u
+ INNER JOIN blade_role r
+ ON r.id::varchar = ANY(string_to_array(u.role_id, ','))
+ AND r.is_deleted = 0
+ WHERE u.is_deleted = 0
+ and u.id != 1123598821738675201
<if test="tenantId!=null and tenantId != ''">
- and tenant_id = #{tenantId}
+ and u.tenant_id = #{tenantId}
</if>
<if test="user.tenantId!=null and user.tenantId != ''">
- and tenant_id = #{user.tenantId}
+ and u.tenant_id = #{user.tenantId}
</if>
<if test="user.account!=null and user.account != ''">
- and account = #{user.account}
+ and u.account like CONCAT('%', #{user.account}, '%')
</if>
<if test="user.realName!=null and user.realName != ''">
- and real_name = #{user.realName}
+ and u.real_name like CONCAT('%', #{user.realName}, '%')
</if>
<if test="user.userType!=null and user.userType != ''">
- and user_type = #{user.userType}
+ and u.user_type = #{user.userType}
+ </if>
+ <if test="user.sysType!=null and user.sysType != ''">
+ and (u.sys_type = #{user.sysType} or u.sys_type = '0')
</if>
<if test="deptIdList!=null and deptIdList.size>0">
- and id in (
+ and u.id in (
SELECT
user_id
FROM
@@ -60,7 +70,8 @@
</foreach>
)
</if>
- ORDER BY id
+ GROUP BY u.id
+ ORDER BY u.id
</select>
<select id="getUser" resultMap="userResultMap">
@@ -86,4 +97,12 @@
</foreach>
</update>
+ <!-- 根据部门ID查询用户列表 -->
+ <select id="selectUsersByDeptId" resultMap="userResultMap">
+ SELECT *
+ FROM blade_user
+ WHERE dept_id = #{deptId}
+ AND is_deleted = 0
+ </select>
+
</mapper>
--
Gitblit v1.9.3