Compare commits

...

2 Commits

Author SHA1 Message Date
ed9d500e5d fix(system): 修正超级管理员标识及关联查询逻辑
- 将 TenantMapper.xml 中用户表连接更新为使用 gxwebsoft_core.sys_user
- 修改关联查询条件,使用 is_super_admin 替代 is_admin 标识
- 调整 User 实体中 isSuperAdmin 字段,移除@TableField注解以确保正确映射
2026-04-27 09:07:16 +08:00
64e9674d0e refactor(database): 优化租户相关SQL查询逻辑
- 移除嵌套子查询,改用子查询中取最小user_id方式关联管理员用户
- 简化管理员用户相关字段的查询逻辑,提升SQL可读性
- 直接关联sys_user表替代以前复杂多层嵌套结构
- 保持查询结果字段一致,避免影响现有功能使用
2026-04-27 07:26:47 +08:00
2 changed files with 1 additions and 6 deletions

View File

@@ -197,7 +197,6 @@ public class User implements UserDetails {
private Integer isOrganizationAdmin; private Integer isOrganizationAdmin;
@Schema(description = "是否超级管理员") @Schema(description = "是否超级管理员")
@TableField(exist = false)
private Boolean isSuperAdmin; private Boolean isSuperAdmin;
@Schema(description = "租户管理员ID") @Schema(description = "租户管理员ID")

View File

@@ -8,11 +8,7 @@
u.phone,u.username u.phone,u.username
FROM sys_tenant a FROM sys_tenant a
LEFT JOIN sys_company b ON a.tenant_id = b.tenant_id LEFT JOIN sys_company b ON a.tenant_id = b.tenant_id
LEFT JOIN sys_user u ON u.tenant_id = a.tenant_id AND u.is_admin = 1 LEFT JOIN gxwebsoft_core.sys_user u ON u.tenant_id = a.tenant_id AND u.is_super_admin = 1 AND u.deleted = 0
AND u.user_id = (
SELECT MIN(user_id) FROM sys_user
WHERE tenant_id = a.tenant_id AND is_admin = 1 AND deleted = 0
)
<where> <where>
<if test="param.tenantId != null"> <if test="param.tenantId != null">
AND a.tenant_id = #{param.tenantId} AND a.tenant_id = #{param.tenantId}