package org.ccpit.base.controller;

import org.apache.commons.lang.StringUtils;

/**
 * Created by Administrator on 2015/8/13.
 */
public class PageRequest {

    protected int pageNo = 0;
    protected int pageSize = 10;
    protected String orderBy = "";
    protected boolean countTotal = true;

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

    public int getPageSize() {
        return pageSize;
    }

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

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public boolean isCountTotal() {
        return countTotal;
    }

    public void setCountTotal(boolean countTotal) {
        this.countTotal = countTotal;
    }

    public boolean isOrderBySetted() {
        return !(orderBy==null||orderBy.trim().isEmpty());
    }

    public int getOffset() {
        return (this.pageNo - 1) * this.pageSize;
    }

}
