可以在mysql连接字符串添加&allowMultiQueries=true
此时即可以做多个更新
< update id = "batchUpdate" parameterType = "java.util.List" >
< foreach collection = "list" item = "item" index = "index" open = "" close = "" separator = ";" >
update
test
< set >
test=${item.test}+1
</ set >
where
id = ${item.id}
</ foreach >
</ update >
|