feat: 支持字段最大长度设置
This commit is contained in:
@@ -40,7 +40,7 @@ public class GenFieldConfig extends BaseEntity {
|
||||
/**
|
||||
* 字段长度
|
||||
*/
|
||||
private String columnLength;
|
||||
private Integer maxLength;
|
||||
|
||||
/**
|
||||
* 字段名称
|
||||
|
||||
@@ -75,6 +75,9 @@ public class GenConfigForm {
|
||||
@Schema(description = "是否必填")
|
||||
private Integer isRequired;
|
||||
|
||||
@Schema(description = "最大长度")
|
||||
private Integer maxLength;
|
||||
|
||||
@Schema(description = "表单类型")
|
||||
private FormTypeEnum formType;
|
||||
|
||||
|
||||
@@ -33,6 +33,9 @@ public class ${entityName}Form implements Serializable {
|
||||
#if($fieldConfigs)
|
||||
#foreach($fieldConfig in ${fieldConfigs})
|
||||
#if($fieldConfig.isShowInForm)
|
||||
#if("$!fieldConfig.fieldComment" != "")
|
||||
@Schema(description = "${fieldConfig.fieldComment}")
|
||||
#end
|
||||
#if($fieldConfig.isRequired)
|
||||
#if($fieldConfig.fieldType == 'String')
|
||||
@NotBlank(message = "$fieldConfig.fieldComment不能为空")
|
||||
@@ -40,10 +43,11 @@ public class ${entityName}Form implements Serializable {
|
||||
@NotNull(message = "$fieldConfig.fieldComment不能为空")
|
||||
#end
|
||||
#end
|
||||
#if("$!fieldConfig.fieldComment" != "")
|
||||
@Schema(description = "${fieldConfig.fieldComment}")
|
||||
#if($fieldConfig.maxLength)
|
||||
@Size(max=$fieldConfig.maxLength, message="$fieldConfig.fieldComment长度不能超过${fieldConfig.maxLength}个字符")
|
||||
#end
|
||||
private ${fieldConfig.fieldType} ${fieldConfig.fieldName};
|
||||
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
|
||||
Reference in New Issue
Block a user