sql 批量插入 insert
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=","> ( #{item.value1}, #{item.value2}, #{item.value3}, #{item.value4}, #{item.value5} ) </foreach> </insert>