mybatis批量插入
xml
<update id="batchInsert" parameterType="java.util.List">
insert into zn_enterprise_user (enterprise_id,real_name,user_tel,type,create_time,bind_status)
values
<foreach collection="unitUserList" item="user" separator=",">
(#{user.enterpriseId},#{user.realName},#{user.userTel},#{user.type},#{user.createTime},#{user.bindStatus})
</foreach>
</update>
Mapper类
void batchInsert(@Param("unitUserList") List<UnitUser> unitUserList);
foreach标签的collection属性值 unitUserList 要和 Mapper中方法签名的 unitUserList对应