前后台分页

<el-pagination style="text-align: center" layout="prev, pager, next" :total="Page.total" :page-size="Page.pageSize" @current-change="handleCurrentChange" />


Page: { pageSize: 10, total: 0, pageIndex: 1 }

handleCurrentChange(value) {
      this.Page.pageIndex = value
      this.select()
}


import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

controller

Page<FaultrepairStatistics> list = constructionStatisticsService.getFaultrepairStatistics(pageIndex,pageSize);
return new ControllerResult<>(true, list, list.getTotal());

//serviceimpl
@Override
public Page<FaultrepairStatistics> getFaultrepairStatistics(int pageIndex, int pageSize) {
    PageHelper.startPage(pageIndex,pageSize);
    return constructionStatisticsDao.getFaultrepairStatistics();
}
//mapper
Page<SpecialInspectionDTO> getFaultrepairStatistics();

当然也可以用或者 PageInfo包装数据

PageInfo<TbItem> pageInfo = new PageInfo<TbItem>(list);

分页数据更加详细 不常用

posted @ 2021-10-20 15:02  李广龙  阅读(40)  评论(0)    收藏  举报