<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>
利用foreach函数进行更新
批量插入。
<insert id ="insertBatch" parameterType="List" > insert into REAL_DATA_HW( M_LINE_NO,M_TIME,HW_NUM, VOL_A,VOL_B,VOL_C ) values <foreach collection ="list" item ="obj" index ="index" separator =","> ( #{obj.M_LINE_NO},to_date(#{obj.M_TIME},'yyyy-MM-dd hh24:mi:ss'),#{obj.HW_NUM}, #{obj.VOL_A},#{obj.VOL_B},#{obj.VOL_C} ) </foreach> </insert>