mapper
void saveRecordsBatch(@Param("list") List<msgsenddetailrecord> list);
xml:注意,连接符是UNION ALL
<insert id="saveRecordsBatch">
insert into msg_send_detail_record
select SEQ_MSG_SEND_DETAIL_RECORD.nextval,A.* from (
<foreach collection="list" item="item" index="index" separator="UNION ALL">
select
#{item.batchId},
#{item.userId},
#{item.phone},
#{item.status},
#{item.sendDelayTime},
#{item.remarks},
#{item.del},
#{item.ct},
#{item.cu},
#{item.lmt},
#{item.lmu}
from dual
</foreach>
) A
</insert>
本文介绍了如何使用Oracle的mapper接口实现批量插入消息发送详细记录,通过foreach循环和UNIONALL连接符执行SQL插入语句。
9190

被折叠的 条评论
为什么被折叠?



