package com.finance.common.basic; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.io.Serializable; import java.util.List; /** * @Author liheng * @Date 2019/08/26 10:28 AM * @Description */ @JsonIgnoreProperties({"orders", "optimizeCountSql", "hitCount", "countId", "maxLimit", "searchCount"}) public class PageInfo extends Page implements Serializable { private static final long serialVersionUID = 1L; private boolean hasNextPage; private boolean hasPrevPage; private long startIndex; public PageInfo(long currentPage, long pageShowCount) { super(currentPage, pageShowCount); this.startIndex = super.offset(); } public PageInfo() { super(); } private static boolean hasPrevPage(long currentPage) { return currentPage != 1; } @Override public PageInfo setRecords(List records) { super.setRecords(records); this.hasNextPage = super.hasNext(); this.hasPrevPage = super.hasPrevious(); return this; } public boolean getHasNextPage() { return hasNextPage; } public void setHasNextPage(boolean hasNextPage) { this.hasNextPage = hasNextPage; } public boolean getHasPrevPage() { return hasPrevPage; } public void setHasPrevPage(boolean hasPrevPage) { this.hasPrevPage = hasPrevPage; } private boolean hasNextPage(long currentPage, long totalPage) { return currentPage < totalPage && totalPage != 0; } public long getStartIndex() { return startIndex; } public void setStartIndex(long startIndex) { this.startIndex = startIndex; } }