在mapper文件中如此写:
<insert id="insertHKFP" parameterType="java.util.List" useGeneratedKeys="false">
insert all
<foreach collection="list" item="hkfp" index="index" separator="">
into W_MM_HK_FPMX(id,f_hkid,F_KPSQ_ID,f_je,f_fpje)
values
(
#{hkfp.id},
#{hkfp.FHkid},
#{hkfp.FKpsqId},
#{hkfp.FJe},
#{hkfp.FFpje}
)
</foreach>
select 1 from dual
</insert>
注:oracle与mysql的批量插入是有区别的
效果如下:
insert all into W_MM_HK_FPMX(id,f_hkid,F_KPSQ_ID,f_je,f_fpje) values ( ?, ?, ?, ?, ? ) into W_MM_HK_FPMX(id,f_hkid,F_KPSQ_ID,f_je,f_fpje) values ( ?, ?, ?, ?, ? ) select 1 from dual