Browse Source

[Bug][API] list paging missing totalpage (#15619)

Signed-off-by: Gallardot <gallardot@apache.org>
3.2.2-prepare
Gallardot 10 months ago committed by GitHub
parent
commit
eb2a75b3b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 13
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/PageInfo.java

13
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;
}
}

Loading…
Cancel
Save