ORACLE:
<insert id="insertList" parameterClass="java.util.List">
INSERT All
<iterate conjunction=" " >
INTO PA_TASK
(ID, PROJECT_ID, STATUS, CREATE_TIME, UPDATE_TIME, NAME, TYPE, BUDGET_ID, TOTAL_NUM, END_TIME, FINISH_TIME, USER_ID, CREATOR_ID)
VALUES
(PA_SEQ.NEXTVAL, #list[].projectId#, #list[].status#, #list[].createTime#, #list[].updateTime#, #list[].name#, #list[].type#, #list[].budgetId#, #list[].totalNum#, #list[].endTime#, #list[].finishTime#, #list[].userId#, #list[].creatorId#)
</iterate>
select * from dual
</insert>
备注:oracle批量插入时,插入数据的主键ID是一样的,标签iterate内无法实现动态取sequence的值,所以没有实现插入id差异化
MYSQL:
<insert id="insertList" parameterClass="java.util.List">
insert into adc_advert_media(project_id, advert_id, media_id)
values
<iterate open="" close="" conjunction=",">
(#[].projectId#, #[].advertId#, #[].mediaId#)
</iterate>
</insert>