refactor: 优化接口文档枚举参数显示效果

This commit is contained in:
2024-07-24 22:25:55 +08:00
parent 00c33226c8
commit 770fda3882
49 changed files with 144 additions and 47 deletions

View File

@@ -57,4 +57,9 @@ public enum DataScopeEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -44,4 +44,9 @@ public enum DisEnableStatusEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
private final String color; private final String color;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -47,4 +47,9 @@ public enum GenderEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -47,4 +47,9 @@ public enum MenuTypeEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -39,4 +39,9 @@ public enum MessageTypeEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
private final String color; private final String color;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -44,4 +44,9 @@ public enum SuccessFailureStatusEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
private final String color; private final String color;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -88,4 +88,9 @@ public enum FormTypeEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -103,4 +103,9 @@ public enum QueryTypeEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -132,14 +132,13 @@ public class FieldConfigDO implements Serializable {
/** /**
* 表单类型 * 表单类型
*/ */
@Schema(description = "表单类型", type = "Integer", allowableValues = {"1", "2", "3", "4", "5", "6"}, example = "1") @Schema(description = "表单类型", example = "1")
private FormTypeEnum formType; private FormTypeEnum formType;
/** /**
* 查询方式 * 查询方式
*/ */
@Schema(description = "查询方式", type = "Integer", allowableValues = {"1", "2", "3", "4", "5", "6", "7", "8", "9", @Schema(description = "查询方式", example = "1")
"10", "11", "12", "13", "14"}, example = "1")
private QueryTypeEnum queryType; private QueryTypeEnum queryType;
/** /**

View File

@@ -47,4 +47,9 @@ public enum JobBlockStrategyEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -132,4 +132,9 @@ public enum JobExecuteReasonEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -64,4 +64,9 @@ public enum JobExecuteStatusEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
private final String color; private final String color;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -52,4 +52,9 @@ public enum JobRouteStrategyEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -44,4 +44,9 @@ public enum JobStatusEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
private final String color; private final String color;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -49,4 +49,9 @@ public enum JobTaskTypeEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
private final String color; private final String color;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -42,4 +42,9 @@ public enum JobTriggerTypeEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -23,6 +23,7 @@ import jakarta.validation.constraints.Size;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Range; import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import top.continew.admin.job.enums.JobExecuteStatusEnum;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
@@ -63,7 +64,7 @@ public class JobLogQuery implements Serializable {
* 任务批次状态 * 任务批次状态
*/ */
@Schema(description = "任务批次状态", example = "1") @Schema(description = "任务批次状态", example = "1")
private Integer taskBatchStatus; private JobExecuteStatusEnum taskBatchStatus;
/** /**
* 创建时间 * 创建时间

View File

@@ -20,6 +20,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min; import jakarta.validation.constraints.Min;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Range; import org.hibernate.validator.constraints.Range;
import top.continew.admin.job.enums.JobStatusEnum;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
@@ -53,7 +54,7 @@ public class JobQuery implements Serializable {
* 任务状态 * 任务状态
*/ */
@Schema(description = "任务状态", example = "1") @Schema(description = "任务状态", example = "1")
private Integer jobStatus; private JobStatusEnum jobStatus;
/** /**
* 页码 * 页码

View File

@@ -49,7 +49,8 @@ public class JobLogServiceImpl implements JobLogService {
@Override @Override
public PageResp<JobLogResp> page(JobLogQuery query) { public PageResp<JobLogResp> page(JobLogQuery query) {
return jobClient.requestPage(() -> jobBatchApi.page(query.getJobId(), query.getJobName(), query return jobClient.requestPage(() -> jobBatchApi.page(query.getJobId(), query.getJobName(), query
.getGroupName(), query.getTaskBatchStatus(), query.getDatetimeRange(), query.getPage(), query.getSize())); .getGroupName(), query.getTaskBatchStatus().getValue(), query.getDatetimeRange(), query.getPage(), query
.getSize()));
} }
@Override @Override

View File

@@ -45,8 +45,8 @@ public class JobServiceImpl implements JobService {
@Override @Override
public PageResp<JobResp> page(JobQuery query) { public PageResp<JobResp> page(JobQuery query) {
return jobClient.requestPage(() -> jobApi.page(query.getGroupName(), query.getJobName(), query return jobClient.requestPage(() -> jobApi.page(query.getGroupName(), query.getJobName(), query.getJobStatus()
.getJobStatus(), query.getPage(), query.getSize())); .getValue(), query.getPage(), query.getSize()));
} }
@Override @Override

View File

@@ -63,7 +63,7 @@ public class UserInfoResp implements Serializable {
/** /**
* 性别 * 性别
*/ */
@Schema(description = "性别0未知12", type = "Integer", allowableValues = {"0", "1", "2"}, example = "1") @Schema(description = "性别", example = "1")
private GenderEnum gender; private GenderEnum gender;
/** /**

View File

@@ -65,6 +65,11 @@ public enum FileTypeEnum implements IBaseEnum<Integer> {
private final String description; private final String description;
private final List<String> extensions; private final List<String> extensions;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
/** /**
* 根据扩展名查询 * 根据扩展名查询
* *

View File

@@ -51,6 +51,11 @@ public enum ImportPolicyEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
public boolean validate(ImportPolicyEnum importPolicy, String data, List<String> existList) { public boolean validate(ImportPolicyEnum importPolicy, String data, List<String> existList) {
return this == importPolicy && CollUtil.isNotEmpty(existList) && existList.contains(data); return this == importPolicy && CollUtil.isNotEmpty(existList) && existList.contains(data);
} }

View File

@@ -42,4 +42,9 @@ public enum LogStatusEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -52,6 +52,11 @@ public enum NoticeStatusEnum implements IBaseEnum<Integer> {
private final String description; private final String description;
private final String color; private final String color;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
/** /**
* 获取公告状态 * 获取公告状态
* *

View File

@@ -42,4 +42,9 @@ public enum StorageTypeEnum implements IBaseEnum<Integer> {
private final Integer value; private final Integer value;
private final String description; private final String description;
@Override
public String toString() {
return "%s: %s".formatted(this.value, this.description);
}
} }

View File

@@ -72,7 +72,7 @@ public class DeptReq extends BaseReq {
/** /**
* 状态 * 状态
*/ */
@Schema(description = "状态1启用2禁用", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "状态", example = "1")
private DisEnableStatusEnum status; private DisEnableStatusEnum status;
/** /**

View File

@@ -80,7 +80,7 @@ public class DictItemReq extends BaseReq {
/** /**
* 状态 * 状态
*/ */
@Schema(description = "状态1启用2禁用", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "状态", example = "1")
private DisEnableStatusEnum status; private DisEnableStatusEnum status;
/** /**

View File

@@ -44,7 +44,7 @@ public class MenuReq extends BaseReq {
/** /**
* 类型 * 类型
*/ */
@Schema(description = "类型1目录2菜单3按钮", type = "Integer", allowableValues = {"1", "2", "3"}, example = "2") @Schema(description = "类型", example = "2")
@NotNull(message = "类型非法") @NotNull(message = "类型非法")
private MenuTypeEnum type; private MenuTypeEnum type;
@@ -132,7 +132,7 @@ public class MenuReq extends BaseReq {
/** /**
* 状态 * 状态
*/ */
@Schema(description = "状态1启用2禁用", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "状态", example = "1")
@NotNull(message = "状态非法") @NotNull(message = "状态非法")
private DisEnableStatusEnum status; private DisEnableStatusEnum status;
} }

