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

com.soento.core.lang.BaseQuery Maven / Gradle / Ivy

package com.soento.core.lang;

/**
 * @author yantao.zeng
 */
public abstract class BaseQuery extends BaseEntity {
    /**
     * 查询页数
     */
    protected int index;
    /**
     * 分页步长
     */
    protected int limit;
    /**
     * 开始位置
     */
    protected int start;
    /**
     * 结束位置
     */
    protected int end;

    public BaseQuery() {
        setIndex(0);
        setLimit(10);
    }

    public BaseQuery(int index, int limit) {
        setIndex(index);
        setLimit(limit);
    }

    public void setIndex(int index) {
        this.index = index;
        setStart();
        setEnd();
    }

    public void setLimit(int limit) {
        this.limit = limit;
        setStart();
        setEnd();
    }

    private void setStart() {
        this.start = this.index * this.limit;
    }

    private void setEnd() {
        this.end = this.start + this.limit - 1;
    }


    public int getIndex() {
        return index;
    }

    public int getLimit() {
        return limit;
    }

    public int getStart() {
        return start;
    }

    public void setStart(int start) {
        this.start = start;
    }

    public int getEnd() {
        return end;
    }

    public void setEnd(int end) {
        this.end = end;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy