You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
webcrawler/db/src/main/java/db/form/PageResult.java

107 lines
2.1 KiB

package db.form;
import db.model.AbstractModel;
import java.util.List;
public class PageResult<T extends AbstractModel> {
private long count;
private int currentPage;
private List<T> datas;
private int pageSize;
private long pages;
private Type type;
private String errorMsg;
public PageResult() {
}
/**
*
* @param count 总行数
* @param currentPage 当前分页数
* @param datas 数据
* @param pageSize 分页大小
* @param type 操作结果
*/
public PageResult(long count, int currentPage, List<T> datas, int pageSize, Type type) {
this.count = count;
this.currentPage = currentPage+1;
this.datas = datas;
this.pageSize = pageSize;
this.pages=count%pageSize==0?count/pageSize:count/pageSize+1;
this.type = type;
}
public PageResult(Type type, String errorMsg) {
this.type = type;
this.errorMsg = errorMsg;
}
public PageResult(int currentPage, int pageSize) {
this.currentPage = currentPage;
this.pageSize = pageSize;
}
public long getCount() {
return count;
}
public void setCount(long count) {
this.count = count;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public List<T> getDatas() {
return datas;
}
public void setDatas(List<T> datas) {
this.datas = datas;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public long getPages() {
return pages;
}
public void setPages(long pages) {
this.pages = pages;
}
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
}