All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.dyaoming.plugs.Page Maven / Gradle / Ivy

There is a newer version: 0.0.5
Show newest version
package cn.dyaoming.plugs;


import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;



/**
 * 

分页对象

* * @author DYAOMING * @since 2020-05-28 * @version 0.0.4 */ public class Page implements Serializable { private PageInfo pageInfo; private List rows; /** * 静态分页方法 * @param rows 待分页数据 * @param pageSize 页面数量 * @param pageNum 页码 * @return 分页对象 */ public static Page math(List rows, Integer pageSize, Integer pageNum) { Page page = new Page<>(); PageInfo pageInfo = new PageInfo(); pageInfo.setTotal(rows.size()); pageInfo.setPageNum(pageNum); pageInfo.setPageSize(pageSize); pageInfo.math(); page.setPageInfo(pageInfo); page.setRows(new ArrayList<>(rows.subList(pageInfo.getStartRowNum(), pageInfo.getEndRowNum() - pageInfo.getStartRowNum()))); return page; } public PageInfo getPageInfo() { return pageInfo; } public void setPageInfo(PageInfo pageInfo) { this.pageInfo = pageInfo; } public List getRows() { return rows; } public void setRows(List rows) { this.rows = rows; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy