1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.bz.smart_city.dao.AreaMapper">
- <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.Area">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- -->
- <result column="id" jdbcType="INTEGER" property="id" />
- <result column="parent_id" jdbcType="INTEGER" property="parentId" />
- <result column="name" jdbcType="VARCHAR" property="name" />
- <result column="manger_name" jdbcType="VARCHAR" property="mangerName" />
- <result column="short_name" jdbcType="VARCHAR" property="shortName" />
- <result column="manger_short_name" jdbcType="VARCHAR" property="mangerShortName" />
- <result column="level_type" jdbcType="TINYINT" property="levelType" />
- <result column="city_code" jdbcType="CHAR" property="cityCode" />
- <result column="zip_code" jdbcType="CHAR" property="zipCode" />
- <result column="pin_yin" jdbcType="VARCHAR" property="pinYin" />
- <result column="jian_pin" jdbcType="CHAR" property="jianPin" />
- <result column="first_char" jdbcType="CHAR" property="firstChar" />
- <result column="lng" jdbcType="VARCHAR" property="lng" />
- <result column="lat" jdbcType="VARCHAR" property="lat" />
- <result column="remark" jdbcType="VARCHAR" property="remark" />
- </resultMap>
- <select id="findByIds" resultMap="BaseResultMap">
- select id,parent_id,name,level_type,lat,lng from sc_area where 1 = 1
- <if test="ids != null">
- and id in <foreach collection="ids" item="item" open="(" separator="," close=")">#{item}</foreach>
- </if>
- </select>
- <select id="getAllArea" resultType="com.bz.smart_city.dto.AreaDto">
- select id as code,parent_id as pid,name from sc_area
- </select>
- <select id="findByLevelType"
- resultType="com.bz.smart_city.dto.AreaRelevanceDto">
- select a1.id,a1.name ,a2.`name` as property1,a3.`name` as property2
- from sc_area a1
- LEFT JOIN sc_area a2 on(a2.id = a1.parent_id and a2.id != 100000)
- LEFT JOIN sc_area a3 on(a3.id = a2.parent_id and a3.id != 100000)
- where 1 = 1 and a1.level_type = #{levelType}
- </select>
- </mapper>
|