增加ID校验

This commit is contained in:
zhou-hao
2021-03-25 11:53:19 +08:00
parent 8b8d4d28b3
commit 690dbd788c

View File

@@ -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<String> {
@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<String> {
@Comment("其他配置")
@JsonCodec
@Schema(description = "其他配置")
private Map<String,Object> properties;
private Map<String, Object> properties;
@Schema(description = "子节点")
private List<DimensionEntity> children;