<?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.miaxis.dict.mapper.DictCityMapper">

    <resultMap type="DictCity" id="DictCityResult">
        <result property="id"    column="id"    />
        <result property="code"    column="code"    />
        <result property="parentcode"    column="parentCode"    />
        <result property="name"    column="name"    />
        <result property="level"    column="level"    />
        <result property="last"    column="last"    />
        <result property="status"    column="status"    />
    </resultMap>

    <sql id="selectDictCityVo">
        select id, code, parentCode, name, level, last, status from dict_city
    </sql>

    <select id="selectDictCityList" parameterType="DictCity" resultMap="DictCityResult">
        <include refid="selectDictCityVo"/>
        <where>
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="parentcode != null  and parentcode != ''"> and parentCode = #{parentcode}</if>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="level != null "> and level = #{level}</if>
            <if test="last != null "> and last = #{last}</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
    </select>

</mapper>
