注意问题:
1、当插入失败 事务回滚,逐渐自增策略的话 主键会接着继续递增。
2、最多只能插入1000条
<insert id="batchAddUsers" parameterType="java.util.List">
<!-- <selectKey keyProperty="fetchTime" order="BEFORE"
resultType="java.lang.String">
SELECT CURRENT_TIMESTAMP()
</selectKey> -->
insert into t_user(username,password,age) values
<foreach collection="list" item="users" index="index"
separator=",">
(#{users.username},#{users.password},#{users.age})
</foreach>
</insert>