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

📄 pagesplitutil.java

📁 网上商城代码
💻 JAVA
字号:
package com.fendou.util;

public class PageSplitUtil {
    public static final int pageSize=1;//每页个数
    private int recordCount; //总记录数
    private int pageNo; //当前页数
    
    /**
     * 得到总页数
     * @return int
     */
    public int getPageCount() {
		if(recordCount%pageSize >0){
			return (recordCount/pageSize)+1;
		}else {
			return recordCount/pageSize;
		}
	}	
    /**
	 * 获得查询的开始的记录值
	 * @return int
	 */
    public int getStartIndex(){
    	int maxPage=this.getPageCount();
		if(pageNo==maxPage){
			return recordCount%pageSize==0? pageSize:recordCount%pageSize;
		}
		else{
			return pageSize;
		}
    }
	/**
	 * 获得查询的最后的记录值
	 * @return int
	 */
	public int getEndIndex() {
		return pageNo*pageSize;
	}
	/**
	 * 获得前一页的页数
	 * @return int
	 */
	public int getPreviousPage(){
	    if(pageNo>1)
	        return pageNo-1;
	    else
	    	return 1;
	}
	/**
	 * 获得后一页的页数
	 * @return int
	 */
	public int getNextPage(){
		int maxPage=this.getPageCount();
		if(pageNo<maxPage)
	        return pageNo+1;
	    else
	    	return maxPage;
	}
	
	public int getRecordCount() {
		return recordCount;
	}
	public void setRecordCount(int recordCount) {
		this.recordCount = recordCount;
	}
	public int getPageNo() {
		return pageNo;
	}
	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}
    
    
}

⌨️ 快捷键说明

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