导入依赖
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.0</version>
</dependency>配置
数据源配置
spring
datasource
username root
password root
url jdbc mysql //192.168.85.128 3306/guli_pms?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false
driver-class-name com.mysql.jdbc.DrivermybatisPlus配置
使用 @MapperScan 扫描接口层
// 添加在启动类上
("com.atguigu.gulimall.product.dao")告诉MyBatis-Plus, sql映射文件的位置
mybatis-plus
mapper-locations classpath /mapper/**/*.xml配置主键自增
mybatis-plus
mapper-locations classpath /mapper/**/*.xml
global-config
db-config
id-type auto