首页 > 编程语言 > 详细

spring mybatis 批量插入返回主键

时间:2017-02-24 16:09:58      阅读:196      评论:0      收藏:0      [点我收藏+]

1.模型

public class AzTest {
private Integer id;

private Integer age;

private String title;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public Integer getAge() {
return age;
}

public void setAge(Integer age) {
this.age = age;
}

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title == null ? null : title.trim();
}
}

2.mapper
void insertAll(List<AzTest> list);

3.xml

<insert id="insertAll" parameterType="AzTest" keyProperty="id" useGeneratedKeys="true">
insert into az_test(age,title)
VALUES
(#{age},#{title})
</insert>

spring mybatis 批量插入返回主键

原文:http://www.cnblogs.com/azbo/p/6438882.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!