springboot 整合mybatisPlus
0.简介
搭配mybatisX使用,可以自动生成mapper.xml文件里面的sql语句
需要手动创建一个mapper文件夹然后在里面创建一个mapper.xml文件
@TableName(“表名”) 表名和bean不一样的时候用这个
@MapperScan(basePackages = {“org.example.mapper”})
//指定扫描的mapper接口所在的包 用在@SpringBootApplication上 解决用太多的@Mapper的问题
1.引入依赖
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.3</version>
</dependency>
2.配置文件
server:
port: 9090
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/springboot_mybatisplus?useSSL=false&useUnicode=true&characterEncoding=UTF-8
username