Mybatis批量更新

mysql数据库采用一下写法即可执行,但是数据库连接必须配置:&allowMultiQueries=true

例如:jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true

<update id="batchUpdate" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
update test
<set>test=${item.num}+1</set>
where id = ${item.id}
</foreach>
</update>
posted @ 2016-08-19 21:43  煮海焚天  阅读(157)  评论(0编辑  收藏  举报