View File

@@ -82,8 +82,7 @@ public class RoleReq extends BaseReq {
/** /**
* 数据权限 * 数据权限
*/ */
@Schema(description = "数据权限1全部数据权限2本部门及以下数据权限3本部门数据权限4仅本人数据权限5自定义数据权限", type = "Integer", allowableValues = { @Schema(description = "数据权限", example = "5")
"1", "2", "3", "4", "5"}, example = "5")
private DataScopeEnum dataScope; private DataScopeEnum dataScope;
/** /**

View File

@@ -62,7 +62,7 @@ public class StorageReq extends BaseReq {
/** /**
* 类型 * 类型
*/ */
@Schema(description = "类型", type = "Integer", allowableValues = {"1", "2"}, example = "2") @Schema(description = "类型", example = "2")
@NotNull(message = "类型非法") @NotNull(message = "类型非法")
private StorageTypeEnum type; private StorageTypeEnum type;
@@ -129,6 +129,6 @@ public class StorageReq extends BaseReq {
/** /**
* 状态 * 状态
*/ */
@Schema(description = "状态1启用2禁用", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "状态", example = "1")
private DisEnableStatusEnum status; private DisEnableStatusEnum status;
} }

View File

@@ -51,7 +51,7 @@ public class UserBasicInfoUpdateReq implements Serializable {
/** /**
* 性别 * 性别
*/ */
@Schema(description = "性别0未知12", type = "Integer", allowableValues = {"0", "1", "2"}, example = "1") @Schema(description = "性别", example = "1")
@NotNull(message = "性别非法") @NotNull(message = "性别非法")
private GenderEnum gender; private GenderEnum gender;
} }

View File

