<?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.area.mapper.AreaInfoMapper">

    <resultMap type="AreaInfo" id="AreaInfoResult">
        <result property="code"    column="code"    />
        <result property="name"    column="name"    />
        <result property="leaf"    column="leaf"    />
        <result property="parentCode"    column="parent_code"    />
    </resultMap>

    <sql id="selectAreaInfoVo">
        select * from area_info
    </sql>

    <select id="selectAreaInfoList" parameterType="AreaInfo" resultMap="AreaInfoResult">
        <include refid="selectAreaInfoVo"/>
        <where>
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="leaf != null  and leaf != ''"> and leaf = #{leaf}</if>
            <if test="parentCode != null  and parentCode != ''"> and parent_code = #{parentCode}</if>
        </where>
    </select>

</mapper>
