<?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.hzs.system.config.mapper.BdRangeDetailsMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.system.config.BdRangeDetails">
        <id column="PK_ID" property="pkId"/>
        <result column="DEL_FLAG" property="delFlag"/>
        <result column="PK_COUNTRY" property="pkCountry"/>
        <result column="CREATION_TIME" property="creationTime"/>
        <result column="MODIFIED_TIME" property="modifiedTime"/>
        <result column="PK_CREATOR" property="pkCreator"/>
        <result column="PK_MODIFIED" property="pkModified"/>
        <result column="PK_RANGE" property="pkRange"/>
        <result column="PK_LEVEL" property="pkLevel"/>
    </resultMap>

    <select id="getBdRangeDetailsList"
            parameterType="com.hzs.common.domain.system.config.ext.BdRangeDetailsExt"
            resultType="com.hzs.common.domain.system.config.ext.BdRangeDetailsExt">
        SELECT
        a.PK_COUNTRY,
        a.CREATION_TIME,
        a.MODIFIED_TIME,
        a.PK_CREATOR,
        a.PK_MODIFIED,
        a.PK_ID,
        a.PK_RANGE,
        a.PK_LEVEL,
        a.RANGE_TYPE,
        b.RANGE_NAME as rangeName
        FROM
        BD_RANGE_DETAILS a
        INNER JOIN BD_RANGE b ON a.PK_RANGE = b.PK_ID
        WHERE
        a.DEL_FLAG = 0
        and b.DEL_FLAG = 0
        <if test="pkRange != null">
            AND a.PK_RANGE = #{pkRange}
        </if>
    </select>

</mapper>
