我是靠谱客的博主 大气黑猫,最近开发中收集的这篇文章主要介绍PageInfo 工具类,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

package com.jsy.basic.util;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public class PageInfo<T> implements Serializable {
private static final long serialVersionUID = 8545991263226528798L;
@ApiModelProperty(value = "每页数据")
private List<T> records;
@ApiModelProperty(value = "总记录数")
private long total;
@ApiModelProperty(value = "每页记录数")
private long size;
@ApiModelProperty(value = "当前页")
private long current;
@ApiModelProperty(value = "附加数据")
private Map<String,Object> extra;
public PageInfo() {
this.records = Collections.emptyList();
this.total = 0L;
this.size = 10L;
this.current = 1L;
}
public PageInfo(long current, long size) {
this(current, size, 0L);
}
public PageInfo(long current, long size, long total) {
this(current, size, total, true);
}
public PageInfo(long current, long size, boolean isSearchCount) {
this(current, size, 0L, isSearchCount);
}
public PageInfo(long current, long size, long total, boolean isSearchCount) {
this.records = Collections.emptyList();
this.total = 0L;
this.size = 10L;
this.current = 1L;
if (current > 1L) {
this.current = current;
}
this.size = size;
this.total = total;
}
public List<T> getRecords() {
return this.records;
}
public PageInfo<T> setRecords(List<T> records) {
this.records = records;
return this;
}
public long getTotal() {
return this.total;
}
public PageInfo<T> setTotal(long total) {
this.total = total;
return this;
}
public long getSize() {
return this.size;
}
public PageInfo<T> setSize(long size) {
this.size = size;
return this;
}
public long getCurrent() {
return this.current;
}
public PageInfo<T> setCurrent(long current) {
this.current = current;
return this;
}
public Map<String, Object> getExtra() {
return extra;
}
public void setExtra(Map<String, Object> extra) {
this.extra = extra;
}
}

最后

以上就是大气黑猫为你收集整理的PageInfo 工具类的全部内容,希望文章能够帮你解决PageInfo 工具类所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(55)

评论列表共有 0 条评论

立即
投稿
返回
顶部