mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 07:11:52 +08:00
代码生成:支持树形表结构的配置
This commit is contained in:
parent
0d49691aa0
commit
a2f7067494
@ -53,6 +53,13 @@ public class CodegenUpdateReqVO {
|
||||
|| (ObjectUtil.isAllNotEmpty(getMasterTableId(), getSubJoinColumnId(), getSubJoinMany()));
|
||||
}
|
||||
|
||||
@AssertTrue(message = "关联的树表信息不全")
|
||||
@JsonIgnore
|
||||
public boolean isTreeValid() {
|
||||
return ObjectUtil.notEqual(getTemplateType(), CodegenTemplateTypeEnum.TREE)
|
||||
|| (ObjectUtil.isAllNotEmpty(getTreeParentColumnId(), getTreeNameColumnId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Schema(description = "更新表定义")
|
||||
|
@ -65,4 +65,9 @@ public class CodegenTableBaseVO {
|
||||
@Schema(description = "主表与子表是否一对多", example = "4096")
|
||||
private Boolean subJoinMany;
|
||||
|
||||
@Schema(description = "树表的父字段编号", example = "8192")
|
||||
private Long treeParentColumnId;
|
||||
@Schema(description = "树表的名字字段编号", example = "16384")
|
||||
private Long treeNameColumnId;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.dataobject.demo;
|
@ -0,0 +1 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.demo;
|
@ -0,0 +1 @@
|
||||
package cn.iocoder.yudao.module.infra.service.demo;
|
@ -13,7 +13,7 @@ import java.math.BigDecimal;
|
||||
#end
|
||||
## 处理 LocalDateTime 字段的引入
|
||||
#foreach ($column in $columns)
|
||||
#if (${table.listOperationResult} && ${column.javaType} == "LocalDateTime")
|
||||
#if (${column.listOperationResult} && ${column.javaType} == "LocalDateTime")
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
#break
|
||||
|
@ -34,8 +34,8 @@ public class ${sceneEnum.prefixClass}${table.className}SaveReqVO {
|
||||
#if (${column.createOperation} || ${column.updateOperation})
|
||||
## 1. 处理 Swagger 注解
|
||||
@Schema(description = "${column.columnComment}"#if (!${column.nullable}), requiredMode = Schema.RequiredMode.REQUIRED#end#if ("$!column.example" != ""), example = "${column.example}"#end)
|
||||
#if (!${column.nullable})
|
||||
## 2. 处理 Validator 参数校验
|
||||
#if (!${column.nullable} && !${column.primaryKey})
|
||||
#if (${column.javaType} == 'String')
|
||||
@NotEmpty(message = "${column.columnComment}不能为空")
|
||||
#else
|
||||
|
@ -1,4 +1,7 @@
|
||||
// TODO 待办:请将下面的错误码复制到 yudao-module-${table.moduleName}-api 模块的 ErrorCodeConstants 类中。注意,请给“TODO 补充编号”设置一个错误码编号!!!
|
||||
// ========== ${table.classComment} TODO 补充编号 ==========
|
||||
ErrorCode ${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS = new ErrorCode(TODO 补充编号, "${table.classComment}不存在");
|
||||
ErrorCode ${simpleClassName_underlineCase.toUpperCase()}_EXITS_CHILDREN = new ErrorCode(TODO 补充编号, "存在存在子${table.classComment},无法删除");
|
||||
## 特殊:树表专属逻辑
|
||||
#if ( $table.templateType == 2 )
|
||||
ErrorCode ${simpleClassName_underlineCase.toUpperCase()}_EXITS_CHILDREN = new ErrorCode(TODO 补充编号, "存在存在子${table.classComment},无法删除");
|
||||
#end
|
Loading…
Reference in New Issue
Block a user