批量插入的Mapper.xml配置:
<insert id="insertSelectiveBatch" parameterType="java.util.List">
insert into bgcatemenu
(sid_lv1,name_lv1,sid_lv2,name_lv2,sid_lv3,name_lv3,sid_lv4,name_lv4,sid_lv5,name_lv5,bak1,bak2,bak3,bak4,bak5)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.sidLv1},#{item.nameLv1},#{item.sidLv2},#{item.nameLv2},#{item.sidLv3},#{item.nameLv3},#{item.sidLv4},
#{item.nameLv4},#{item.sidLv5},#{item.nameLv5},#{item.bak1},#{item.bak2},#{item.bak3},#{item.bak4},#{item.bak5})
</foreach>
</insert>
映射类(接口):
public interface BgcatemenuMapper {
void insertSelectiveBatch(List<Bgcatemenu> records);
}