<?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.bonus.system.mapper.SysAddressMapper">
    <resultMap type="com.bonus.system.api.domain.SysAddress" id="SysAddressResult">
        <result property="id"    column="id"    />
        <result property="platformId"    column="platform_id"    />
        <result property="code"    column="code"    />
        <result property="parentCode"    column="parent_code"    />
        <result property="name"    column="name"    />
        <result property="latitude"    column="latitude"    />
        <result property="longitude"    column="longitude"    />
        <result property="level"    column="level"    />
        <result property="region"    column="region"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="delFlag"    column="del_flag"    />
    </resultMap>

    <sql id="selectSysAddressVo">
        select id, platform_id, code, parent_code, name, latitude, longitude, level, region, create_time, update_time, del_flag from sys_address
    </sql>

    <select id="selectSysAddressList" parameterType="com.bonus.system.api.domain.SysAddress" resultMap="SysAddressResult">
        <include refid="selectSysAddressVo"/>
        where parent_code = #{parentCode}
    </select>
    
    <select id="selectSysAddressById" parameterType="Long" resultMap="SysAddressResult">
        <include refid="selectSysAddressVo"/>
        where id = #{id}
    </select>

</mapper>