@@ -49,27 +49,27 @@ public class UserImportReq extends BaseReq {
/** /**
* 用户重复策略 * 用户重复策略
*/ */
@Schema(description = "重复用户策略", type = "Integer", allowableValues = {"1", "2", "3", "4"}, example = "1") @Schema(description = "重复用户策略", example = "1")
@NotNull(message = "重复用户策略不能为空") @NotNull(message = "重复用户策略不能为空")
private ImportPolicyEnum duplicateUser; private ImportPolicyEnum duplicateUser;
/** /**
* 重复邮箱策略 * 重复邮箱策略
*/ */
@Schema(description = "重复邮箱策略", type = "Integer", allowableValues = {"1", "2", "3", "4"}, example = "1") @Schema(description = "重复邮箱策略", example = "1")
@NotNull(message = "重复邮箱策略不能为空") @NotNull(message = "重复邮箱策略不能为空")
private ImportPolicyEnum duplicateEmail; private ImportPolicyEnum duplicateEmail;
/** /**
* 重复手机策略 * 重复手机策略
*/ */
@Schema(description = "重复手机策略", type = "Integer", allowableValues = {"1", "2", "3", "4"}, example = "1") @Schema(description = "重复手机策略", example = "1")
@NotNull(message = "重复手机策略不能为空") @NotNull(message = "重复手机策略不能为空")
private ImportPolicyEnum duplicatePhone; private ImportPolicyEnum duplicatePhone;
/** /**
* 默认状态 * 默认状态
*/ */
@Schema(description = "默认状态1启用2禁用", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "默认状态", example = "1")
private DisEnableStatusEnum defaultStatus; private DisEnableStatusEnum defaultStatus;
} }

View File

@@ -87,7 +87,7 @@ public class UserReq extends BaseReq {
/** /**
* 性别 * 性别
*/ */
@Schema(description = "性别0未知12", type = "Integer", allowableValues = {"0", "1", "2"}, example = "1") @Schema(description = "性别", example = "1")
@NotNull(message = "性别非法") @NotNull(message = "性别非法")
private GenderEnum gender; private GenderEnum gender;
@@ -115,6 +115,6 @@ public class UserReq extends BaseReq {
/** /**
* 状态 * 状态
*/ */
@Schema(description = "状态1启用2禁用", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "状态", example = "1")
private DisEnableStatusEnum status; private DisEnableStatusEnum status;
} }

View File

@@ -59,7 +59,7 @@ public class DeptResp extends BaseDetailResp {
/** /**
* 状态 * 状态
*/ */
@Schema(description = "状态1启用2禁用", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "状态", example = "1")
@ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class, order = 5) @ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class, order = 5)
private DisEnableStatusEnum status; private DisEnableStatusEnum status;

View File

@@ -59,7 +59,7 @@ public class DictItemResp extends BaseDetailResp {
/** /**
* 状态 * 状态
*/ */
@Schema(description = "状态1启用2禁用", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "状态", example = "1")
@ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class) @ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class)
private DisEnableStatusEnum status; private DisEnableStatusEnum status;

View File

@@ -65,8 +65,7 @@ public class FileResp extends BaseDetailResp {
/** /**
* 类型 * 类型
*/ */
@Schema(description = "类型1其他2图片3文档4视频5音频", type = "Integer", allowableValues = {"1", "2", "3", "4", @Schema(description = "类型", example = "2")
"5"}, example = "2")
private FileTypeEnum type; private FileTypeEnum type;
/** /**

View File

@@ -42,8 +42,7 @@ public class FileStatisticsResp implements Serializable {
/** /**
* 文件类型 * 文件类型
*/ */
@Schema(description = "类型1其他2图片3文档4视频5音频", type = "Integer", allowableValues = {"1", "2", "3", "4", @Schema(description = "类型", example = "2")
"5"}, example = "2")
private FileTypeEnum type; private FileTypeEnum type;
/** /**

View File

@@ -54,7 +54,7 @@ public class MenuResp extends BaseResp {
/** /**
* 类型 * 类型
*/ */
@Schema(description = "类型1目录2菜单3按钮", type = "Integer", allowableValues = {"1", "2", "3"}, example = "2") @Schema(description = "类型", example = "2")
private MenuTypeEnum type; private MenuTypeEnum type;
/** /**
@@ -120,6 +120,6 @@ public class MenuResp extends BaseResp {
/** /**
* 状态 * 状态
*/ */
@Schema(description = "状态1启用2禁用", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "状态", example = "1")
private DisEnableStatusEnum status; private DisEnableStatusEnum status;
} }

View File

