数据库批量 之 DB2
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">
delete from
<include refid="tableName"></include>
where
UUID in
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- 删除重复数据或者将要发生变化的数据 -->
<delete id="deleteExist" parameterType="java.util.List">
delete from
<include refid="tableName"></include>
where
<foreach collection ="list" item="data" separator =" or ">
(BIZ_NUM = #{data.BIZ_NUM} and WARN_TYPE = #{data.WARN_TYPE} and CERT_NUM = #{data.CERT_NUM})
</foreach>
</delete>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="java.util.List">
insert into
<include refid="tableName"></include>
( <include refid="Field"></include> )
values
<foreach collection ="list" item="data" separator =",">
(#{data.BIZ_NUM},#{data.WARN_TYPE},#{data.CUST_NAME},#{data.CUST_TYPE},#{data.CERT_TYPE},#{data.CERT_NUM},#{data.MOBILE},
#{data.ORG_ID},#{data.LOAN_DATE},#{data.BATCH_DATE},#{data.WARN_DAY},#{data.CREATE_TIME},#{data.UPDATE_TIME},#{data.UUID})
</foreach>
</insert>