dao层
public int xxx(@Param("lists")List<Map<String, Object>> listMap);
mapper
<insert id="xxx" parameterType="java.util.List">
<foreach collection="lists" item="maps" index="maps" separator=";">
insert into user
<foreach item="key" index="key" collection="maps.keySet()" separator="," open="(" close=")">
${key}
</foreach>
values
<foreach item="value" index="value" collection="maps.entrySet()" separator="," open="(" close=")">
#{value}
</foreach>
</foreach>
</insert>
*springboot+mybatis项目使用这个若是报错得话可以在:application.properties加上下边得试试:allowMultiQueries=true
spring.datasource.url = jdbc:mysql://localhost:3306/xxx?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&allowMultiQueries=true