refactor: 用 @Email 和 @Mobile 注解替换了部分验证,提高了代码可读性,修改了多处错误提示信息,使其更加友好

This commit is contained in:
2025-03-27 21:21:53 +08:00
parent c130f9c0bb
commit 19639c946a
26 changed files with 60 additions and 65 deletions

View File

@@ -76,7 +76,7 @@ public class GenConfigDO implements Serializable {
*/
@Schema(description = "包名称", example = "top.continew.admin.system")
@NotBlank(message = "包名称不能为空")
@Pattern(regexp = RegexConstants.PACKAGE_NAME, message = "包名称格式错误")
@Pattern(regexp = RegexConstants.PACKAGE_NAME, message = "包名称格式不正确")
@Length(max = 60, message = "包名称不能超过 {max} 个字符")
private String packageName;

View File

@@ -54,7 +54,7 @@ public class OpenApiSignTemplate extends SaSignTemplate {
ValidationUtils.throwIfBlank(signValue, "sign不能为空");
ValidationUtils.throwIfBlank(accessKeyValue, "accessKey不能为空");
AppDO app = appService.getByAccessKey(accessKeyValue);
ValidationUtils.throwIfNull(app, "accessKey非法");
ValidationUtils.throwIfNull(app, "accessKey无效");
ValidationUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, app.getStatus(), "应用已被禁用, 请联系管理员");
ValidationUtils.throwIf(app.isExpired(), "应用已过期, 请联系管理员");

View File

@@ -65,7 +65,7 @@ public class JobReq implements Serializable {
* 触发类型
*/
@Schema(description = "触发类型", example = "2")
@NotNull(message = "触发类型非法")
@NotNull(message = "触发类型无效")
private JobTriggerTypeEnum triggerType;
/**
@@ -85,7 +85,7 @@ public class JobReq implements Serializable {
* 任务类型
*/
@Schema(description = "任务类型", example = "1")
@NotNull(message = "任务类型非法")
@NotNull(message = "任务类型无效")
private JobTaskTypeEnum taskType;
/**
@@ -111,14 +111,14 @@ public class JobReq implements Serializable {
* 路由策略
*/
@Schema(description = "路由策略", example = "4")
@NotNull(message = "路由策略非法")
@NotNull(message = "路由策略无效")
private JobRouteStrategyEnum routeKey;
/**
* 阻塞策略
*/
@Schema(description = "阻塞策略", example = "1")
@NotNull(message = "阻塞策略非法")
@NotNull(message = "阻塞策略无效")
private JobBlockStrategyEnum blockStrategy;
/**

View File

@@ -42,7 +42,7 @@ public class JobStatusReq implements Serializable {
* 任务状态
*/
@Schema(description = "任务状态", example = "1")
@NotNull(message = "任务状态非法")
@NotNull(message = "任务状态无效")
private JobStatusEnum jobStatus;
/**