mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-15 02:57:10 +08:00
fix: 完善保存代码生成配置信息接口的参数验证
This commit is contained in:
@@ -49,4 +49,9 @@ public class RegexConsts implements RegexPool {
|
|||||||
* 通用名称正则(长度为 1 到 20 位,可以包含中文、字母、数字、下划线,短横线)
|
* 通用名称正则(长度为 1 到 20 位,可以包含中文、字母、数字、下划线,短横线)
|
||||||
*/
|
*/
|
||||||
public static final String GENERAL_NAME = "^[\\u4e00-\\u9fa5a-zA-Z0-9_-]{1,20}$";
|
public static final String GENERAL_NAME = "^[\\u4e00-\\u9fa5a-zA-Z0-9_-]{1,20}$";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 包名正则(可以包含大小写字母、数字、下划线,每一级包名不能以数字开头)
|
||||||
|
*/
|
||||||
|
public static final String PACKAGE_NAME = "^(?:[a-zA-Z_][a-zA-Z0-9_]*\\.)*[a-zA-Z_][a-zA-Z0-9_]*$";
|
||||||
}
|
}
|
||||||
|
@@ -21,6 +21,7 @@ import java.time.LocalDateTime;
|
|||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -28,8 +29,12 @@ import lombok.experimental.Accessors;
|
|||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
|
||||||
|
import top.charles7c.cnadmin.common.constant.RegexConsts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成配置实体
|
* 生成配置实体
|
||||||
*
|
*
|
||||||
@@ -58,6 +63,7 @@ public class GenConfigDO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "模块名称")
|
@Schema(description = "模块名称")
|
||||||
@NotBlank(message = "模块名称不能为空")
|
@NotBlank(message = "模块名称不能为空")
|
||||||
|
@Length(max = 60, message = "模块名称不能超过 {max} 个字符")
|
||||||
private String moduleName;
|
private String moduleName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,12 +71,15 @@ public class GenConfigDO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "包名称")
|
@Schema(description = "包名称")
|
||||||
@NotBlank(message = "包名称不能为空")
|
@NotBlank(message = "包名称不能为空")
|
||||||
|
@Pattern(regexp = RegexConsts.PACKAGE_NAME, message = "包名称格式错误")
|
||||||
|
@Length(max = 60, message = "包名称不能超过 {max} 个字符")
|
||||||
private String packageName;
|
private String packageName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 前端路径
|
* 前端路径
|
||||||
*/
|
*/
|
||||||
@Schema(description = "前端路径")
|
@Schema(description = "前端路径")
|
||||||
|
@Length(max = 255, message = "前端路径不能超过 {max} 个字符")
|
||||||
private String frontendPath;
|
private String frontendPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,6 +87,7 @@ public class GenConfigDO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "业务名称")
|
@Schema(description = "业务名称")
|
||||||
@NotBlank(message = "业务名称不能为空")
|
@NotBlank(message = "业务名称不能为空")
|
||||||
|
@Length(max = 50, message = "业务名称不能超过 {max} 个字符")
|
||||||
private String businessName;
|
private String businessName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,6 +95,7 @@ public class GenConfigDO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "作者")
|
@Schema(description = "作者")
|
||||||
@NotBlank(message = "作者名称不能为空")
|
@NotBlank(message = "作者名称不能为空")
|
||||||
|
@Length(max = 100, message = "作者名称不能超过 {max} 个字符")
|
||||||
private String author;
|
private String author;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -20,6 +20,9 @@ import java.io.Serializable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@@ -43,11 +46,13 @@ public class GenConfigRequest implements Serializable {
|
|||||||
* 列映射信息列表
|
* 列映射信息列表
|
||||||
*/
|
*/
|
||||||
@Schema(description = "列映射信息列表")
|
@Schema(description = "列映射信息列表")
|
||||||
|
@NotEmpty(message = "列映射信息不能为空")
|
||||||
private List<ColumnMappingDO> columnMappings = new ArrayList<>();
|
private List<ColumnMappingDO> columnMappings = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成配置信息
|
* 生成配置信息
|
||||||
*/
|
*/
|
||||||
@Schema(description = "生成配置信息")
|
@Schema(description = "生成配置信息")
|
||||||
|
@NotNull(message = "生成配置信息不能为空")
|
||||||
private GenConfigDO genConfig;
|
private GenConfigDO genConfig;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user