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