<update id="batchUpdate"> update set_pay_type set <foreach collection="payTypeList" item
<update id="batchUpdate">
update set_pay_type set
<foreach collection="payTypeList" item="item" open="order_num=case" close="else order_num end">
when id=#{item.id} then #{item.orderNum}
</foreach>
where id in
<foreach collection="payTypeList" item="item" open="(" close=")" separator=",">
#{item.id}
</foreach>
</update>
mysql输出
update set_pay_type set order_num=case when id=? then ? when id=? then ? else order_num end where id in ( ? , ? )
参考文献