码迷,mamicode.com
首页 > 编程语言 > 详细

spring mybatis 批量插入返回主键

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

标签:etag   rate   public   str   generate   class   private   模型   插入   

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 批量插入返回主键

标签:etag   rate   public   str   generate   class   private   模型   插入   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!