mybatis如何对db2数据库进行批量修改操作

<update id="updateList" parameterType="java.util.List" >
<foreach collection="list" item="item" index="index" open="" close="" separator="OR">
UPDATE XHXC_RWXD_JCJG
<set>
JGQR='${item.jgqr}',JGCLSM='${item.sm}'
</set>
WHERE ID='${item.id}'
</foreach>
</update>
一直报错,请帮忙看一下

第1个回答  2016-07-07
'${item.jgqr}',这儿明显不对.

<foreach collection="list" item="item" index="index" open="" close="" separator="OR">
UPDATE XHXC_RWXD_JCJG
<set>
JGQR='${item.jgqr}',JGCLSM='${item.sm}'
</set>
WHERE ID='${item.id}'
</foreach>
该处的item是作为循环变量处理,你在循环内,不应该采用任何标识符再进行声明,只需要item.id这样写就可以,这表示从对象里面去的该属性.本回答被网友采纳
第2个回答  推荐于2018-03-22
符号 #{ }
还有你传过来的List中的entity要有相应属性的get方法本回答被网友采纳
相似回答