public class PaginationResultVo<T> {
private Integer totalCount;//获取总记录数
private Integer pageSize;//获取每页记录数
private Integer pageNo;//获取当前页码
private Integer pageTotal;//获取总页数
private List<T> list = new ArrayList<T>();//获取当前页的数据列表
public PaginationResultVo(Integer totalCount, Integer pageSize, Integer pageNo, List<T> list) {
this.totalCount = totalCount;
this.pageSize = pageSize;
this.pageNo = pageNo;
this.list = list;
}
public PaginationResultVo(Integer totalCount, Integer pageSize, Integer pageNo, Integer pageTotal, List<T> list) {
if (pageNo == 0){
pageNo = 1;
}
this.totalCount = totalCount;
this.pageSize = pageSize;
this.pageNo = pageNo;
this.pageTotal = pageTotal;
this.list = list;
}
public Integer getTotalCount() {
return totalCount;
}
public void setTotalCount(Integer totalCount) {
this.totalCount = totalCount;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Integer getPageNo() {
return pageNo;
}
public void setPageNo(Integer pageNo) {
this.pageNo = pageNo;
}
public Integer getPageTotal() {
return pageTotal;
}
public void setPageTotal(Integer pageTotal) {
this.pageTotal = pageTotal;
}
public List<T> getList() {
return list;
}
public void setList(List<T> list) {
this.list = list;
}
}
VO(Value Object)值对象:
值对象是一种用于封装特定数据的简单对象,通常用于在不同层之间传递数据。VO通常是只读的,它的属性在创建后不可变。值对象通常与业务概念直接相关,可以包含多个属性,但通常不包含业务逻辑。VO主要用于数据展示和数据传输的目的,例如在前端页面显示数据。