From 2f21f293c199ae596efeff080c76dc0f285e8faa Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期四, 04 十一月 2021 10:32:18 +0800 Subject: [PATCH] update 基于 hutool 封装树构建工具 重构部门与菜单树结构返回 --- ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java | 43 +++++++++++++++++++++++++++---------------- 1 files changed, 27 insertions(+), 16 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java index 889d549..79d889c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java @@ -10,6 +10,13 @@ import java.util.Collections; import java.util.List; +/** + * 鍒嗛〉 Page 澧炲己瀵硅薄 + * + * @param <T> 鏁版嵁搴撳疄浣� + * @param <K> vo瀹炰綋 + * @author Lion Li + */ @Data @Accessors(chain = true) public class PagePlus<T,K> implements IPage<T> { @@ -93,14 +100,6 @@ this.isSearchCount = isSearchCount; } - public boolean hasPrevious() { - return this.current > 1L; - } - - public boolean hasNext() { - return this.current < this.getPages(); - } - @Override public String countId() { return this.getCountId(); @@ -131,15 +130,27 @@ return this.optimizeCountSql; } - @Override - public boolean isSearchCount() { - return this.total >= 0L && this.isSearchCount; - } + @Override + public long getPages() { + // 瑙e喅 github issues/3208 + return IPage.super.getPages(); + } - public PagePlus<T, K> setSearchCount(boolean isSearchCount) { - this.isSearchCount = isSearchCount; - return this; - } + public static <T,K> PagePlus<T,K> of(long current, long size) { + return of(current, size, 0); + } + + public static <T,K> PagePlus<T,K> of(long current, long size, long total) { + return of(current, size, total, true); + } + + public static <T,K> PagePlus<T,K> of(long current, long size, boolean searchCount) { + return of(current, size, 0, searchCount); + } + + public static <T,K> PagePlus<T,K> of(long current, long size, long total, boolean searchCount) { + return new PagePlus<>(current, size, total, searchCount); + } } -- Gitblit v1.9.3