springboot+layui有关分页问题

10次阅读
没有评论

问题描述

分页不生效明明可以分页 但是后端接收到的pagenum始终是1

springboot+layui有关分页问题

 

springboot+layui有关分页问题


 springboot+layui有关分页问题

springboot+layui有关分页问题

 

提示:这里描述项目中遇到的问题:

例如:分页出问题

@Override
public Result selectAll(Integer page,Integer size) {
    //启动分页
    PageHelper.startPage(page,size);
    //查询所有数据进行分页
    List<PropertyNotice> notices = propertyNoticeMapper.selectAll();
    PageInfo<PropertyNotice> pageInfo = new PageInfo<>(notices);
    return Result.ok().msg("").count(notices.size()).data(pageInfo);
}

原因分析:

提示:这里填写问题的分析:通过对前端数据源的打印可以知道这里的count数据是不对的,这里本来应该是总条数却变成了我们的设置数,那么就默认这样也只有这么多数据,自然也就不能分页,不能点击下一页

springboot+layui有关分页问题


 

解决方案:

提示:这里填写该问题的具体解决方案:解决办法就是只需要把count还原为总数据条数,而不是分页之后的条数,或者直接使用total

springboot+layui有关分页问题

这样前端就没问题了

springboot+layui有关分页问题

springboot+layui有关分页问题 

 

 

正文完
 0