09 2022 档案
摘要:问题: 我们想在插入一条数据后同时能够返回这条数据在表中的id,Mybatis提供了@SelectKey注解。 student 为数据表,主键自增 SelectKey的四个属性: selectKey 会将 SELECT LAST_INSERT_ID()的结果放入到传入的实体类的主键里面, keyPr
阅读全文
摘要:需求场景 在项目开发过程中,难免会遇到这样的场景:对一张表,当数据不存在的时候,进行insert插入操作;数据存在的时候,进行update更新操作; 下面就来使用Mybatis的InsertOrUpdate功能来实现一下: 具体实现 关于SpringBoot集成Mybatis可以参考:https:/
阅读全文
摘要: | 作用范围 | API | API常用参数 | 作用位置 | | : : | : : | : : | : : | | 协议集描述 | @Api | @Api(tags = {"tag1","tag2","..."}) | controller类 | | 协议描述 | @ApiOperation
阅读全文
摘要:推荐写法 <select id="getByNameGood" parameterType="string" resultType="com.javaone.passmybatis.entity.Student"> select s.age, s.email, s.id, s.name from s
阅读全文
摘要:第一种方法(推荐) 在application.yml(.properties)中增加配置,在控制台打印sql: mybatis: mapper-locations: - classpath:mapper/*.xml configuration: log-impl: org.apache.ibatis
阅读全文
摘要:添加 项目依赖 点击查看代码 <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-boot-starter</artifactId> <version>3.0.0</version> </dependency> 添加一
阅读全文
摘要:一、scope作用域介绍 Maven的一个哲学是约定大于配置,所以在maven中,很多内容都有默认值,scope的默认值是compile。 scope元素的作用:控制 dependency(依赖)元素的使用范围。 通俗的讲,就是控制 Jar 包在哪些范围被加载和使用。这个范围包括,编译、测试、运行,
阅读全文
摘要:使用idea直接创建springboot项目时,访问https://start.spring.io很慢,甚至访问不了,可以更换为阿里云路径https://start.aliyun.com/
阅读全文