Commit e7f935bd by huangjinxin

fix:组织树支持多个

1 parent 61fdd5fe
......@@ -43,12 +43,22 @@ public class OrganizationServiceImpl implements OrganizationService {
@Override
public Result<?> getOrganizationTree(String levelType, String levelValue) {
// 如果传递了精确的id,只返回对应的tree内容;如果没有传递,返回所有tree内容
List<OrganizationTreeDTO.Result> rs = new ArrayList<>();
for (String value : levelValue.split(",")) {
rs.add(getOrganizationTreeByOrgId(levelType, value));
}
return Result.success(rs);
}
public OrganizationTreeDTO.Result getOrganizationTreeByOrgId(String levelType, String levelValue) {
// 如果传递了精确的id,只返回对应的tree内容;如果没有传递,返回所有tree内容
OrganizationTreeDTO.Result rs = new OrganizationTreeDTO.Result();
rs.setLevelType(levelType).setLevelValue(levelValue);
if ("group".equals(levelType)) {
OrgGroupEntity orgGroupEntity = orgGroupDao.getByGroupId(levelValue);
if (orgGroupEntity == null) {
return Result.failed("groupId对应的信息不存在");
return null;
}
List<?> groups = new ArrayList<>(Collections.singletonList(groupEntity2Dto(orgGroupEntity)));
OrgBranchEntity orgBranchEntity = orgBranchDao.getByBranchId(orgGroupEntity.getBranchId());
......@@ -59,7 +69,7 @@ public class OrganizationServiceImpl implements OrganizationService {
} else if ("branch".equals(levelType)) {
OrgBranchEntity orgBranchEntity = orgBranchDao.getByBranchId(levelValue);
if (orgBranchEntity == null) {
return Result.failed("分站信息不存在");
return null;
}
OrgClusterEntity orgClusterEntity = orgClusterDao.getByClusterId(orgBranchEntity.getClusterId());
List<?> groups = getChildByBranch(levelValue);
......@@ -69,7 +79,7 @@ public class OrganizationServiceImpl implements OrganizationService {
} else if ("cluster".equals(levelType)) {
OrgClusterEntity orgClusterEntity = orgClusterDao.getByClusterId(levelValue);
if (orgClusterEntity == null) {
return Result.failed("大区信息不存在");
return null;
}
List<?> branchs = getChildByCluster(levelValue);
List<?> clusters = new ArrayList<>(Collections.singletonList(clusterEntity2Dto(orgClusterEntity).setChildren(branchs)));
......@@ -77,7 +87,7 @@ public class OrganizationServiceImpl implements OrganizationService {
} else {
rs.setClusters(getTreeByRoot());
}
return Result.success(rs);
return rs;
}
@Override
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!