mybatisplus分页查询

mybatisplus分页查询

mybatisplus实现分页查询步骤

  • 编写配置类注册分页组件

    // 分页插件
    @Bean 
    public PaginationInterceptor paginationInterceptor() { 
        return new PaginationInterceptor(); 
    }
    
  • 分页查询

    @Test 
    public void testPage(){ 
        // 参数一:当前页 
        // 参数二:页面大小 
        Page<User> page = new Page<>(2,5);
        userMapper.selectPage(page,null);
        page.getRecords().forEach(System.out::println);
    }
    
记得快乐
原文地址:https://www.cnblogs.com/Y-wee/p/13899053.html