Mybatisでバッチデータを更新する

方法1
<update id="updateBatch" parameterType="Map">
update aa set
a=#{fptm},
b=#{csoftrain}
where c in
<foreach collection="cs" index="index" item="item" pen="(“separator=","close=")">
#{item}
</foreach>
</update>
方法2
接続文字列 jdbc:MySQL://172.17.2.120: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.test}+1
</set>
where id = ${item.id}
</foreach>
</update>

DataBase

Posted by arkgame