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;