<?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.consume.mapper.AcConsumeShieldConfigMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.activity.consume.AcConsumeShieldConfig">
        <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_PRODUCT" property="pkProduct" />
        <result column="CONDITION" property="condition" />
        <result column="QUANTITY" property="quantity" />
    </resultMap>
    <resultMap id="BaseResultMapExt" type="com.hzs.common.domain.activity.consume.ext.AcConsumeShieldConfigExt">
        <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_PRODUCT" property="pkProduct" />
        <result column="CONDITION" property="condition" />
        <result column="QUANTITY" property="quantity" />
        <result column="PRODUCT_NAME" property="productName" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        DEL_FLAG,
        CREATION_TIME,
        PK_CREATOR,
        MODIFIED_TIME,
        PK_MODIFIED,
        PK_COUNTRY,
        PK_ID, PK_BASE_ID, PK_PRODUCT, CONDITION, QUANTITY
    </sql>

    <select id="queryListByRuleIdList" resultMap="BaseResultMapExt">
        select csc.*,bp.PRODUCT_NAME  from AC_CONSUME_SHIELD_CONFIG csc
        left join  BD_PRODUCT bp on bp.PK_ID = csc.PK_PRODUCT
        where 1 = 1
        <if test="pkBaseId != null">
            and csc.PK_BASE_ID= #{pkBaseId}
        </if>
    </select>

</mapper>
