分页查询
分页在网站的应用非常之多:
1.原始的limit进行分页
2.pagehandler分页插件
3.mp其实也内置了分页插件
如何使用:
1.配置拦截器组件
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
测试
@Test
public void testPage(){
Page<User> page = new Page(1,5);
userMapper.selectPage(page,null);
page.getRecords().forEach(System.out::println);