|
@@ -1,7 +1,11 @@
|
|
|
package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType;
|
|
package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType;
|
|
|
|
|
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.validation.InEnum;
|
|
|
import cn.iocoder.yudao.module.iot.enums.thingmodel.IotThingModelAccessModeEnum;
|
|
import cn.iocoder.yudao.module.iot.enums.thingmodel.IotThingModelAccessModeEnum;
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
|
|
|
+import jakarta.validation.Valid;
|
|
|
|
|
+import jakarta.validation.constraints.NotEmpty;
|
|
|
|
|
+import jakarta.validation.constraints.Pattern;
|
|
|
import lombok.Data;
|
|
import lombok.Data;
|
|
|
import lombok.EqualsAndHashCode;
|
|
import lombok.EqualsAndHashCode;
|
|
|
|
|
|
|
@@ -17,35 +21,36 @@ import java.util.List;
|
|
|
@JsonIgnoreProperties({"dataType"}) // 忽略子类中的 dataType 字段,从而避免重复
|
|
@JsonIgnoreProperties({"dataType"}) // 忽略子类中的 dataType 字段,从而避免重复
|
|
|
public class ThingModelStructDataSpecs extends ThingModelDataSpecs {
|
|
public class ThingModelStructDataSpecs extends ThingModelDataSpecs {
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 属性标识符
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ @NotEmpty(message = "属性标识符不能为空")
|
|
|
|
|
+ @Pattern(regexp = "^[a-zA-Z][a-zA-Z0-9_]{0,31}$", message = "属性标识符只能由字母、数字和下划线组成,必须以字母开头,长度不超过 32 个字符")
|
|
|
private String identifier;
|
|
private String identifier;
|
|
|
- /**
|
|
|
|
|
- * 属性名称
|
|
|
|
|
- */
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @NotEmpty(message = "属性名称不能为空")
|
|
|
private String name;
|
|
private String name;
|
|
|
- /**
|
|
|
|
|
- * 云端可以对该属性进行的操作类型
|
|
|
|
|
- *
|
|
|
|
|
- * 枚举 {@link IotThingModelAccessModeEnum}
|
|
|
|
|
- */
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @NotEmpty(message = "操作类型不能为空")
|
|
|
|
|
+ @InEnum(IotThingModelAccessModeEnum.class)
|
|
|
private String accessMode;
|
|
private String accessMode;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 是否是标准品类的必选服务
|
|
* 是否是标准品类的必选服务
|
|
|
*/
|
|
*/
|
|
|
private Boolean required;
|
|
private Boolean required;
|
|
|
- /**
|
|
|
|
|
- * struct 数据的数据类型
|
|
|
|
|
- */
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @NotEmpty(message = "数据类型不能为空")
|
|
|
|
|
+ @Pattern(regexp = "^(int|float|double|text|date|enum|bool)$", message = "数据类型必须为:int、float、double、text、date、enum、bool")
|
|
|
private String childDataType;
|
|
private String childDataType;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 数据类型(dataType)为非列表型(int、float、double、text、date、array)的数据规范存储在 dataSpecs 中
|
|
* 数据类型(dataType)为非列表型(int、float、double、text、date、array)的数据规范存储在 dataSpecs 中
|
|
|
*/
|
|
*/
|
|
|
|
|
+ @Valid
|
|
|
private ThingModelDataSpecs dataSpecs;
|
|
private ThingModelDataSpecs dataSpecs;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 数据类型(dataType)为列表型(enum、bool、struct)的数据规范存储在 dataSpecsList 中
|
|
* 数据类型(dataType)为列表型(enum、bool、struct)的数据规范存储在 dataSpecsList 中
|
|
|
*/
|
|
*/
|
|
|
|
|
+ @Valid
|
|
|
private List<ThingModelDataSpecs> dataSpecsList;
|
|
private List<ThingModelDataSpecs> dataSpecsList;
|
|
|
|
|
|
|
|
}
|
|
}
|