<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="begin" close=";end;" separator=";">
//里面为内容
</foreach>
</update>
oracle下的批量更新,中间部分如上所示,不能如传统的一般更新,也可以如下操作:
<update id="updateClaimDetails" parameterType="java.util.List">
begin
<foreach separator=";" index="index" item="item" collection="list" close="" open="">
update T_CLAIM_DETAILS
<set>
<if test="item.accountingSubjectNum != null and item.accountingSubjectNum !='' ">
ACCOUNTING_SUBJECT_NUM = #{item.accountingSubjectNum,jdbcType=VARCHAR},
</if>
<if test="item.taxSubjectNum != null and item.taxSubjectNum !='' ">
TAX_SUBJECT_NUM = #{item.taxSubjectNum,jdbcType=VARCHAR},
</if>
</set>
where PK_ID = #{item.pkId,jdbcType=VARCHAR}
</foreach>
;end;
</update>