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

com.tmsps.ne4spring.page.Page Maven / Gradle / Ivy

There is a newer version: 999.0.0.0
Show newest version
/**
 * 
 */
package com.tmsps.ne4spring.page;

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

import com.alibaba.fastjson2.JSON;

import lombok.Data;

/**
 * 
 * @author zhangwei [email protected]
 *
 */
@Data
public class Page implements Serializable {
	private static final long serialVersionUID = -1936470346516905569L;
	
	private List> list = new ArrayList>();
	private int pageNumber = 1;
	private int pageSize = 8;
	private int totalPage = 1;
	private int totalRow = 0;
	//是否第一页
	private boolean isFrist = false;
	//是否最后一页
	private boolean isLast = false;
	//是否有前一页
	private boolean isHavePrevious = false;
	//是否有后一页
	private boolean isHaveNext = false;

	public Page() {}
	
	public Page(int pageNumber,int pageSize) {
		this.pageNumber = pageNumber;
		this.pageSize = pageSize;
	}

	public Page(List> result, int pageNumber, int pageSize,
			int totalPage, int totalRow) {
		this.list = result;
		this.pageNumber = pageNumber;
		this.pageSize = pageSize;
		this.totalPage = totalPage;
		this.totalRow = totalRow;
		/**
		 *  @author zhangwei 2022/09/09
		 */
		this.isFrist = (pageNumber == 1);
		this.isLast = (pageNumber == totalPage);
		this.isHavePrevious = (pageNumber > 1);
		this.isHaveNext = (pageNumber < totalPage);
	}

	public String toJsonString() {
		return JSON.toJSONString(this);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy