⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reducepage.java

📁 提供hibernate,spring
💻 JAVA
字号:
package phz.util.page;

public class ReducePage {

	private int currentPage;
	private int pageSize;
	private int totalSize;
	private int totalPage;

	public ReducePage(int currentPage, int totalSize, int pageSize) {
		this.currentPage = currentPage;
		this.totalSize = totalSize;
		this.pageSize = pageSize;

	}

	public ReducePage(int currentPage, int totalSize) {
		this.currentPage = currentPage;
		this.totalSize = totalSize;
		this.pageSize = 5;
	}

	public ReducePage(int totalSize) {
		this.currentPage = 1;
		this.totalSize = totalSize;
		this.pageSize = 5;
	}

	public boolean isHasFirst() {
		if (getCurrentPage() == 1)
			return false;
		return true;
	}

	public boolean isHasLast() {
		if (getCurrentPage() == getTotalPage())
			return false;
		return true;
	}

	public boolean isHasPrevious() {
		if (isHasFirst())
			return true;
		return false;
	}

	public boolean isHasNext() {
		if (isHasLast())
			return true;
		return false;
	}

	public int getCurrentPage() {
		if (currentPage < 1 || currentPage > getTotalPage()) {
			return 1;
		}
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getTotalSize() {
		return totalSize;
	}

	public void setTotalSize(int totalSize) {
		this.totalSize = totalSize;
	}

	public int getTotalPage() {
		totalPage = getTotalSize() / getPageSize();
		if (getTotalSize() % getPageSize() != 0)
			totalPage++;
		return totalPage;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -