|
@@ -38,15 +38,18 @@ public class AreaApiService implements AreaApi {
|
|
|
@RequestMapping("/getProvinces")
|
|
|
public List<AreaInfo> getProvinces() {
|
|
|
|
|
|
- QueryWrapper<SysRegion> qw = new QueryWrapper();
|
|
|
- qw.eq("level", "province");
|
|
|
- List<SysRegion> list = sysRegionService.list(qw);
|
|
|
+
|
|
|
+ List<SysRegion> list = sysRegionService.list();
|
|
|
if (!Collections.isEmpty(list)) {
|
|
|
- return list.stream().map(o -> {
|
|
|
+ List<AreaInfo> collect = list.stream().filter(o->o.getName().equals("中华人民共和国")).map(o -> {
|
|
|
AreaInfo areaInfo = new AreaInfo();
|
|
|
BeanUtils.copyProperties(o, areaInfo);
|
|
|
return areaInfo;
|
|
|
}).collect(Collectors.toList());
|
|
|
+ List<SysRegion> listAll = sysRegionService.list();
|
|
|
+ List<AreaInfo> areaInfos = buildData(collect, listAll);
|
|
|
+ // 构建树
|
|
|
+ return buildTree(areaInfos, listAll);
|
|
|
}
|
|
|
return new ArrayList<>();
|
|
|
// return GaoDeWebUtil.getProvinces();
|