getRegionold.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!--
  3. Copyright 2009-2012 the original author or authors.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. -->
  14. <!DOCTYPE mapper
  15. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  16. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  17. <mapper namespace="com.runzhixing.dao.interf.AuthorityRegionInterface">
  18. <!-- 结果集 -->
  19. <resultMap id="regionList" type="com.runzhixing.bean.AuthorityRegionPlace">
  20. <result column="ID" property="id"/>
  21. <result column="NAME" property="name"/>
  22. <result column="PLACEAB" property="placeAB"/>
  23. <result column="CARPREFIX" property="carprefix"/>
  24. <collection property="subPlaceList" resultMap="cityList"/>
  25. </resultMap>
  26. <resultMap id="cityList" type="com.runzhixing.bean.CityPlace">
  27. <result property="cprovinceNo" column="CPROVINCENO"/>
  28. <result property="id" column="CID"/>
  29. <result property="name" column="CNAME"/>
  30. <result property="placeab" column="CPLACEAB"/>
  31. <result property="carPrefix" column="CCARPREFIX"/>
  32. <result property="areaCode" column="CAREACODE"/>
  33. <association property="subPlaceList" column="{cprovinceNo=CPROVINCENO,id=CID}" javaType="com.runzhixing.bean.CityPlace" select="getCountryList"/>
  34. </resultMap>
  35. <resultMap id="countryList" type="com.runzhixing.bean.CountryPlace">
  36. <result property="provinceNO" column="YPROVINCENO"/>
  37. <result property="cityNO" column="YCITYNO"/>
  38. <result property="name" column="YNAME"/>
  39. <result property="id" column="YID"/>
  40. <result property="placeAB" column="YPLACEAB"/>
  41. </resultMap>
  42. <!-- sql配置文件 开始-->
  43. <!-- 只知道省id,查询省市县,sql配置文件 开始-->
  44. <!-- 根据省id查询省名 -->
  45. <!-- <select id="getProvinceList" parameterType="com.runzhixing.util.bean.ConditionParameter" resultMap="regionList">
  46. select
  47. t.PROVINCENO as ID,
  48. t.PROVINCENAME as NAME,
  49. t.PROVINCEAB as PLACEAB,
  50. t.CARPREFIX as CARPREFIX
  51. from TD_PROVINCE t
  52. <where>
  53. <if test="cpstring1 != null and !&quot;&quot;.equals(cpstring1.trim())">
  54. and t.PROVINCENO = #{cpstring1}
  55. </if>
  56. </where>
  57. </select>
  58. -->
  59. <select id="getProvinceList" parameterType="com.runzhixing.util.bean.ConditionParameter" resultMap="regionList">
  60. select
  61. t.PROVINCENO as ID,
  62. t.PROVINCENAME as NAME,
  63. t.PROVINCEAB as PLACEAB,
  64. t.CARPREFIX as CARPREFIX,
  65. c.PROVINCENO as CPROVINCENO,
  66. c.CITYNO as CID,
  67. c.CITYNAME as CNAME,
  68. c.CITYAB as CPLACEAB,
  69. c.CARPREFIX as CCARPREFIX,
  70. c.AREACODE as CAREACODE
  71. from TD_PROVINCE t ,TD_CITY c
  72. <where>
  73. <if test="cpstring1 != null and !&quot;&quot;.equals(cpstring1.trim())">
  74. and t.PROVINCENO = #{cpstring1}
  75. </if>
  76. <if test="cpstring1 != null and !&quot;&quot;.equals(cpstring1.trim())">
  77. and c.PROVINCENO = #{cpstring1}
  78. </if>
  79. </where>
  80. </select>
  81. <!-- 根据省id查询所有市名 -->
  82. <select id="getCityListByPid" parameterType="java.lang.String" resultMap="cityList">
  83. select
  84. t.PROVINCENO as PROVINCENO,
  85. t.CITYNO as ID,
  86. t.CITYNAME as NAME,
  87. t.CITYAB as PLACEAB,
  88. t.CARPREFIX as CARPREFIX,
  89. t.AREACODE as AREACODE
  90. from TD_CITY t
  91. <where>
  92. <if test="ID != null and !&quot;&quot;.equals(ID.trim())">
  93. and t.PROVINCENO = #{ID}
  94. </if>
  95. order by t.PROVINCENO,t.CITYNO
  96. </where>
  97. </select>
  98. <!-- 只知道省id,查询省市县,sql配置文件结束 -->
  99. <!-- 知道省id,市id,查询省市县,sql配置文件开始 -->
  100. <select id="getCountryList" parameterType="com.runzhixing.bean.CityPlace" resultMap="countryList">
  101. select
  102. u.PROVINCENO as YPROVINCENO,
  103. u.CITYNO as YCITYNO,
  104. u.COUNTYNAME as YNAME,
  105. u.COUNTYNO as YID,
  106. u.COUNTYAB as YPLACEAB
  107. from TD_COUNTY u
  108. <where>
  109. <if test="cprovinceNo != null and !&quot;&quot;.equals(cprovinceNo.trim())">
  110. and u.PROVINCENO = #{cprovinceNo}
  111. </if>
  112. <if test="id != null and !&quot;&quot;.equals(id.trim())">
  113. and u.CITYNO = #{id}
  114. </if>
  115. order by u.PROVINCENO,u.CITYNO,u.COUNTYNO
  116. </where>
  117. </select>
  118. <!-- 知道省id,市id,查询省市县,sql配置文件结束 -->
  119. <!-- 知道省id,市id,县id查询省市县,sql配置文件开始 -->
  120. <!-- 知道省id,市id,县id查询省市县,sql配置文件结束 -->
  121. <!-- sql配置文件结束 -->
  122. </mapper>