mybatis mapper.xml

这段代码展示了如何使用SQL批量更新和插入数据。updateCustMoney更新pc_cust_money表中storage_amount和already_pc_make_twoafter字段,而insertCustMoney则用于向table_name表中插入实际交易客户代码和已结算金额数据。
摘要由CSDN通过智能技术生成
<!--批量更新-->
<update id="updateCustMoney" parameterType="java.util.List">
    <foreach collection="list" item="item" index="index" open="" close="" separator=";">
        update pc_cust_money
        <set>
            <if test="item.storageAmount!=null and item.storageAmount!=''">storage_amount=${item.storageAmount},</if>
            <if test="item.alreadyPcMakeTwoafter!=null and item.alreadyPcMakeTwoafter!=''">already_pc_make_twoafter=${item.alreadyPcMakeTwoafter}</if>
        </set>
        where table_name= ${item.actualTradingCustomerCode}
    </foreach>
</update>
<!--批量新增-->
<insert id="insertCustMoney" parameterType="java.util.List">
    insert into
    table_name
    (actual_trading_customer_code,
    already_pc_make_twoafter)
    values
    <foreach collection="list" item="item" index="index"
             separator=",">
        ( #{item.actualTradingCustomerCode},
        #{item.alreadyPcMakeTwoafter}
        )
    </foreach>
</insert>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值