City.xml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
  15. "http://ibatis.apache.org/dtd/sql-map-2.dtd">
  16. <sqlMap namespace="com.runzhixing.util.interf.PlaceLoader">
  17. <!--模块配置-->
  18. <typeAlias alias="city" type="com.runzhixing.util.bean.City"/>
  19. <resultMap id="citymap" class="city">
  20. <result property="provinceNO" column="provinceno"/>
  21. <result property="name" column="name"/>
  22. <result property="id" column="id"/>
  23. <result property="placeAB" column="placeAB"/>
  24. <result property="carPrefix" column="carprefix"/>
  25. <result property="areaCode" column="areaCode"/>
  26. <!--
  27. 级联查询该市所有的区县
  28. -->
  29. <result property="subPlaceList" column="{provinceNO=provinceno,id=id}" select="getCountryList"/>
  30. </resultMap>
  31. <!-- 缓存 -->
  32. <cacheModel id="cache" type ="LRU" readOnly="true" serialize="false">
  33. <flushInterval seconds="1"/>
  34. <property name="cache-size" value="500" />
  35. </cacheModel>
  36. <!--Statement配置-->
  37. <select id="getCityById" parameterClass="com.runzhixing.util.bean.City" resultMap="citymap" cacheModel="cache">
  38. select
  39. provinceno,
  40. cityno as id,
  41. cityname as name,
  42. cityab as placeAB,
  43. carprefix,
  44. areaCode
  45. from td_city
  46. where provinceno=#{provinceNO}# and cityno=#{id}#
  47. </select>
  48. <select id="getCityList" parameterClass="string" resultMap="citymap" cacheModel="cache">
  49. select
  50. provinceno,
  51. cityno as id,
  52. cityname as name,
  53. cityab as placeAB,
  54. carprefix,
  55. areaCode
  56. from td_city
  57. where provinceno=#{provinceNO}#
  58. order by Provinceno,cityno
  59. </select>
  60. </sqlMap>