| | |
| | | |
| | | |
| | | @Override |
| | | public List<SgProjectTreeVO> projectTree() { |
| | | List<SgProjectTreeVO> list = sgProjectInfoMapper.projectTree(); |
| | | public List<SgProjectTreeVO> projectTree(ProjectSearchDTO dto) { |
| | | List<SgProjectTreeVO> list = sgProjectInfoMapper.projectTree(dto); |
| | | if (CollectionUtils.isNotEmpty(list)){ |
| | | // 按省、市、县分组 |
| | | Map<String, Map<String, Map<String, List<SgProjectTreeVO>>>> groupedProjects = list.stream() |
| | | .collect(Collectors.groupingBy(SgProjectTreeVO::getProvinceNm, |
| | |
| | | |
| | | SgProjectTreeVO provinceNode = new SgProjectTreeVO(); |
| | | provinceNode.setProvinceNm(province); |
| | | provinceNode.setId(UUID.randomUUID().toString().replace("-","")); |
| | | provinceNode.setRegionName(province); |
| | | provinceNode.setChildList(new ArrayList<>()); |
| | | |
| | | for (Map.Entry<String, Map<String, List<SgProjectTreeVO>>> cityEntry : cityMap.entrySet()) { |
| | |
| | | SgProjectTreeVO cityNode = new SgProjectTreeVO(); |
| | | List<String> cityIds = new ArrayList<>(); |
| | | cityNode.setCityNm(city); |
| | | cityNode.setId(UUID.randomUUID().toString().replace("-","")); |
| | | cityNode.setRegionName(city); |
| | | cityNode.setChildList(new ArrayList<>()); |
| | | |
| | | for (Map.Entry<String, List<SgProjectTreeVO>> countyEntry : countyMap.entrySet()) { |
| | | String county = countyEntry.getKey(); |
| | | List<SgProjectTreeVO> countyProjects = countyEntry.getValue(); |
| | | |
| | | for (SgProjectTreeVO countyProject : countyProjects) { |
| | | countyProject.setRegionName(countyProject.getResNm()); |
| | | } |
| | | SgProjectTreeVO countyNode = new SgProjectTreeVO(); |
| | | countyNode.setCountyNm(county); |
| | | countyNode.setRegionName(county); |
| | | countyNode.setId(UUID.randomUUID().toString().replace("-","")); |
| | | countyNode.setChildList(new ArrayList<>(countyProjects)); |
| | | countyNode.setChildNum((long) countyProjects.size()); |
| | | countyNode.setProjectIds(countyProjects.stream().map(SgProjectTreeVO::getId).collect(Collectors.toList())); |
| | |
| | | result.add(provinceNode); |
| | | } |
| | | return result; |
| | | } |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | } |