|
@@ -29,6 +29,9 @@ public class ApiCityController {
|
|
CityRepository cityRepository;
|
|
CityRepository cityRepository;
|
|
@Autowired
|
|
@Autowired
|
|
DistrictRepository districtRepository;
|
|
DistrictRepository districtRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ TownRepository townRepository;
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/data")
|
|
@RequestMapping(value = "/data")
|
|
@@ -40,6 +43,10 @@ public class ApiCityController {
|
|
cityList.stream().forEach(city -> {
|
|
cityList.stream().forEach(city -> {
|
|
List<District> districts =districtRepository.findList(city.getCode().substring(0,4) + "%");
|
|
List<District> districts =districtRepository.findList(city.getCode().substring(0,4) + "%");
|
|
city.setDistricts(districts);
|
|
city.setDistricts(districts);
|
|
|
|
+ districts.stream().forEach(district -> {
|
|
|
|
+ List<Town> towns = townRepository.findList(district.getCode());
|
|
|
|
+ district.setTowns(towns);
|
|
|
|
+ });
|
|
});
|
|
});
|
|
return R.succ(province);
|
|
return R.succ(province);
|
|
}
|
|
}
|