From 690dbd788c3bc706f39ddf20b9fb00ac4cd2ed21 Mon Sep 17 00:00:00 2001 From: zhou-hao Date: Thu, 25 Mar 2021 11:53:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0ID=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/entity/DimensionEntity.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DimensionEntity.java b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DimensionEntity.java index 8c17f52d4..0056a12ed 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DimensionEntity.java +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DimensionEntity.java @@ -10,29 +10,40 @@ import org.hswebframework.web.api.crud.entity.GenericTreeSortSupportEntity; import org.hswebframework.web.validator.CreateGroup; import javax.persistence.Column; +import javax.persistence.GeneratedValue; import javax.persistence.Index; import javax.persistence.Table; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; import java.sql.JDBCType; import java.util.List; import java.util.Map; @Getter @Setter -@Table(name = "s_dimension",indexes = { - @Index(name = "idx_dims_path",columnList = "path") +@Table(name = "s_dimension", indexes = { + @Index(name = "idx_dims_path", columnList = "path") }) public class DimensionEntity extends GenericTreeSortSupportEntity { + @Override + @Pattern( + regexp = "^[0-9a-zA-Z_\\-]+$", + message = "ID只能由数字,字母,下划线和中划线组成", + groups = CreateGroup.class) + public String getId() { + return super.getId(); + } + @Comment("维度类型ID") - @Column(length = 32,name = "type_id") + @Column(length = 32, name = "type_id") @Schema(description = "维度类型ID") private String typeId; @Comment("维度名称") @Column(length = 32) @Schema(description = "维度名称") - @NotBlank(message = "名称不能为空",groups = CreateGroup.class) + @NotBlank(message = "名称不能为空", groups = CreateGroup.class) private String name; @Comment("描述") @@ -45,7 +56,7 @@ public class DimensionEntity extends GenericTreeSortSupportEntity { @Comment("其他配置") @JsonCodec @Schema(description = "其他配置") - private Map properties; + private Map properties; @Schema(description = "子节点") private List children;