Merge branch '1.0.x' into dev

This commit is contained in:
Charles7c 2023-04-09 00:42:13 +08:00
commit 587698b1ba

View File

@ -47,30 +47,24 @@ import cn.hutool.core.util.StrUtil;
public class PageQuery extends SortQuery { public class PageQuery extends SortQuery {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 默认页码1 */
private static final int DEFAULT_PAGE = 1;
/** 默认每页条数10 */
private static final int DEFAULT_SIZE = 10;
/** /**
* 页码 * 页码
*/ */
@Schema(description = "页码") @Schema(description = "页码")
@Min(value = 1, message = "页码最小值为 {value}") @Min(value = 1, message = "页码最小值为 {value}")
private Integer page; private Integer page = DEFAULT_PAGE;
/** /**
* 每页条数 * 每页条数
*/ */
@Schema(description = "每页条数") @Schema(description = "每页条数")
@Range(min = 1, max = 1000, message = "每页条数(取值范围 {min}-{max}") @Range(min = 1, max = 1000, message = "每页条数(取值范围 {min}-{max}")
private Integer size; private Integer size = DEFAULT_SIZE;
/** 默认页码1 */
private static final int DEFAULT_PAGE = 1;
/** 默认每页条数10 */
private static final int DEFAULT_SIZE = 10;
public PageQuery(Integer page, Integer size) {
this.setPage(page);
this.setSize(size);
}
/** /**
* 基于分页查询条件转换为 MyBatis Plus 分页条件 * 基于分页查询条件转换为 MyBatis Plus 分页条件
@ -92,12 +86,4 @@ public class PageQuery extends SortQuery {
} }
return mybatisPage; return mybatisPage;
} }
public void setPage(Integer page) {
this.page = page == null ? DEFAULT_PAGE : page;
}
public void setSize(Integer size) {
this.size = size == null ? DEFAULT_SIZE : size;
}
} }