阅读背景:

查询城市列表

来源:互联网 
@Override
public String listCity(String parentId) throws Exception {
    List<City> all = cityMapper.selectProvinceInfo();
    Map<String, City> cityMap = new HashMap<>();
    List<City> result = new ArrayList<>();
    for (City city : all){
        cityMap.put(city.getCitycode(), city);
    }
    for (City city : all){
        if (city.getCityparentcode().equals("0")){
            result.add(city);
        }else {
            cityMap.get(city.getCityparentcode()).getChildren().add(city);
        }
    }


    return JSONObject.toJSONString(result);
}@Override
public String listCity(String p



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: