首页 > 编程语言 > 详细

springboot mybatis pagehelper 分页问题

时间:2018-10-28 10:15:38      阅读:93      评论:0      收藏:0      [点我收藏+]

1:添加依赖

compile group: ‘com.github.pagehelper‘, name: ‘pagehelper-spring-boot-starter‘, version: ‘1.2.9‘
注意:在spring-boot中一定要使用 pagehelper-spring-boot-starter而不是pagehelper,否则分页不起作用。

2:应用案例

@RequestMapping(
            value = "/page",
            method = RequestMethod.GET
    )
    public ResultVo getUserPages(@RequestParam Integer pageNum, @RequestParam Integer pageSize){
        PageHelper.startPage(pageNum, pageSize);//一定要在userMapper.getUsers()之前执行
        List<UserVo> list = userMapper.getUsers();
        PageInfo<UserVo> pageInfo = new PageInfo<>(list,pageSize);

        return ResultUtil.dealPageResult(pageInfo, "用户分页信息");
    }

 

springboot mybatis pagehelper 分页问题

原文:https://www.cnblogs.com/yshyee/p/9864539.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!