<?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.activity.recommend.mapper.AcRecomUpgradeRuleConfigMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.activity.recommend.AcRecomUpgradeRuleConfig">
        <id column="PK_ID" property="pkId"/>
        <result column="DEL_FLAG" property="delFlag"/>
        <result column="CREATION_TIME" property="creationTime"/>
        <result column="PK_CREATOR" property="pkCreator"/>
        <result column="MODIFIED_TIME" property="modifiedTime"/>
        <result column="PK_MODIFIED" property="pkModified"/>
        <result column="PK_COUNTRY" property="pkCountry"/>
        <result column="PK_BASE_ID" property="pkBaseId"/>
        <result column="PK_SETTLE_GRADE" property="pkSettleGrade"/>
        <result column="PK_RECOMMEND_GRADE" property="pkRecommendGrade"/>
        <result column="RECOMMEND_NUMBER" property="recommendNumber"/>
        <result column="PK_UPGRADE_GRADE" property="pkUpgradeGrade"/>
    </resultMap>

    <select id="listRuleConfig" resultMap="BaseResultMap">
        select *
        from ac_recom_upgrade_rule_config u
        where u.del_flag = 0
        and u.pk_base_id = #{pkBaseId}
        and u.pk_settle_grade = #{pkSettleGrade}
        <if test="pkCountry != null">
            and u.pk_country = #{pkCountry}
        </if>
        order by u.creation_time desc
    </select>

</mapper>
