MyBatis 循环插入List数据集合 -- foreach insert List
首先看看常规的Mybatis循环插入List集合中的数据的持久层代码,看看能发现哪些东西;
1、MyBatis(数据持久层)代码:
<insert id="aaa" parameterType="org.java.entity.userEntity">
insert into table_name (id, name, gender, age, addr)
values
<foreach collection="list" item="item" separator=",">