This is an automated email from the ASF dual-hosted git repository.
zihaoxiang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new eb2a75b3b7 [Bug][API] list paging missing totalpage (#15619)
eb2a75b3b7 is described below
commit eb2a75b3b798b70e697505b42500e0aacdd45864
Author: Gallardot <[email protected]>
AuthorDate: Fri Feb 23 13:57:54 2024 +0800
[Bug][API] list paging missing totalpage (#15619)
Signed-off-by: Gallardot <[email protected]>
---
.../org/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 d783fcf342..53bed34039 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.Collections;
import java.util.List;
import lombok.Data;
+import lombok.Setter;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -38,6 +39,7 @@ public class PageInfo<T> {
/**
* total Page
*/
+ @Setter
private Integer totalPage;
/**
* page size
@@ -75,4 +77,15 @@ public class PageInfo<T> {
public static <T> PageInfo<T> 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;
+ }
}