@@ -66,7 +66,7 @@ public class NoticeResp extends BaseResp {
* *
* @return 公告状态 * @return 公告状态
*/ */
@Schema(description = "状态1待发布2已发布3已过期", type = "Integer", allowableValues = {"1", "2", "3"}, example = "1") @Schema(description = "状态", example = "1")
public NoticeStatusEnum getStatus() { public NoticeStatusEnum getStatus() {
return NoticeStatusEnum.getStatus(effectiveTime, terminateTime); return NoticeStatusEnum.getStatus(effectiveTime, terminateTime);
} }

View File

@@ -63,8 +63,7 @@ public class RoleDetailResp extends BaseDetailResp {
/** /**
* 数据权限 * 数据权限
*/ */
@Schema(description = "数据权限1全部数据权限2本部门及以下数据权限3本部门数据权限4仅本人数据权限5自定义数据权限", type = "Integer", allowableValues = { @Schema(description = "数据权限", example = "5")
"1", "2", "3", "4", "5"}, example = "5")
@ExcelProperty(value = "数据权限", converter = ExcelBaseEnumConverter.class) @ExcelProperty(value = "数据权限", converter = ExcelBaseEnumConverter.class)
private DataScopeEnum dataScope; private DataScopeEnum dataScope;

View File

@@ -51,8 +51,7 @@ public class RoleResp extends BaseDetailResp {
/** /**
* 数据权限 * 数据权限
*/ */
@Schema(description = "数据权限1全部数据权限2本部门及以下数据权限3本部门数据权限4仅本人数据权限5自定义数据权限", type = "Integer", allowableValues = { @Schema(description = "数据权限", example = "5")
"1", "2", "3", "4", "5"}, example = "5")
private DataScopeEnum dataScope; private DataScopeEnum dataScope;
/** /**

View File

@@ -53,13 +53,13 @@ public class StorageResp extends BaseDetailResp {
/** /**
* 状态 * 状态
*/ */
@Schema(description = "状态1启用2禁用", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "状态", example = "1")
private DisEnableStatusEnum status; private DisEnableStatusEnum status;
/** /**
* 类型 * 类型
*/ */
@Schema(description = "类型1兼容S3协议存储2本地存储", type = "Integer", allowableValues = {"1", "2"}, example = "2") @Schema(description = "类型", example = "2")
private StorageTypeEnum type; private StorageTypeEnum type;
/** /**

View File

@@ -73,14 +73,14 @@ public class UserDetailResp extends BaseDetailResp {
/** /**
* 状态 * 状态
*/ */
@Schema(description = "状态1启用2禁用", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "状态", example = "1")
@ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class, order = 4) @ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class, order = 4)
private DisEnableStatusEnum status; private DisEnableStatusEnum status;
/** /**
* 性别 * 性别
*/ */
@Schema(description = "性别0未知12", type = "Integer", allowableValues = {"0", "1", "2"}, example = "1") @Schema(description = "性别", example = "1")
@ExcelProperty(value = "性别", converter = ExcelBaseEnumConverter.class, order = 5) @ExcelProperty(value = "性别", converter = ExcelBaseEnumConverter.class, order = 5)
private GenderEnum gender; private GenderEnum gender;

View File

@@ -61,7 +61,7 @@ public class UserResp extends BaseDetailResp {
/** /**
* 性别 * 性别
*/ */
@Schema(description = "性别0未知12", type = "Integer", allowableValues = {"0", "1", "2"}, example = "1") @Schema(description = "性别", example = "1")
private GenderEnum gender; private GenderEnum gender;
/** /**
@@ -87,7 +87,7 @@ public class UserResp extends BaseDetailResp {
/** /**
* 状态 * 状态
*/ */
@Schema(description = "状态1启用2禁用", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "状态", example = "1")
private DisEnableStatusEnum status; private DisEnableStatusEnum status;
/** /**

View File

@@ -140,7 +140,7 @@ public class LogDetailResp implements Serializable {
/** /**
* 状态 * 状态
*/ */
@Schema(description = "状态1成功2失败", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "状态", example = "1")
private LogStatusEnum status; private LogStatusEnum status;
/** /**

View File

@@ -89,7 +89,7 @@ public class LogResp implements Serializable {
/** /**
* 状态 * 状态
*/ */
@Schema(description = "状态1成功2失败", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "状态", example = "1")
private LogStatusEnum status; private LogStatusEnum status;
/** /**

View File

@@ -72,7 +72,7 @@ public class LoginLogExportResp implements Serializable {
/** /**
* 状态 * 状态
*/ */
@Schema(description = "状态1成功2失败", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "状态", example = "1")
@ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class) @ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class)
private LogStatusEnum status; private LogStatusEnum status;

View File

@@ -79,7 +79,7 @@ public class OperationLogExportResp implements Serializable {
/** /**
* 状态 * 状态
*/ */
@Schema(description = "状态1成功2失败", type = "Integer", allowableValues = {"1", "2"}, example = "1") @Schema(description = "状态", example = "1")
@ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class) @ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class)
private LogStatusEnum status; private LogStatusEnum status;