简单分页用的page类

来源:互联网 发布:知乎miya的米牙 编辑:程序博客网 时间:2024/05/15 14:11

public class Page {


    private Integer pageNo;
    private Integer pageSize;
    private Integer totleCount;
    private Integer totlePage;


    /**
     *
     */
    public Page() {
        this(1,5);
    }
    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "Page [pageNo=" + pageNo + ", pageSize=" + pageSize
                + ", totleCount=" + totleCount + ", totlePage=" + totlePage
                + ", id=" + id + ", tle=" + tle + ", name=" + name + "]";
    }
    /**
     * @return the pageNo
     */
    public Integer getPageNo() {
        return pageNo;
    }
    /**
     * @param pageNo the pageNo to set
     */
    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }
    /**
     * @return the pageSize
     */
    public Integer getPageSize() {
        return pageSize;
    }
    /**
     * @param pageSize the pageSize to set
     */
    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
    /**
     * @return the totleCount
     */
    public Integer getTotleCount() {
        return totleCount;
    }
    /**
     * @param totleCount the totleCount to set
     */
    public void setTotleCount(Integer totleCount) {
        this.totleCount = totleCount;
        this.totlePage=(this.totleCount%this.pageSize==0)?this.totleCount/this.pageSize:(this.totleCount/this.pageSize)+1;
    }
    /**
     * @return the totlePage
     */
    public Integer getTotlePage() {
        return totlePage;
    }
    /**
     * @param totlePage the totlePage to set
     */
    public void setTotlePage(Integer totlePage) {
        this.totlePage = totlePage;
    }
    /**
     * @return the id
     */
    public Integer getId() {
        return id;
    }
    /**
     * @param id the id to set
     */
    public void setId(Integer id) {
        this.id = id;
    }
    /**
     * @return the tle
     */
    public Integer getTle() {
        return tle;
    }
    /**
     * @param tle the tle to set
     */
    public void setTle(Integer tle) {
        this.tle = tle;
    }
    /**
     * @return the name
     */
    public String getName() {
        return name;
    }
    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }
    /**
     * @param pageNo
     * @param pageSize
     */
    public Page(Integer pageNo, Integer pageSize) {
        super();
        this.pageNo = pageNo;
        this.pageSize = pageSize;
    }
    public Integer getPageindex(){
        return (this.pageNo-1)*pageSize;
    }

    
}