mybatis插入数据返回自增主键

推荐方法,在xml中加入
true表示返回主键 keyProperty为对应的属性名
useGeneratedKeys="true" keyProperty="id"

返回的主键回赋值到参数对象的id上

发布了47 篇原创文章 · 获赞 16 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/oschina_40730821/article/details/89675390