mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 22:57:17 +08:00 
			
		
		
		
	优化:优化分页查询条件
This commit is contained in:
		| @@ -19,6 +19,7 @@ package top.charles7c.cnadmin.common.model.query; | |||||||
| import javax.validation.constraints.Min; | import javax.validation.constraints.Min; | ||||||
|  |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
|  | import lombok.NoArgsConstructor; | ||||||
|  |  | ||||||
| import io.swagger.v3.oas.annotations.media.Schema; | import io.swagger.v3.oas.annotations.media.Schema; | ||||||
|  |  | ||||||
| @@ -41,6 +42,7 @@ import cn.hutool.core.util.StrUtil; | |||||||
|  */ |  */ | ||||||
| @Data | @Data | ||||||
| @ParameterObject | @ParameterObject | ||||||
|  | @NoArgsConstructor | ||||||
| @Schema(description = "分页查询条件") | @Schema(description = "分页查询条件") | ||||||
| public class PageQuery extends SortQuery { | public class PageQuery extends SortQuery { | ||||||
|  |  | ||||||
| @@ -64,12 +66,6 @@ public class PageQuery extends SortQuery { | |||||||
|     private static final int DEFAULT_PAGE = 1; |     private static final int DEFAULT_PAGE = 1; | ||||||
|     /** 默认每页条数:10 */ |     /** 默认每页条数:10 */ | ||||||
|     private static final int DEFAULT_SIZE = 10; |     private static final int DEFAULT_SIZE = 10; | ||||||
|     /** 默认每页最大条数:1000 */ |  | ||||||
|     private static final int DEFAULT_MAX_SIZE = 1000; |  | ||||||
|  |  | ||||||
|     public PageQuery() { |  | ||||||
|         this(DEFAULT_PAGE, DEFAULT_SIZE); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public PageQuery(Integer page, Integer size) { |     public PageQuery(Integer page, Integer size) { | ||||||
|         this.setPage(page); |         this.setPage(page); | ||||||
| @@ -102,12 +98,6 @@ public class PageQuery extends SortQuery { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void setSize(Integer size) { |     public void setSize(Integer size) { | ||||||
|         if (size == null) { |         this.size = size == null ? DEFAULT_SIZE : size; | ||||||
|             this.size = DEFAULT_SIZE; |  | ||||||
|         } else if (size > DEFAULT_MAX_SIZE) { |  | ||||||
|             this.size = DEFAULT_MAX_SIZE; |  | ||||||
|         } else { |  | ||||||
|             this.size = size; |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user