From 28dd04d3f30712c104e7bf7720034d4054d89343 Mon Sep 17 00:00:00 2001 From: Gallardot Date: Fri, 23 Feb 2024 11:44:04 +0800 Subject: [PATCH] [Bug][API] list paging missing totalpage Signed-off-by: Gallardot --- .../apache/dolphinscheduler/api/utils/PageInfo.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/PageInfo.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/PageInfo.java index d783fcf3427a..53bed3403942 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/PageInfo.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/PageInfo.java @@ -21,6 +21,7 @@ import java.util.List; import lombok.Data; +import lombok.Setter; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -38,6 +39,7 @@ public class PageInfo { /** * total Page */ + @Setter private Integer totalPage; /** * page size @@ -75,4 +77,15 @@ public static PageInfo of(IPage iPage) { public static PageInfo of(Integer currentPage, Integer pageSize) { return new PageInfo<>(currentPage, pageSize); } + + public Integer getTotalPage() { + if (pageSize == null || pageSize == 0) { + pageSize = 7; + } + this.totalPage = + (this.total % this.pageSize) == 0 + ? ((this.total / this.pageSize) == 0 ? 1 : (this.total / this.pageSize)) + : (this.total / this.pageSize + 1); + return this.totalPage; + } }