<?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.kxs.user.biz.mapper.old.KxsMainServerMapper">

    <insert id="addAmountLog">
        insert into LeaderReserveRecord (UserId, Remark, AfterAmt, BeforeAmt, ChangeAmt, sort, TradeDate, TradeMonth, CreateDate)
        values (#{userId}, #{remark}, #{afterAmount},#{beforeAmount},#{amount}, #{variationType}, DATE_FORMAT(NOW(), '%Y%m%d'), DATE_FORMAT(NOW(), '%Y%m'), NOW())
    </insert>

    <update id="deductMakerUseAmount">
        update UserAccount
        <set>
            <if test="userId != null">
                LeaderBalanceAmount = #{leaderBalanceAmount},
            </if>
        </set>
        where UserId = #{userId}
    </update>
</mapper>
