Commit c29d74e4 by 丁伟峰

Merge branch 'feature-dingwf-0715' into develop

2 parents 786e0b3d b6579940
......@@ -14,4 +14,6 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
List<EngineerInfoEntity> findByGroupId(String groupId);
List<EngineerInfoEntity> findByGroupIdIn(List<String> groupIds);
List<EngineerInfoEntity> findByEngineerCodeIn(List<String> engineerCodes);
}
......@@ -112,18 +112,28 @@ public class OrganizationServiceImpl implements OrganizationService {
@Override
public Result<?> getEngineersByLevel(String levelType, String levelValue) {
List<EngineerInfoEntity> engineers = null;
assert "group".equals(levelType) || "branch".equals(levelType) || "cluster".equals(levelType);
if ("group".equals(levelType)) {
engineers = engineerInfoDao.findByGroupId(levelType);
} else if ("branch".equals(levelType)) {
List<String> groupIds = orgGroupDao.findAllByBranchId(levelValue).stream()
List<String> groupIds = null;
assert "team".equals(levelType) || "group".equals(levelType) || "branch".equals(levelType) || "cluster".equals(levelType);
switch (levelType) {
case "team":
List<String> engineerCodes = orgTeamEngineerDao.findAllByTeamId(levelValue).stream()
.map(OrgTeamEngineerEntity::getEngineerCode).collect(Collectors.toList());
engineers = engineerInfoDao.findByEngineerCodeIn(engineerCodes);
break;
case "group":
engineers = engineerInfoDao.findByGroupId(levelValue);
break;
case "branch":
groupIds = orgGroupDao.findAllByBranchId(levelValue).stream()
.map(OrgGroupEntity::getGroupId).collect(Collectors.toList());
engineers = engineerInfoDao.findByGroupIdIn(groupIds);
} else {
break;
default:
// "cluster".equals(levelType)
List<String> groupIds = orgGroupDao.findAllByClusterId(levelValue).stream()
groupIds = orgGroupDao.findAllByClusterId(levelValue).stream()
.map(OrgGroupEntity::getGroupId).collect(Collectors.toList());
engineers = engineerInfoDao.findByGroupIdIn(groupIds);
break;
}
List<OrganizationEngineersDTO.Engineer> engineers1 = engineers.stream().map(entity -> {
return new OrganizationEngineersDTO.Engineer()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!