feat:(REQ-2545) pageResp增加hasNext方法

This commit is contained in:
lilong 2024-06-18 16:25:23 +08:00
parent a95e2cc449
commit 22b96eb698

View File

@ -25,4 +25,22 @@ public class PageResp<T> {
public List<T> getData() {
return Optional.ofNullable(data).orElse(ImmutableList.of());
}
public boolean hasNext() {
return this.current < this.getPages();
}
public long getPages() {
if (this.getSize() == 0L) {
return 0L;
}
long pages = this.getTotal() / this.getSize();
if (this.getTotal() % this.getSize() != 0L) {
++pages;
}
return pages;
}
}