文章目录
Mybatis-plus如何使用分页
1.写个Mybatis-plus配置类:
是通过拦截器实现分页
@Configuration
public class MybatisConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
}
官网复制即可,只是你需要把数据库改为你使用的,这里我是使用mysql