AreaServiceDaoImplMapper.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="areaServiceDaoImpl">
  4. <!--查询地区数据-->
  5. <select id="getAreas" resultType="Map" parameterType="Map">
  6. select
  7. t.id ,
  8. t.area_code areaCode,
  9. t.area_name areaName,
  10. t.area_level areaLevel,
  11. t.parent_area_code parentAreaCode,
  12. t.parent_area_name parentAreaName,
  13. t.lon,
  14. t.lat,
  15. t.create_time createTime
  16. from city_area t
  17. where 1=1
  18. and t.status_cd = '0'
  19. <if test="areaCode != null and areaCode !=''">
  20. and t.area_code = #{areaCode}
  21. </if>
  22. <if test="areaName != null and areaName != ''">
  23. and t.area_name like concat('%',#{areaName},'%')
  24. </if>
  25. <if test="areaLevel != null and areaLevel !=''">
  26. and t.area_level = #{areaLevel}
  27. </if>
  28. <if test="parentAreaCode != null and parentAreaCode !=''">
  29. and t.parent_area_code = #{parentAreaCode}
  30. </if>
  31. <if test="parentAreaName != null and parentAreaName !=''">
  32. and t.parent_area_name like concat('%',#{parentAreaName},'%')
  33. </if>
  34. </select>
  35. <!--查询地区数据-->
  36. <select id="getWholeArea" resultType="Map" parameterType="Map">
  37. select
  38. t.id ,
  39. t.area_code areaCode,
  40. t.area_name areaName,
  41. t.area_level areaLevel,
  42. t.parent_area_code parentAreaCode,
  43. t.parent_area_name parentAreaName,
  44. t.lon,
  45. t.lat,
  46. t.create_time createTime
  47. from city_area t
  48. where 1=1
  49. and t.status_cd = '0'
  50. <if test="areaCode != null and areaCode !=''">
  51. and t.area_code like concat(#{areaCode},'%')
  52. </if>
  53. <if test="areaName != null and areaName != ''">
  54. and t.area_name like concat('%',#{areaName},'%')
  55. </if>
  56. <if test="areaLevel != null and areaLevel !=''">
  57. and t.area_level = #{areaLevel}
  58. </if>
  59. <if test="parentAreaCode != null and parentAreaCode !=''">
  60. and t.parent_area_code = #{parentAreaCode}
  61. </if>
  62. <if test="parentAreaName != null and parentAreaName !=''">
  63. and t.parent_area_name like concat('%',#{parentAreaName},'%')
  64. </if>
  65. ORDER BY t.area_code asc
  66. </select>
  67. <select id="getProvCityArea" parameterType="Map" resultType="Map">
  68. SELECT
  69. par.parent_area_code provCode,
  70. par.parent_area_name provName,
  71. par.area_code cityCode,
  72. par.area_name cityName,
  73. chil.area_code areaCode,
  74. chil.area_name areaName
  75. FROM
  76. city_area par,
  77. city_area chil
  78. WHERE
  79. chil.parent_area_code = par.area_code
  80. AND chil.area_level = '303'
  81. and chil.status_cd = '0'
  82. and par.status_cd = '0'
  83. <if test="areaCode != null and areaCode !=''">
  84. and chil.area_code = #{areaCode}
  85. </if>
  86. <if test="areaCodes != null">
  87. and chil.area_code in
  88. <foreach collection="areaCodes" open="(" close=")"
  89. separator="," item="item">
  90. #{item}
  91. </foreach>
  92. </if>
  93. </select>
  94. </mapper>