INSERT INTO table ( "clo1", "col2", "col3", "col4", "col5" )
VALUES
( 1, 10, NULL, ‘2019-12-19 13:38:35‘, ‘新年活动16张卡券‘),
( 2, 11, NULL, ‘2019-12-19 15:05:13‘, ‘圣诞活动11张卡券‘),
( 3, 12, NULL, ‘2019-12-19 15:05:13‘, ‘圣诞活动12张卡券‘),
( 4, 13, NULL, ‘2019-12-19 15:05:13‘, ‘圣诞活动13张卡券‘);
mybatis批量插入处理
<insert id="batchInsert" parameterType="java.util.List">insert into table(
col1, col2, col3, col4, col5) values <foreach collection="list" item="item" separator="," open="(", close=")"> #{item.value1}, #{item.value2}, #{item.value3}, #{item.value4}, #{item.value5} </foreach></insert>
原文地址:https://www.cnblogs.com/mjbenkyo/p/12067982.html
时间: 2024-12-28 13:47:37