mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
【代码评审】IOT:物模型
This commit is contained in:
parent
64fefaa630
commit
07b3ac20f6
@ -1,9 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class ThingModelArraySpecs {
|
|
||||||
private int size; // 数组长度
|
|
||||||
private ThingModelDataType item; // 数组元素的类型
|
|
||||||
}
|
|
@ -1,14 +1,22 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType.ThingModelArgument;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ThingModelEvent {
|
public class ThingModelEvent {
|
||||||
|
|
||||||
private String identifier;
|
private String identifier;
|
||||||
private String name;
|
private String name;
|
||||||
private String type; // "info"、"alert"、"error"
|
/**
|
||||||
|
* 事件类型
|
||||||
|
*
|
||||||
|
* "info"、"alert"、"error"
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
private List<ThingModelArgument> outputData;
|
private List<ThingModelArgument> outputData;
|
||||||
private String description;
|
private String description;
|
||||||
private String method;
|
private String method;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType.ThingModelDataType;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ThingModelProperty {
|
public class ThingModelProperty {
|
||||||
|
|
||||||
private String identifier;
|
private String identifier;
|
||||||
private String name;
|
private String name;
|
||||||
private String accessMode; // "rw"、"r"、"w"
|
private String accessMode; // "rw"、"r"、"w"
|
||||||
private boolean required;
|
private Boolean required;
|
||||||
private ThingModelDataType dataType;
|
private ThingModelDataType dataType;
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,23 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType.ThingModelArgument;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ThingModelService {
|
public class ThingModelService {
|
||||||
|
|
||||||
private String identifier;
|
private String identifier;
|
||||||
private String name;
|
private String name;
|
||||||
private String callType; // "sync"、"async"
|
/**
|
||||||
|
* 调用类型
|
||||||
|
*
|
||||||
|
* "sync"、"async"
|
||||||
|
*/
|
||||||
|
private String callType;
|
||||||
private List<ThingModelArgument> inputData;
|
private List<ThingModelArgument> inputData;
|
||||||
private List<ThingModelArgument> outputData;
|
private List<ThingModelArgument> outputData;
|
||||||
private String description;
|
private String description;
|
||||||
private String method;
|
private String method;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ThingModelArgument {
|
public class ThingModelArgument {
|
||||||
|
|
||||||
private String identifier;
|
private String identifier;
|
||||||
private String name;
|
private String name;
|
||||||
private ThingModelDataType dataType;
|
private ThingModelDataType dataType;
|
||||||
private String direction; // 用于区分输入或输出参数,"input" 或 "output"
|
/**
|
||||||
|
* 用于区分输入或输出参数,"input" 或 "output"
|
||||||
|
*/
|
||||||
|
private String direction;
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ThingModelArraySpecs {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数组长度
|
||||||
|
*/
|
||||||
|
private int size;
|
||||||
|
/**
|
||||||
|
* 数组元素的类型
|
||||||
|
*/
|
||||||
|
private ThingModelDataType item;
|
||||||
|
|
||||||
|
}
|
@ -1,11 +1,12 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
|
// TODO @haohao:这个是不是和别的类,不太统一哈
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class ThingModelArrayType extends ThingModelDataType {
|
public class ThingModelArrayType extends ThingModelDataType {
|
||||||
|
|
||||||
private ThingModelArraySpecs specs;
|
private ThingModelArraySpecs specs;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@ -6,5 +6,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class ThingModelBoolType extends ThingModelDataType {
|
public class ThingModelBoolType extends ThingModelDataType {
|
||||||
|
|
||||||
// Bool 类型一般不需要额外的 specs
|
// Bool 类型一般不需要额外的 specs
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||||
@ -18,5 +18,7 @@ import lombok.Data;
|
|||||||
@JsonSubTypes.Type(value = ThingModelArrayType.class, name = "array")
|
@JsonSubTypes.Type(value = ThingModelArrayType.class, name = "array")
|
||||||
})
|
})
|
||||||
public abstract class ThingModelDataType {
|
public abstract class ThingModelDataType {
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
}
|
}
|
@ -1,10 +1,10 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class ThingModelDateType extends ThingModelDataType {
|
public class ThingModelDateType extends ThingModelDataType {
|
||||||
|
|
||||||
// Date 类型一般不需要额外的 specs
|
// Date 类型一般不需要额外的 specs
|
||||||
|
|
||||||
}
|
}
|
@ -1,18 +1,18 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class ThingModelDoubleType extends ThingModelDataType {
|
public class ThingModelDoubleType extends ThingModelDataType {
|
||||||
private ThingModelDoubleSpecs specs;
|
private ThingModelDoubleSpecs specs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
class ThingModelDoubleSpecs {
|
class ThingModelDoubleSpecs {
|
||||||
|
|
||||||
private Double min;
|
private Double min;
|
||||||
private Double max;
|
private Double max;
|
||||||
private Double step;
|
private Double step;
|
||||||
private String unit;
|
private String unit;
|
||||||
|
|
||||||
}
|
}
|
@ -1,11 +1,15 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class ThingModelEnumType extends ThingModelDataType {
|
public class ThingModelEnumType extends ThingModelDataType {
|
||||||
private Map<String, String> specs; // 枚举值和描述的键值对
|
|
||||||
|
/**
|
||||||
|
* 枚举值和描述的键值对
|
||||||
|
*/
|
||||||
|
private Map<String, String> specs;
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@ -11,8 +11,10 @@ public class ThingModelFloatType extends ThingModelDataType {
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
class ThingModelFloatSpecs {
|
class ThingModelFloatSpecs {
|
||||||
|
|
||||||
private Float min;
|
private Float min;
|
||||||
private Float max;
|
private Float max;
|
||||||
private Float step;
|
private Float step;
|
||||||
private String unit;
|
private String unit;
|
||||||
|
|
||||||
}
|
}
|
@ -1,18 +1,18 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class ThingModelIntType extends ThingModelDataType {
|
public class ThingModelIntType extends ThingModelDataType {
|
||||||
private ThingModelIntSpecs specs;
|
private ThingModelIntSpecs specs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
class ThingModelIntSpecs {
|
class ThingModelIntSpecs {
|
||||||
|
|
||||||
private Integer min;
|
private Integer min;
|
||||||
private Integer max;
|
private Integer max;
|
||||||
private Integer step;
|
private Integer step;
|
||||||
private String unit;
|
private String unit;
|
||||||
|
|
||||||
}
|
}
|
@ -1,11 +1,13 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ThingModelStructField {
|
public class ThingModelStructField {
|
||||||
|
|
||||||
private String identifier;
|
private String identifier;
|
||||||
private String name;
|
private String name;
|
||||||
private ThingModelDataType dataType;
|
private ThingModelDataType dataType;
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
}
|
}
|
@ -1,13 +1,14 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class ThingModelStructType extends ThingModelDataType {
|
public class ThingModelStructType extends ThingModelDataType {
|
||||||
|
|
||||||
private List<ThingModelStructField> specs;
|
private List<ThingModelStructField> specs;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,15 +1,20 @@
|
|||||||
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel;
|
package cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class ThingModelTextType extends ThingModelDataType {
|
public class ThingModelTextType extends ThingModelDataType {
|
||||||
|
|
||||||
private ThingModelTextSpecs specs;
|
private ThingModelTextSpecs specs;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
class ThingModelTextSpecs {
|
class ThingModelTextSpecs {
|
||||||
private Integer length; // 最大长度
|
|
||||||
|
/**
|
||||||
|
* 最大长度
|
||||||
|
*/
|
||||||
|
private Integer length;
|
||||||
|
|
||||||
}
|
}
|
@ -1,42 +1,48 @@
|
|||||||
package cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodelfunction;
|
package cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodelfunction;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO;
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IoT 产品物模型 DO
|
* IoT 产品物模型功能 DO
|
||||||
|
*
|
||||||
|
* 每个 {@link IotProductDO} 和 {@link IotThinkModelFunctionDO} 是“一对多”的关系,它的每个属性、事件、服务都对应一条记录
|
||||||
*
|
*
|
||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@TableName("iot_think_model_function")
|
@TableName("iot_think_model_function")
|
||||||
@KeySequence("iot_think_model_function_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
@KeySequence("iot_think_model_function_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class IotThinkModelFunctionDO extends BaseDO {
|
public class IotThinkModelFunctionDO extends BaseDO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产品ID
|
* 物模型功能编号
|
||||||
*/
|
*/
|
||||||
@TableId
|
@TableId
|
||||||
private Long id;
|
private Long id;
|
||||||
|
// TODO @haohao:是不是有一个 identifier,需要要有哈
|
||||||
|
// TODO @haohao:name、description 属性,还有个类型
|
||||||
/**
|
/**
|
||||||
* 产品标识
|
* 产品标识
|
||||||
|
*
|
||||||
|
* 关联 {@link IotProductDO#getId()}
|
||||||
*/
|
*/
|
||||||
private Long productId;
|
private Long productId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产品标识
|
* 产品标识
|
||||||
|
*
|
||||||
|
* 关联 {@link IotProductDO#getProductKey()}
|
||||||
*/
|
*/
|
||||||
private String productKey;
|
private String productKey;
|
||||||
|
|
||||||
|
// TODO @haohao:是不是可以搞成 ThingModelProperty、ThingModelEvent、ThingModelService 进行存储
|
||||||
/**
|
/**
|
||||||
* 属性列表
|
* 属性列表
|
||||||
*/
|
*/
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package cn.iocoder.yudao.module.iot.service.thinkmodelfunction;
|
package cn.iocoder.yudao.module.iot.service.thinkmodelfunction;
|
||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.*;
|
import cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.*;
|
||||||
|
import cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType.ThingModelArgument;
|
||||||
|
import cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType.ThingModelArraySpecs;
|
||||||
|
import cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType.ThingModelArrayType;
|
||||||
|
import cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.dataType.ThingModelTextType;
|
||||||
import cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.vo.IotThinkModelFunctionSaveReqVO;
|
import cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.vo.IotThinkModelFunctionSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.iot.convert.thinkmodelfunction.IotThinkModelFunctionConvert;
|
import cn.iocoder.yudao.module.iot.convert.thinkmodelfunction.IotThinkModelFunctionConvert;
|
||||||
import cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodelfunction.IotThinkModelFunctionDO;
|
import cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodelfunction.IotThinkModelFunctionDO;
|
||||||
|
Loading…
Reference in New Issue
Block a user