1.去官网复制分页内容 2.拷贝到配置类中
@Configuration
@MapperScan("com.bot.demo.mapper")
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2));
return interceptor;
}
}
3.就可以使用了
Page<Product> page=new Page<>(pageNum,pageSize);
QueryWrapper<Product> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("discribe","123");
page= productService.page(page,queryWrapper);
return page;
|