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>

    
    
  • 相关阅读:
    JAVA-复数计算器
    第十三周总结
    java多线程
    写作的意义
    mysql删除有外键表数据
    Linux firewall防火墙设置
    linux安装ftp
    SELECT list is not in GROUP BY clause and contains nonaggregated
    primordials is not defined
    maven手动添加jar包
  • 原文地址:https://www.cnblogs.com/austinspark-jessylu/p/8328048.html
Copyright © 2011-2022 走看看