如存在问题 或有更好建议 请联系 作者QQ:2940500
记录坑:
注意: 在使用批量更新之前 要先设置 mysql 支持 批量执行多条sql 在连接信息后加上[&allowMultiQueries=true]

mybatis sql如下:
<update id="updateList">
<foreach separator=";" index="index" item="item" collection="list" close="" open="">
update tb_activity
set status=${item.status}
where id = ${item.id}
</foreach>
</update>
当然还有另外一种批量修改需求:
<update id="batchUpdate1" parameterType="java.util.List"> update sys_group set level = null where level in <foreach separator="," index="index" item="item" collection="list" close=")" open="("> #{item} </foreach> </update>
————————————————
版权声明:本文为CSDN博主「墨落青衫」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_42059737/article/details/86063320
浙公网安备 33010602011771号