![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
mybatis
小白伐
这个作者很懒,什么都没留下…
展开
-
MyBatis动态SQL
配置依赖 <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.2.0</version> </dependency> 在Spri.原创 2022-01-14 16:14:24 · 258 阅读 · 0 评论 -
mybatis使用注解方式插入数据后获取自增长的主键值
步骤有三: 写SQL,但不要自己插入主键值 配置 @Options(useGeneratedKeys=true, keyProperty=“对象.属性”) 这个的作用是设置是否使用JDBC的getGenereatedKeys()方法获取主键并赋值到keyProperty设置的对象的属性中,说白了就是把自增长的主键值赋值给对象相应的属性 3. 在插入后,使用 对象.主键属性的getXXId()方法 获取主键值 @Insert("INSERT INTO api(component, clientAp原创 2021-12-22 18:51:10 · 124 阅读 · 0 评论