<?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.people.mapper.AcNewPeopleRuleConfigMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.activity.people.AcNewPeopleRuleConfig">
        <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_GRADE" property="pkGrade" />
        <result column="PLAN" property="plan" />
        <result column="PRICE" property="price" />
    </resultMap>

    <resultMap id="AcNewPeopleRuleConfigVO" type="com.hzs.activity.people.vo.AcNewPeopleRuleConfigVO">
        <id column="PK_ID" property="pkId" />
        <result column="PK_COUNTRY" property="pkCountry" />
        <result column="PK_BASE_ID" property="pkBaseId" />
        <result column="PK_GRADE" property="pkGrade" />
        <result column="PLAN" property="plan" />
        <result column="PRICE" property="price" />
        <result column="PK_TRANSACTION" property="pkGradeKey" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        DEL_FLAG,
        CREATION_TIME,
        PK_CREATOR,
        MODIFIED_TIME,
        PK_MODIFIED,
        PK_COUNTRY,
        PK_ID, PK_BASE_ID, PK_GRADE, PLAN, PK_GIFT
    </sql>

    <!--   查询新人礼包规则-->
    <select id="queryNplList" parameterType="com.hzs.activity.people.vo.AcNewPeopleRuleConfigVO"
            resultType="com.hzs.activity.people.vo.AcNewPeopleRuleConfigVO">
        select  a.*,b.PK_TRANSACTION as pkGradeKey
        from AC_NEW_PEOPLE_RULE_CONFIG a
        INNER JOIN BD_GRADE b on a.PK_GRADE=b.PK_ID
        WHERE
        a.DEL_FLAG = 0
        AND b.DEL_FLAG =0 AND a.PK_BASE_ID = #{pkBaseId}
        AND a.PK_COUNTRY = #{pkCountry}
        order by a.PK_ID desc
    </select>


</mapper>
