Procházet zdrojové kódy

完善swagger注释

lixing před 3 roky
rodič
revize
d795632f3b

+ 4 - 0
fm-common/src/main/java/com/persagy/fm/common/constant/PageQueryConstants.java

@@ -15,4 +15,8 @@ public class PageQueryConstants {
      * 默认查询10条
      */
     public static final int DEFAULT_SIZE = 10;
+    /**
+     * list参数的最大size
+     */
+    public static final int PARAM_MAX_SIZE = 100;
 }

+ 1 - 1
fm-common/src/main/java/com/persagy/fm/common/model/dto/EnumQueryDTO.java

@@ -16,8 +16,8 @@ import javax.validation.constraints.NotNull;
 @Data
 @ApiModel
 public class EnumQueryDTO {
-    @NotNull(message = "枚举类型不能为空")
 
+    @NotNull(message = "枚举类型不能为空")
     @ApiModelProperty("枚举类型")
     private String type;
 }

+ 24 - 14
fm-common/src/main/java/com/persagy/fm/common/model/dto/PageDTO.java

@@ -1,27 +1,26 @@
 package com.persagy.fm.common.model.dto;
 
+import com.persagy.fm.common.constant.PageQueryConstants;
+import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import net.minidev.json.annotate.JsonIgnore;
 
-import javax.validation.constraints.NotNull;
 import java.util.List;
 
 /**
- * @description: 分页条件
- * @author: lixing
- * @company: Persagy Technology Co.,Ltd
- * @since: 2020/10/13 3:23 下午
- * @version: V1.0
- **/
+ * 分页条件
+ *
+ * @author lixing
+ * @version V1.0 2021/4/29 2:57 下午
+ */
 @Data
+@ApiModel
 public class PageDTO {
-    @ApiModelProperty(value = "当前页数", required = true)
-    @NotNull(message = "当前页数不能为空")
+    @ApiModelProperty(value = "当前页数")
     private Integer page;
 
-    @ApiModelProperty(value = "每页条数", required = true)
-    @NotNull(message = "每页条数不能为空")
+    @ApiModelProperty(value = "每页条数")
     private Integer size;
     @ApiModelProperty(value = "排序方式")
     private List<Sort> orders;
@@ -31,10 +30,21 @@ public class PageDTO {
     private Integer startIndex;
 
     public Integer getStartIndex() {
-        if (page == null || size == null) {
-            return 0;
+        return (getPage() - 1) * getSize();
+    }
+
+    public Integer getPage() {
+        if (this.page == null) {
+            return PageQueryConstants.DEFAULT_PAGE;
+        }
+        return this.page;
+    }
+
+    public Integer getSize() {
+        if (this.size == null) {
+            return PageQueryConstants.DEFAULT_SIZE;
         }
-        return (page -1) * size;
+        return this.size;
     }
 }
 

+ 1 - 1
fm-common/src/main/java/com/persagy/fm/common/model/vo/DuplicateVO.java

@@ -11,7 +11,7 @@ import lombok.Data;
  * @version V1.0 2021/4/7 7:36 下午
  **/
 @Data
-@ApiModel("是否重复VO类")
+@ApiModel
 public class DuplicateVO {
     @ApiModelProperty("是否重复")
     private Boolean duplicate;

+ 1 - 1
fm-common/src/main/java/com/persagy/fm/common/model/vo/EnumVO.java

@@ -14,7 +14,7 @@ import org.checkerframework.checker.units.qual.K;
  **/
 @Data
 @JsonInclude(JsonInclude.Include.NON_NULL)
-@ApiModel("枚举VO类")
+@ApiModel
 public class EnumVO {
     @ApiModelProperty(value = "键")
     private String key;