<?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.member.achieve.mapper.CuMemberMonthAchieveMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="CuMemberMonthAchieve" type="com.hzs.common.domain.member.ext.CuMemberMonthAchieveExt">
        <id column="PK_ID" property="pkId"/>
        <result column="DEL_FLAG" property="delFlag"/>
        <result column="CREATION_TIME" property="creationTime"/>
        <result column="MODIFIED_TIME" property="modifiedTime"/>
        <result column="PK_COUNTRY" property="pkCountry"/>
        <result column="PK_CREATOR" property="pkCreator"/>
        <result column="PK_MODIFIED" property="pkModified"/>
        <result column="PK_MEMBER" property="pkMember"/>
        <result column="PERIOD" property="period"/>
        <result column="SETTLE_MONTH" property="settleMonth"/>
        <result column="RECOMMEND_MONEY" property="recommendMoney"/>
        <result column="RECOMMEND_ACHIEVE" property="recommendAchieve"/>
        <result column="REPURCHASE_MONEY" property="repurchaseMoney"/>
        <result column="REPURCHASE_ACHIEVE" property="repurchaseAchieve"/>
        <result column="WALL_TYPE" property="wallType"/>
        <result column="MONEY" property="money"/>
        <result column="MEMBER_NAME" property="memberName"/>
        <result column="HEAD_PATH" property="headPath"/>
    </resultMap>

    <select id="queryCuMemberMonthAchieveInfo" resultType="com.hzs.member.achieve.controller.vo.RealPerformanceVo">
        select nvl(sum(A_NEW_PV), 0)     firstLeftPurchaseTotal,
               nvl(sum(B_NEW_PV), 0)     firstRightPurchaseTotal,
               nvl(sum(REP_A_NEW_PV), 0) firstLeftRepurchaseTotal,
               nvl(sum(REP_B_NEW_PV), 0) firstRightRepurchaseTotal
        from ${achieveTable}
        WHERE pk_member = #{pkMember}
    </select>
</mapper>
