1、xml
<insert id="batchInsertIssues" useGeneratedKeys="true" keyProperty="issueId" parameterType="java.util.List">
insert into biz_issue
<trim prefix="(" suffix=")">
sumary, issue_type
</trim>
values
<foreach collection="list" item="issue" separator="," >
<trim prefix="(" suffix=")" suffixOverrides=",">
#{issue.sumary}, #{issue.issueType}
</trim>
</foreach>
</insert>
重点
useGeneratedKeys="true"
keyProperty="issueId"
2、mapper
int batchInsertIssues(List<Issue> issueList);
3、返回的id存在于参数List<Issue>里Issue对象中的issueId字段中
千万不可用List<Integer>, Collection<Integer>去接收返回的Id,会提示不支持此方法