zoukankan      html  css  js  c++  java
  • 取出全球的主要国家城市(只有中国有省市区)

    @Override
    public List<ShpLocationYSVo> queryArza() {
    List<ShpLocation> shpLocationList = shpLocationDao.queryContry();//国家
    List<ShpLocationYSVo> shpLocationYSVoList = new ArrayList<ShpLocationYSVo>();
    for (ShpLocation shpLocation : shpLocationList) {
    ShpLocationYSVo shpLocationYSVo = new ShpLocationYSVo();
    shpLocationYSVo.setId(shpLocation.getId());
    shpLocationYSVo.setPid(shpLocation.getPid());
    shpLocationYSVo.setNameEn(shpLocation.getNameEn());
    shpLocationYSVo.setNamePinyin(shpLocation.getNamePinyin());
    shpLocationYSVo.setsName(shpLocation.getsName());
    shpLocationYSVoList.add(shpLocationYSVo);
    /*********以上为国家*************/
    List<ShpLocationState> shpLocationStateList = new ArrayList<ShpLocationState>();
    ShpLocationState shpLocationState = null;
    ShpLocation shpLocationstate = new ShpLocation();
    if (shpLocation.getsName().equals("中国")) {
    shpLocationstate.setId(shpLocation.getId());
    List<ShpLocation> shpLocationStateLists = shpLocationDao.queryNodes(shpLocationstate);//根据id查省
    for (ShpLocation shpLocation1 : shpLocationStateLists) {
    shpLocationState = new ShpLocationState();
    shpLocationState.setId(shpLocation1.getId());
    shpLocationState.setPid(shpLocation1.getPid());
    shpLocationState.setsName(shpLocation1.getsName());
    shpLocationState.setNamePinyin(shpLocation1.getNamePinyin());
    shpLocationState.setNameEn(shpLocation1.getNameEn());
    shpLocationStateList.add(shpLocationState);
    /*****************以上为省*****************/
    ShpLocation shpLocationCity = new ShpLocation();
    shpLocationCity.setId(shpLocation1.getId());
    System.out.println(shpLocation1.getPid());
    List<ShpLocation> shpLocationCityLists = shpLocationDao.queryNodes(shpLocationCity);//根据id查市
    ShpLocationCity shpLocationCitys = null;
    List<ShpLocationCity> shpLocationCityList = new ArrayList<ShpLocationCity>();
    for (ShpLocation shpLocation2 : shpLocationCityLists) {
    shpLocationCitys = new ShpLocationCity();
    shpLocationCitys.setId(shpLocation2.getId());
    shpLocationCitys.setPid(shpLocation2.getPid());
    shpLocationCitys.setsName(shpLocation2.getsName());
    shpLocationCitys.setNamePinyin(shpLocation2.getNamePinyin());
    shpLocationCitys.setNameEn(shpLocation2.getNameEn());
    shpLocationCityList.add(shpLocationCitys);
    }
    shpLocationState.setCityList(shpLocationCityList);
    }
    shpLocationYSVo.setStateList(shpLocationStateList);
    }
    }
    return shpLocationYSVoList;
    }

    <!--查询国家下的州/省 市-->
    <select id="queryNodes" resultMap="BaseShpLocationResultMap" parameterType="com.yryz.qsource.modules.shplocation.entity.ShpLocation">
    SELECT
    <include refid="Base_Shp_Location_Column_List"/>
    FROM qsource_shp_location
    <where>
    1=1
    <if test="id != null">
    AND pid=#{id,jdbcType=INTEGER}
    </if>
    ORDER BY name_en ASC
    </where>
    </select>

    
    
  • 相关阅读:
    一个有关FWT&FMT的东西
    【XSY2762】插线板 分块
    【XSY1905】【XSY2761】新访问计划 二分 树型DP
    【XSY2760】nonintersect 计算几何
    【XSY2787】Mythological VII 贪心
    【XSY2786】Mythological VI 数学
    【XSY2785】模型
    【BZOJ4126】【BZOJ3516】【BZOJ3157】国王奇遇记 线性插值
    【XSY2751】Mythological IV 线性插值
    【XSY2750】Mythological V 2-sat
  • 原文地址:https://www.cnblogs.com/austinspark-jessylu/p/8328048.html
Copyright © 2011-2022 走看看