<?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.KxsOpServerMapper">


    <insert id="addAmountLog">
        insert into AmountRecordNew (UserId, ChangeTypeId, ShowType, Remark, UseAmount, AfterValidForGetAmount, UseValidForGetAmount, BeforeAmount, AfterAmount, OperateType, CreateDate)
        values (#{amountLog.userId},  #{amountLog.changeType}, 11, #{amountLog.remark}, #{amountLog.amount},#{param.withdrawalAmount},#{amountLog.useWithdrawalAmount}, #{amountLog.beforeAmount}, #{amountLog.afterAmount},2, NOW())
    </insert>


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