AreaMapper.xml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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="com.bz.smart_city.dao.AreaMapper">
  4. <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.Area">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. -->
  9. <result column="id" jdbcType="INTEGER" property="id" />
  10. <result column="parent_id" jdbcType="INTEGER" property="parentId" />
  11. <result column="name" jdbcType="VARCHAR" property="name" />
  12. <result column="manger_name" jdbcType="VARCHAR" property="mangerName" />
  13. <result column="short_name" jdbcType="VARCHAR" property="shortName" />
  14. <result column="manger_short_name" jdbcType="VARCHAR" property="mangerShortName" />
  15. <result column="level_type" jdbcType="TINYINT" property="levelType" />
  16. <result column="city_code" jdbcType="CHAR" property="cityCode" />
  17. <result column="zip_code" jdbcType="CHAR" property="zipCode" />
  18. <result column="pin_yin" jdbcType="VARCHAR" property="pinYin" />
  19. <result column="jian_pin" jdbcType="CHAR" property="jianPin" />
  20. <result column="first_char" jdbcType="CHAR" property="firstChar" />
  21. <result column="lng" jdbcType="VARCHAR" property="lng" />
  22. <result column="lat" jdbcType="VARCHAR" property="lat" />
  23. <result column="remark" jdbcType="VARCHAR" property="remark" />
  24. </resultMap>
  25. <select id="findByIds" resultMap="BaseResultMap">
  26. select id,parent_id,name,level_type,lat,lng from sc_area where 1 = 1
  27. <if test="ids != null">
  28. and id in <foreach collection="ids" item="item" open="(" separator="," close=")">#{item}</foreach>
  29. </if>
  30. </select>
  31. <select id="getAllArea" resultType="com.bz.smart_city.dto.AreaDto">
  32. select id as code,parent_id as pid,name from sc_area
  33. </select>
  34. <select id="findByLevelType"
  35. resultType="com.bz.smart_city.dto.AreaRelevanceDto">
  36. select a1.id,a1.name ,a2.`name` as property1,a3.`name` as property2
  37. from sc_area a1
  38. LEFT JOIN sc_area a2 on(a2.id = a1.parent_id and a2.id != 100000)
  39. LEFT JOIN sc_area a3 on(a3.id = a2.parent_id and a3.id != 100000)
  40. where 1 = 1 and a1.level_type = #{levelType}
  41. </select>
  42. </mapper>