<?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.bonus.mapper.BdBonusDeductMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.bonus.BdBonusDeduct">
    <result column="CREATION_TIME" property="creationTime" />
    <result column="MODIFIED_TIME" property="modifiedTime" />
    <result column="DEL_FLAG" property="delFlag" />
    <result column="PK_COUNTRY" property="pkCountry" />
    <result column="PK_CREATOR" property="pkCreator" />
    <result column="PK_MODIFIED" property="pkModified" />
        <result column="PK_ID" property="pkId" />
        <result column="PK_BONUS_ITEMS" property="pkBonusItems" />
        <result column="BACK_RATIO" property="backRatio" />
        <result column="PLATFORM_RATIO" property="platformRatio" />
    </resultMap>

    <resultMap id="BdBonusDeductVo" type="com.hzs.system.bonus.vo.BdBonusDeductVo">
        <result column="PK_ID" property="pkId" />
        <result column="PK_BONUS_ITEMS" property="pkBonusItems" />
        <result column="BACK_RATIO" property="backRatio" />
        <result column="PLATFORM_RATIO" property="platformRatio" />
        <result column="PLATFORM_RATIO" property="bonusName" />

    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        PK_ID,
        PK_BONUS_ITEMS,
        BACK_RATIO,
        PLATFORM_RATIO,
    </sql>

    <!--   查询奖金扣项配置-->
    <select id="bonusDeductlist" parameterType="com.hzs.system.bonus.vo.BdBonusDeductVo"
            resultType="com.hzs.system.bonus.vo.BdBonusDeductVo">
        select a.PK_ID,
        b.PK_ID as PK_BONUS_ITEMS,
        a.BACK_RATIO,
        a.PLATFORM_RATIO,
        b.bonus_name from BD_BONUS_ITEMS b  left JOIN BD_BONUS_DEDUCT a on a.PK_BONUS_ITEMS=b.PK_ID
        where
         b.DEL_FLAG =0
        <if test="pkCountry != null ">
            AND b.PK_COUNTRY = #{pkCountry}
        </if>
        order by b.PK_ID ASC
    </select>



</mapper>
