mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2026-05-29 18:57:11 +08:00
修复Page和PageResult首页调用问题(issue#IH7A18@Gitee)
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
|
||||
# 🚀Changelog
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
# 5.8.45(2026-03-19)
|
||||
# 5.8.45(2026-03-20)
|
||||
### 🐣新特性
|
||||
* 【core 】 `AnnotationUtil`新增两级缓存架构,提升高频注解解析性能(pr#1434@Gitee)
|
||||
|
||||
### 🐞Bug修复
|
||||
* 【db 】 修复`Page`和`PageResult`首页调用问题(issue#IH7A18@Gitee)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
# 5.8.44(2026-03-11)
|
||||
|
||||
@@ -51,7 +51,7 @@ public class Page implements Segment<Integer>, Serializable {
|
||||
* @since 4.5.16
|
||||
*/
|
||||
public Page() {
|
||||
this(0, DEFAULT_PAGE_SIZE);
|
||||
this(PageUtil.getFirstPageNo(), DEFAULT_PAGE_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,7 +61,7 @@ public class Page implements Segment<Integer>, Serializable {
|
||||
* @param pageSize 每页结果数
|
||||
*/
|
||||
public Page(int pageNumber, int pageSize) {
|
||||
this.pageNumber = Math.max(pageNumber, 0);
|
||||
this.pageNumber = Math.max(pageNumber, PageUtil.getFirstPageNo());
|
||||
this.pageSize = pageSize <= 0 ? DEFAULT_PAGE_SIZE : pageSize;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class Page implements Segment<Integer>, Serializable {
|
||||
* @param pageNumber 页码
|
||||
*/
|
||||
public void setPageNumber(int pageNumber) {
|
||||
this.pageNumber = Math.max(pageNumber, 0);
|
||||
this.pageNumber = Math.max(pageNumber, PageUtil.getFirstPageNo());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,7 +38,7 @@ public class PageResult<T> extends ArrayList<T> {
|
||||
* 构造
|
||||
*/
|
||||
public PageResult() {
|
||||
this(0, DEFAULT_PAGE_SIZE);
|
||||
this(PageUtil.getFirstPageNo(), DEFAULT_PAGE_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +50,7 @@ public class PageResult<T> extends ArrayList<T> {
|
||||
public PageResult(int page, int pageSize) {
|
||||
super(pageSize <= 0 ? DEFAULT_PAGE_SIZE : pageSize);
|
||||
|
||||
this.page = Math.max(page, 0);
|
||||
this.page = Math.max(page, PageUtil.getFirstPageNo());
|
||||
this.pageSize = pageSize <= 0 ? DEFAULT_PAGE_SIZE : pageSize;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class PageResult<T> extends ArrayList<T> {
|
||||
* @param page 页码
|
||||
*/
|
||||
public void setPage(int page) {
|
||||
this.page = page;
|
||||
this.page = Math.max(page, PageUtil.getFirstPageNo());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,6 +149,6 @@ public class PageResult<T> extends ArrayList<T> {
|
||||
* @return 是否最后一页
|
||||
*/
|
||||
public boolean isLast() {
|
||||
return this.page >= (this.totalPage - 1);
|
||||
return this.page - PageUtil.getFirstPageNo() >= (this.totalPage - 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user