Commit 42beab18 by levphon

bug修复

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