场景: 我们在用 insert 语句插入一天语句的时候,希望得到这条数据的主键ID(在主键是自增的情况下),如何来实现了。
service 里面还要加上这个
以上是要给insert语句, 可以看到新加了一个 <selectKey> 标签,这就是mybatis 实现的方法
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
PS : 注意 <selectKey> 标签 是 select last_insert_id() 这个last_insert_id 是一个方法 不要忘记了后面的括号哦 。
上面的 group_id 是主键, insert 的时候不能省略