<?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.lframework.xingyun.core.mappers.DicCityMapper">

    <resultMap id="DicCityDto" type="com.lframework.xingyun.core.dto.dic.city.DicCityDto">
        <id column="id" property="id"/>
        <result column="code" property="code"/>
        <result column="name" property="name"/>
        <result column="parent_id" property="parentId"/>
        <result column="level" property="level"/>
    </resultMap>

    <sql id="DicCityDto_sql">
        SELECT id,
               code,
               name,
               parent_id,
               level
        FROM dic_city
    </sql>

    <select id="getAll" resultMap="DicCityDto">
        <include refid="DicCityDto_sql"/>
        ORDER BY code
    </select>

    <select id="findById" resultMap="DicCityDto">
        <include refid="DicCityDto_sql"/>
        WHERE id = #{id}
    </select>
</mapper>
