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

cn.wizzer.framework.page.Pagination Maven / Gradle / Ivy

There is a newer version: 5.2.8-zookeeper
Show newest version
package cn.wizzer.framework.page;

import org.nutz.lang.Lang;

import java.util.List;

public class Pagination extends SimplePage implements java.io.Serializable {
    private static final long serialVersionUID = 1L;

    public Pagination() {
    }

    /**
     * 构造器
     *
     * @param pageNo     页码
     * @param pageSize   每页几条数据
     * @param totalCount 总共几条数据
     */
    public Pagination(int pageNo, int pageSize, int totalCount) {
        super(pageNo, pageSize, totalCount);
    }

    /**
     * 构造器
     *
     * @param pageNo     页码
     * @param pageSize   每页几条数据
     * @param totalCount 总共几条数据
     * @param list       分页内容
     */
    public Pagination(int pageNo, int pageSize, int totalCount, List list) {
        super(pageNo, pageSize, totalCount);
        this.list = list;
    }

    /**
     * 第一条数据位置
     *
     * @return
     */
    public int getFirstResult() {
        return (pageNo - 1) * pageSize;
    }

    /**
     * 当前页的数据
     */
    private List list;

    /**
     * 获得分页内容
     *
     * @return
     */
    public  List getList() {
        return list;
    }

    /**
     * @param classOfT 列表容器內的元素类型
     * @param       列表容器內的元素类型
     * @return
     */
    public  List getList(Class classOfT) {
        return Lang.collection2list(list, classOfT);
    }


    /**
     * 设置分页内容
     *
     * @param list
     */
    public void setList(List list) {
        this.list = list;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy