From 5362be8ad634377ce6b1c5b7a25861d3920fe771 Mon Sep 17 00:00:00 2001 From: Parker Date: Tue, 16 Nov 2021 21:13:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=9C=BA=E6=9E=84=E7=9B=B8=E5=85=B3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 新增、修改组织机构清理当前用户组织树缓存 2. setOrg 方法取出没必要的 id去重 3. 超级管理员只查看自己的数据 4. 组织机构不可删除BUG --- .../main/java/org/opsli/core/utils/UserUtil.java | 4 ++-- .../modulars/system/org/mapper/xml/SysOrgMapper.xml | 3 ++- .../system/org/service/impl/SysOrgServiceImpl.java | 13 ++++++++++++- .../system/role/web/RoleRestController.java | 7 ------- .../user/service/impl/UserOrgRefServiceImpl.java | 4 ---- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/opsli-base-support/opsli-core/src/main/java/org/opsli/core/utils/UserUtil.java b/opsli-base-support/opsli-core/src/main/java/org/opsli/core/utils/UserUtil.java index 848bb25..83bae12 100644 --- a/opsli-base-support/opsli-core/src/main/java/org/opsli/core/utils/UserUtil.java +++ b/opsli-base-support/opsli-core/src/main/java/org/opsli/core/utils/UserUtil.java @@ -982,9 +982,9 @@ public class UserUtil { UserModel user = getUser(); - // 如果是超级管理员 则不进行租户处理 + // 如果是超级管理员 则不进行租户处理 默认为0 if(StringUtils.equals(SUPER_ADMIN, user.getUsername())){ - return null; + return "0"; } return user.getTenantId(); } diff --git a/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/org/mapper/xml/SysOrgMapper.xml b/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/org/mapper/xml/SysOrgMapper.xml index 4e7f7d6..585d9e4 100644 --- a/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/org/mapper/xml/SysOrgMapper.xml +++ b/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/org/mapper/xml/SysOrgMapper.xml @@ -15,7 +15,8 @@ select count(0) from - sys_user_org_ref + sys_user_org_ref ref + left join sys_user u on u.id = ref.user_id ${ew.customSqlSegment} diff --git a/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/org/service/impl/SysOrgServiceImpl.java b/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/org/service/impl/SysOrgServiceImpl.java index bfd4734..f044d7a 100644 --- a/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/org/service/impl/SysOrgServiceImpl.java +++ b/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/org/service/impl/SysOrgServiceImpl.java @@ -32,6 +32,7 @@ import org.opsli.core.base.service.impl.CrudServiceImpl; import org.opsli.core.persistence.querybuilder.GenQueryBuilder; import org.opsli.core.persistence.querybuilder.QueryBuilder; import org.opsli.core.persistence.querybuilder.chain.QueryTenantHandler; +import org.opsli.core.utils.UserUtil; import org.opsli.modulars.system.SystemMsg; import org.opsli.modulars.system.org.entity.SysOrg; import org.opsli.modulars.system.org.mapper.SysOrgMapper; @@ -101,6 +102,11 @@ public class SysOrgServiceImpl extends CrudServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.in("org_id", + queryWrapper.eq("u.deleted", DictType.NO_YES_NO.getValue()); + queryWrapper.in("ref.org_id", orgIdList ); Integer count = mapper.hasUse(queryWrapper); diff --git a/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/role/web/RoleRestController.java b/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/role/web/RoleRestController.java index 61cbc6f..eebfa70 100644 --- a/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/role/web/RoleRestController.java +++ b/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/role/web/RoleRestController.java @@ -96,13 +96,6 @@ public class RoleRestController extends BaseRestController queryBuilder = new WebQueryBuilder<>(entityClazz, request.getParameterMap()); QueryWrapper wrapper = queryBuilder.build(); - UserModel user = UserUtil.getUser(); - // 如果是超级管理员 则查询为空的角色 - if(StringUtils.equals(UserUtil.SUPER_ADMIN, user.getUsername())){ - // 角色分页 增加租户权限 - wrapper.isNull(FieldUtil.humpToUnderline(MyBatisConstants.FIELD_TENANT)); - } - Page page = new Page<>(pageNo, pageSize); page.setQueryWrapper(wrapper); page = IService.findPage(page); diff --git a/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/user/service/impl/UserOrgRefServiceImpl.java b/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/user/service/impl/UserOrgRefServiceImpl.java index 92589c6..0ceb70f 100644 --- a/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/user/service/impl/UserOrgRefServiceImpl.java +++ b/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/user/service/impl/UserOrgRefServiceImpl.java @@ -149,10 +149,6 @@ public class UserOrgRefServiceImpl extends ServiceImpl