mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-10-15 10:57:11 +08:00
feat(tool/generator): 代码生成 Request 实体时,针对字符串类型增加数据长度校验注解
This commit is contained in:
@@ -77,6 +77,12 @@ public class FieldConfigDO implements Serializable {
|
||||
@NotBlank(message = "列类型不能为空")
|
||||
private String columnType;
|
||||
|
||||
/**
|
||||
* 列大小
|
||||
*/
|
||||
@Schema(description = "列大小", example = "255")
|
||||
private Long columnSize;
|
||||
|
||||
/**
|
||||
* 字段名称
|
||||
*/
|
||||
@@ -147,6 +153,7 @@ public class FieldConfigDO implements Serializable {
|
||||
this.tableName = column.getTableName();
|
||||
this.setColumnName(column.getName());
|
||||
this.setColumnType(columnType);
|
||||
this.setColumnSize(column.getSize());
|
||||
this.setComment(column.getComment());
|
||||
this.setIsRequired(isRequired);
|
||||
this.setShowInList(true);
|
||||
|
@@ -138,7 +138,6 @@ public class GeneratorServiceImpl implements GeneratorService {
|
||||
Collection<Column> columnList = MetaUtils.getColumns(dataSource, tableName);
|
||||
return columnList.stream().map(FieldConfigDO::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 同步最新数据表列信息
|
||||
if (requireSync) {
|
||||
Collection<Column> columnList = MetaUtils.getColumns(dataSource, tableName);
|
||||
@@ -155,6 +154,7 @@ public class GeneratorServiceImpl implements GeneratorService {
|
||||
String columnType =
|
||||
StrUtil.splitToArray(column.getTypeName(), StringConstants.SPACE)[0].toLowerCase();
|
||||
fieldConfig.setColumnType(columnType);
|
||||
fieldConfig.setColumnSize(column.getSize());
|
||||
fieldConfig.setComment(column.getComment());
|
||||
} else {
|
||||
// 新增字段配置
|
||||
@@ -193,7 +193,6 @@ public class GeneratorServiceImpl implements GeneratorService {
|
||||
fieldConfig.setTableName(tableName);
|
||||
}
|
||||
fieldConfigMapper.insertBatch(fieldConfigList);
|
||||
|
||||
// 保存或更新生成配置信息
|
||||
GenConfigDO newGenConfig = req.getGenConfig();
|
||||
String frontendPath = newGenConfig.getFrontendPath();
|
||||
|
Reference in New Issue
Block a user