首页>代码>SpringBoot+Quartz动态定时任务>/SpringBootDynamicTask/src/main/java/com/simon/springbootdynamictask/common/ApiResultPagingHelper.java
package com.simon.springbootdynamictask.common;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.util.List;

/**
 * @author author
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
public class ApiResultPagingHelper<T, D> extends ApiResultHelper {

    private static final long serialVersionUID = -322702665364049413L;

    /**
     * 记录列表
     */
    List<T> content;

    /**
     * 记录总数
     */
    Long total;

    /**
     * 分页参数
     */
    Long pageSize;

    /**
     * 当前页数
     */
    Long page;

    Long pageCount;

    /**
     * 增加数据
     */
    private D data;


    /**
     * @param varl
     * @param total    记录总数
     * @param pageSize 分页参数
     * @param page     当前页数
     * @param content  记录列表
     * @param var2
     */
    public ApiResultPagingHelper(String varl, Long total, Long pageSize, Long page, List<T> content, D var2) {
        super(varl);
        this.total = total;
        this.pageSize = pageSize;
        this.page = page;
        this.content = content;
        this.data = var2;
    }

    public ApiResultPagingHelper(String varl, Long total, Integer pageSize, Integer page, List<T> content) {
        super(varl);
        if (null == total) {
            total = 0L;
        }
        if (pageSize == null) {
            pageSize = 0;
        }
        if (null == page) {
            page = 0;
        }
        this.total = total;
        this.pageSize = Long.valueOf(pageSize);
        this.page = Long.valueOf(page);
        this.content = content;
        this.data = null;
    }

    public ApiResultPagingHelper(String varl, Long total, Long pageSize, Long page, List<T> content) {
        super(varl);
        this.total = total;
        this.pageSize = pageSize;
        this.page = page;
        this.content = content;
        this.data = null;
    }

    Long getPageCount() {
        return (long) Math.ceil(this.total / this.pageSize);
    }

    public List<T> getContent() {
        return content;
    }

    public void setContent(List<T> content) {
        this.content = content;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public Long getPageSize() {
        return pageSize;
    }

    public void setPageSize(Long pageSize) {
        this.pageSize = pageSize;
    }

    public Long getPage() {
        return page;
    }

    public void setPage(Long page) {
        this.page = page;
    }

    public D getData() {
        return data;
    }

    public void setData(D data) {
        this.data = data;
    }
}
最近下载更多
shuangfu  LV25 2023年10月25日
xp95323  LV14 2023年5月23日
Oxygeni  LV4 2023年4月26日
sunlzh888888  LV28 2023年4月23日
我们都是小怪兽  LV3 2023年2月17日
Hachi6  LV13 2022年11月30日
Rommel  LV27 2022年11月27日
啦啦啦7719  LV15 2022年11月2日
1529860026  LV24 2022年10月10日
ewan007  LV29 2022年9月25日
最近浏览更多
Gaodaima  LV6 4月10日
zjjhzjb  LV14 3月20日
Gin19960217  LV4 1月19日
heanan 1月18日
暂无贡献等级
kkkxyh  LV13 2023年12月7日
内心向阳  LV4 2023年11月7日
shuangfu  LV25 2023年10月25日
graceful 2023年10月18日
暂无贡献等级
yuning1993  LV6 2023年9月19日
zh11332  LV11 2023年9月12日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友