Commit 42beab18 by levphon

bug修复

1 parent 958ab538
...@@ -124,17 +124,11 @@ public class AllStrategy extends PermissionStrategy { ...@@ -124,17 +124,11 @@ public class AllStrategy extends PermissionStrategy {
if (CollectionUtils.isNotEmpty(search.getSubOrgIds())) { if (CollectionUtils.isNotEmpty(search.getSubOrgIds())) {
Map<Long, Set<Long>> subOrgIdListMap = getSubIdsMap(search.getSubOrgIds()); Map<Long, Set<Long>> subOrgIdListMap = getSubIdsMap(search.getSubOrgIds());
Collection<Long> finalOrgIds = orgIds;
//选中的节点及下级节点 //选中的节点及下级节点
Set<Long> selectSubOrgIds = Sets.newHashSet(); Set<Long> selectSubOrgIds = Sets.newHashSet();
for (Map.Entry<Long, Set<Long>> entry : subOrgIdListMap.entrySet()) { for (Map.Entry<Long, Set<Long>> entry : subOrgIdListMap.entrySet()) {
Set<Long> subOrgIds = entry.getValue().stream().filter(finalOrgIds::contains).collect(Collectors.toSet()); selectSubOrgIds.addAll(entry.getValue());
if (orgIds.contains(entry.getKey())) {
subOrgIds.add(entry.getKey());
}
selectSubOrgIds.addAll(subOrgIds);
} }
orgIds = selectSubOrgIds; orgIds = selectSubOrgIds;
...@@ -145,6 +139,15 @@ public class AllStrategy extends PermissionStrategy { ...@@ -145,6 +139,15 @@ public class AllStrategy extends PermissionStrategy {
orgIds = this.getUserOrgSuperiorIds(search.getUserIds()); orgIds = this.getUserOrgSuperiorIds(search.getUserIds());
} }
//如果有查询条件,如果没有过滤到需要查询的组织链,返回空数据
if ((StringUtils.isNotEmpty(search.getOrgName())
|| CollectionUtils.isNotEmpty(search.getOrgIds())
|| CollectionUtils.isNotEmpty(search.getSupOrgIds())
|| CollectionUtils.isNotEmpty(search.getSubOrgIds())
|| CollectionUtils.isNotEmpty(search.getUserIds())) && CollectionUtils.isEmpty(orgIds)) {
return Lists.newArrayList();
}
search.setOrgIds(orgIds); search.setOrgIds(orgIds);
List<OrgModel> modelList = organizationMapper.selectOrgList(search); List<OrgModel> modelList = organizationMapper.selectOrgList(search);
......
...@@ -127,17 +127,11 @@ public class AssignTenantStrategy extends PermissionStrategy { ...@@ -127,17 +127,11 @@ public class AssignTenantStrategy extends PermissionStrategy {
if (CollectionUtils.isNotEmpty(search.getSubOrgIds())) { if (CollectionUtils.isNotEmpty(search.getSubOrgIds())) {
Map<Long, Set<Long>> subOrgIdListMap = getSubIdsMap(search.getSubOrgIds()); Map<Long, Set<Long>> subOrgIdListMap = getSubIdsMap(search.getSubOrgIds());
Collection<Long> finalOrgIds = orgIds;
//选中的节点及下级节点 //选中的节点及下级节点
Set<Long> selectSubOrgIds = Sets.newHashSet(); Set<Long> selectSubOrgIds = Sets.newHashSet();
for (Map.Entry<Long, Set<Long>> entry : subOrgIdListMap.entrySet()) { for (Map.Entry<Long, Set<Long>> entry : subOrgIdListMap.entrySet()) {
Set<Long> subOrgIds = entry.getValue().stream().filter(finalOrgIds::contains).collect(Collectors.toSet()); selectSubOrgIds.addAll(entry.getValue());
if (orgIds.contains(entry.getKey())) {
subOrgIds.add(entry.getKey());
}
selectSubOrgIds.addAll(subOrgIds);
} }
orgIds = selectSubOrgIds; orgIds = selectSubOrgIds;
...@@ -152,16 +146,26 @@ public class AssignTenantStrategy extends PermissionStrategy { ...@@ -152,16 +146,26 @@ public class AssignTenantStrategy extends PermissionStrategy {
List<Tenant> tenantList = departmentService.getRolePermissionTenants(); List<Tenant> tenantList = departmentService.getRolePermissionTenants();
Set<Long> tenantIds = tenantList.stream().map(Tenant::getId).collect(Collectors.toSet()); Set<Long> tenantIds = tenantList.stream().map(Tenant::getId).collect(Collectors.toSet());
//如果指定租户没有,返回空数据
if (CollectionUtils.isEmpty(tenantIds)) {
return Lists.newArrayList();
}
//如果有查询条件,如果没有过滤到需要查询的组织链,返回空数据
if ((StringUtils.isNotEmpty(search.getOrgName())
|| CollectionUtils.isNotEmpty(search.getOrgIds())
|| CollectionUtils.isNotEmpty(search.getSupOrgIds())
|| CollectionUtils.isNotEmpty(search.getSubOrgIds())
|| CollectionUtils.isNotEmpty(search.getUserIds())) && CollectionUtils.isEmpty(orgIds)) {
return Lists.newArrayList();
}
//指定数据权限租户 //指定数据权限租户
search.setTenantIds(tenantIds); search.setTenantIds(tenantIds);
//过滤出的组织 //过滤出的组织
search.setOrgIds(orgIds); search.setOrgIds(orgIds);
//如果没有过滤到需要查询的组织链,返回空数据
if (CollectionUtils.isEmpty(orgIds) && CollectionUtils.isEmpty(tenantIds)) {
return Lists.newArrayList();
}
List<OrgModel> modelList = organizationMapper.selectOrgList(search); List<OrgModel> modelList = organizationMapper.selectOrgList(search);
List<Long> departmentIdList = modelList.stream().map(OrgModel::getOrgId).collect(Collectors.toList()); List<Long> departmentIdList = modelList.stream().map(OrgModel::getOrgId).collect(Collectors.toList());
......
...@@ -136,17 +136,11 @@ public class SelfDepartmentStrategy extends PermissionStrategy { ...@@ -136,17 +136,11 @@ public class SelfDepartmentStrategy extends PermissionStrategy {
if (CollectionUtils.isNotEmpty(search.getSubOrgIds())) { if (CollectionUtils.isNotEmpty(search.getSubOrgIds())) {
Map<Long, Set<Long>> subOrgIdListMap = getSubIdsMap(search.getSubOrgIds()); Map<Long, Set<Long>> subOrgIdListMap = getSubIdsMap(search.getSubOrgIds());
Collection<Long> finalOrgIds = orgIds;
//选中的节点及下级节点 //选中的节点及下级节点
Set<Long> selectSubOrgIds = Sets.newHashSet(); Set<Long> selectSubOrgIds = Sets.newHashSet();
for (Map.Entry<Long, Set<Long>> entry : subOrgIdListMap.entrySet()) { for (Map.Entry<Long, Set<Long>> entry : subOrgIdListMap.entrySet()) {
Set<Long> subOrgIds = entry.getValue().stream().filter(finalOrgIds::contains).collect(Collectors.toSet()); selectSubOrgIds.addAll(entry.getValue());
if (orgIds.contains(entry.getKey())) {
subOrgIds.add(entry.getKey());
}
selectSubOrgIds.addAll(subOrgIds);
} }
orgIds = selectSubOrgIds; orgIds = selectSubOrgIds;
...@@ -157,8 +151,12 @@ public class SelfDepartmentStrategy extends PermissionStrategy { ...@@ -157,8 +151,12 @@ public class SelfDepartmentStrategy extends PermissionStrategy {
orgIds = this.getUserOrgSuperiorIds(search.getUserIds()); orgIds = this.getUserOrgSuperiorIds(search.getUserIds());
} }
//如果没有过滤到需要查询的组织链,返回空数据 //如果有查询条件,如果没有过滤到需要查询的组织链,返回空数据
if (CollectionUtils.isEmpty(orgIds)) { if ((StringUtils.isNotEmpty(search.getOrgName())
|| CollectionUtils.isNotEmpty(search.getOrgIds())
|| CollectionUtils.isNotEmpty(search.getSupOrgIds())
|| CollectionUtils.isNotEmpty(search.getSubOrgIds())
|| CollectionUtils.isNotEmpty(search.getUserIds())) && CollectionUtils.isEmpty(orgIds)) {
return Lists.newArrayList(); return Lists.newArrayList();
} }
......
...@@ -192,17 +192,11 @@ public class SubDepartmentStrategy extends PermissionStrategy { ...@@ -192,17 +192,11 @@ public class SubDepartmentStrategy extends PermissionStrategy {
if (CollectionUtils.isNotEmpty(search.getSubOrgIds())) { if (CollectionUtils.isNotEmpty(search.getSubOrgIds())) {
Map<Long, Set<Long>> subOrgIdListMap = getSubIdsMap(search.getSubOrgIds()); Map<Long, Set<Long>> subOrgIdListMap = getSubIdsMap(search.getSubOrgIds());
Collection<Long> finalOrgIds = orgIds;
//选中的节点及下级节点 //选中的节点及下级节点
Set<Long> selectSubOrgIds = Sets.newHashSet(); Set<Long> selectSubOrgIds = Sets.newHashSet();
for (Map.Entry<Long, Set<Long>> entry : subOrgIdListMap.entrySet()) { for (Map.Entry<Long, Set<Long>> entry : subOrgIdListMap.entrySet()) {
Set<Long> subOrgIds = entry.getValue().stream().filter(finalOrgIds::contains).collect(Collectors.toSet()); selectSubOrgIds.addAll(entry.getValue());
if (orgIds.contains(entry.getKey())) {
subOrgIds.add(entry.getKey());
}
selectSubOrgIds.addAll(subOrgIds);
} }
orgIds = selectSubOrgIds; orgIds = selectSubOrgIds;
...@@ -213,8 +207,12 @@ public class SubDepartmentStrategy extends PermissionStrategy { ...@@ -213,8 +207,12 @@ public class SubDepartmentStrategy extends PermissionStrategy {
orgIds = this.getUserOrgSuperiorIds(search.getUserIds()); orgIds = this.getUserOrgSuperiorIds(search.getUserIds());
} }
//如果没有过滤到需要查询的组织链,返回空数据 //如果有查询条件,如果没有过滤到需要查询的组织链,返回空数据
if (CollectionUtils.isEmpty(orgIds)) { if ((StringUtils.isNotEmpty(search.getOrgName())
|| CollectionUtils.isNotEmpty(search.getOrgIds())
|| CollectionUtils.isNotEmpty(search.getSupOrgIds())
|| CollectionUtils.isNotEmpty(search.getSubOrgIds())
|| CollectionUtils.isNotEmpty(search.getUserIds())) && CollectionUtils.isEmpty(orgIds)) {
return Lists.newArrayList(); return Lists.newArrayList();
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!