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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.member.bonus.CuMemberRepeatBonus">
        <result column="DEL_FLAG" property="delFlag" />
        <result column="PK_COUNTRY" property="pkCountry" />
        <result column="PK_CREATOR" property="pkCreator" />
        <result column="CREATION_TIME" property="creationTime" />
        <result column="PK_MODIFIED" property="pkModified" />
        <result column="MODIFIED_TIME" property="modifiedTime" />
        <result column="PK_MEMBER" property="pkMember" />
        <result column="PERIOD" property="period" />
        <result column="PK_RATE" property="pkRate" />
        <result column="DIRECT_INCOME" property="directIncome" />
        <result column="EXPAND_INCOME" property="expandIncome" />
        <result column="COACH_INCOME" property="coachIncome" />
        <result column="SHARE_INCOME" property="shareIncome" />
        <result column="SERVICE_INCOME" property="serviceIncome" />
        <result column="BACK_POINTS" property="backPoints" />
        <result column="SERVICE_SPEND" property="serviceSpend" />
        <result column="PUR_REAL_SUBTOTAL" property="purRealSubtotal" />
        <result column="MAKER_DIRECT_INCOME" property="makerDirectIncome" />
        <result column="MAKER_SHARE_INCOME" property="makerShareIncome" />
        <result column="MAKER_REAL_SUBTOTAL" property="makerRealSubtotal" />
        <result column="REAL_INCOME_TOTAL" property="realIncomeTotal" />
    </resultMap>
    <insert id="insertCuMemberRepeatBonus">
        insert ALL
        <foreach item="item" index="index" collection="cuMemberRepeatBonusList" separator="  ">
            into CU_MEMBER_REPEAT_BONUS(pk_member,period,pk_rate,direct_income,expand_income,
            coach_income,share_income,service_income,back_points,service_spend,
            pur_real_subtotal,maker_direct_income,maker_share_income,maker_real_subtotal,real_income_total,
            pk_country,pk_creator)
            values
            (#{item.pkMember},#{item.period},#{item.pkRate,jdbcType=INTEGER},#{item.directIncome},
            #{item.expandIncome},#{item.coachIncome},#{item.shareIncome},#{item.serviceIncome},
            #{item.backPoints},#{item.serviceSpend},#{item.purRealSubtotal},#{item.makerDirectIncome},
            #{item.makerShareIncome},#{item.makerRealSubtotal},#{item.realIncomeTotal},
            #{item.pkCountry},#{item.pkCreator})
        </foreach>
        SELECT 1 FROM dual
    </insert>

</mapper>
