<?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.BdGradeScopeMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.system.config.BdGradeScope">
        <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_GRADE" property="pkGrade" />
        <result column="PK_SCOPE" property="pkScope" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        DEL_FLAG,
        PK_COUNTRY,
        CREATION_TIME,
        MODIFIED_TIME,
        PK_CREATOR,
        PK_MODIFIED,
        PK_ID, PK_GRADE, PK_SCOPE
    </sql>
   <!--查询等级范围-->
    <select id="selectGradeScopeList" parameterType="com.hzs.common.domain.system.ext.BdGradeScopeExt"
            resultType="com.hzs.common.domain.system.ext.BdGradeScopeExt">
        select a.PK_ID,
        a.PK_GRADE,
        a.PK_SCOPE,
        a.DEL_FLAG,
        a.PK_COUNTRY,
        a.CREATION_TIME,
        a.MODIFIED_TIME,
        a.PK_CREATOR,
        a.PK_MODIFIED
        from BD_GRADE_SCOPE a
        where a.DEL_FLAG = 0
        <if test="pkCountry != null and pkCountry != 0">
            AND a.PK_COUNTRY = #{pkCountry}
        </if>
        <if test="pkGrade != null ">
            AND a.PK_GRADE = #{pkGrade}
        </if>
        order by a.PK_GRADE,a.PK_SCOPE,a.CREATION_TIME desc
    </select>

</mapper>
