mybatis 一种高效的批量插入

 1 <insert id="insertByBatch" useGeneratedKeys="false">
 2 
 7 insert into TBL_GIFT_TIMESEND_ROSTERINFO (
 8 ROSTER_NAME,
 9 SEND_ID,
10 USER_ACCOUNT,
11 GIFTPACKAGES_ID,
12 GAME_ID,
13 AREA_ID,
14 SERVER_ID,
15 SEND_NUM,
16 GAME_NAME,
17 AREA_NAME,
18 SERVER_NAME)
19 
20 <foreach collection="list" item="item" index="index" separator="UNION ALL"> 
21 SELECT
22 #{item.rosterName},
23 #{item.sendId},
24 #{item.userAccount},
25 #{item.giftpackagesId},
26 #{item.gameId},
27 #{item.areaId},
28 #{item.serverId},
29 #{item.sendNum},
30 #{item.gameName},
31 #{item.areaName},
32 #{item.serverName}
33 FROM DUAL
34 foreach>
35 insert>

 

转载于:https://www.cnblogs.com/wentao365/p/3408898.html

你可能感兴趣的:(mybatis 一种高效的批量插入)