一,SpringBoot(带MYbatisplus)搭建
一,创建Springboot项目
二,不用最新版本,版本改为2.3
三,添加mybatis-plus依赖, 和配置
com.baomidou mybatis-plus-boot-starter 3.4.3#mybatis-plus的配置
mybatis-plus:
mapper-locations: classpath*:mapper/*Mapper.xml
type-aliases-package: com.fs.user.pojo
四,搭建需要的包
五,构建数据库表和实体类
六,配置数据源,并把后置改为yml
七,创建和扫描mapper接口
八,需要mabitspuls就继承并在POM配置
九 配置日志
十,配置分页插件,不配方法无效
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor(){
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
paginationInnerInterceptor.setDbType(DbType.MYSQL);
interceptor.addInnerInterceptor(paginationInnerInterceptor);
return interceptor;
}