<?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.xingxi.mq.server.report.mapper.CommissionMoneyMonthVoMapper">

    <resultMap type="CommissionMoneyMonth" id="CommissionMoneyMonthVoResult">
        <result property="id"    column="id"    />
        <result property="commissionYear"    column="commissionYear"    />
        <result property="commissionMonth"    column="commissionMonth"    />
        <result property="referrerId"    column="referrerId"    />
        <result property="buyerId"    column="buyerId"    />
        <result property="sellerId"    column="sellerId"    />
        <result property="commissionAmount"    column="commissionAmount"    />
        <result property="orderAmount"    column="orderAmount"    />
        <result property="businessCategory"    column="businessCategory"    />
        <result property="delFlag"    column="delFlag"    />
        <result property="createUser"    column="createUser"    />
        <result property="createTime"    column="createTime"    />
        <result property="updateUser"    column="updateUser"    />
        <result property="updateTime"    column="updateTime"    />
    </resultMap>

    <sql id="selectCommissionMoneyMonthVo">
        select
            c.id,
            c.commissionYear,
            c.commissionMonth,
            c.referrerId,
            c.buyerId,
            c.sellerId,
            c.commissionAmount,
            c.orderAmount,
            c.businessCategory,
            c.delFlag,
            c.createUser,
            c.createTime,
            c.updateUser,
            c.updateTime
        from t_commission_money_month c
    </sql>

    <update id="updateCommissionMoneyMonth" parameterType="CommissionMoneyMonth">
        update t_commission_money_month
        <trim prefix="SET" suffixOverrides=",">
            <if test="commissionYear != null and commissionYear != ''">commissionYear = #{commissionYear},</if>
            <if test="commissionMonth != null and commissionMonth != ''">commissionMonth = #{commissionMonth},</if>
            <if test="referrerId != null">referrerId = #{referrerId},</if>
            <if test="buyerId != null">buyerId = #{buyerId},</if>
            <if test="sellerId != null">sellerId = #{sellerId},</if>
            <if test="commissionAmount != null">commissionAmount = commissionAmount + #{commissionAmount},</if>
            <if test="orderAmount != null">orderAmount = orderAmount + #{orderAmount},</if>
            <if test="businessCategory != null and businessCategory != ''">businessCategory = #{businessCategory},</if>
            <if test="delFlag != null and delFlag != ''">delFlag = #{delFlag},</if>
            <if test="updateUser != null and updateUser != ''">updateUser = #{updateUser},</if>
            <if test="updateTime != null">updateTime = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

</mapper>
