<update id="id" parameterType="Dto">
<foreach item="item" collection="是一个list" >
update test set t.A=#{item.a},t.b='success' where t.id=#{item.id}
</foreach>
</update>我想这么写。但是报错。假如list里面有两条记录打印Sql如下:
update test set t.A=a,t.b='success' where t.id=1 update test set t.A=a1,t.b='success' where t.id=2 mybatis 中的Sql是不能这么写的。希望大家给我一个思路。
<foreach item="item" collection="是一个list" >
update test set t.A=#{item.a},t.b='success' where t.id=#{item.id}
</foreach>
</update>我想这么写。但是报错。假如list里面有两条记录打印Sql如下:
update test set t.A=a,t.b='success' where t.id=1 update test set t.A=a1,t.b='success' where t.id=2 mybatis 中的Sql是不能这么写的。希望大家给我一个思路。
错误就是他把两个update语句拼起来,就发给Oracle了。oracle 肯定不识别,不是循环完一次就发给oracle,循环完第二次就发给oracle。