<update id="updateBatchData" parameterType="java.util.List">
<foreach collection="list" item="bean" index="index" open="" close="" separator=";">
UPDATE demo
<set>
name=#{bean.name}
</set>
<where>
id= #{bean.id}
</where>
</foreach>
</update>
注意: 必须在配置连接数据库url后面带一个参数 &allowMultiQueries=true,表示允许批量操作
网友评论