Commit 84bc5aec1ec67a18654ba5ecb8cfea6bc41b1c94
1 parent
07b3ac20
【代码评审】IOT:物模型
Showing
4 changed files
with
119 additions
and
3 deletions
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodelfunction/thingModel/ThingModelEvent.java
| ... | ... | @@ -7,16 +7,26 @@ import java.util.List; |
| 7 | 7 | @Data |
| 8 | 8 | public class ThingModelEvent { |
| 9 | 9 | |
| 10 | + /** | |
| 11 | + * 事件标识符 | |
| 12 | + */ | |
| 10 | 13 | private String identifier; |
| 14 | + /** | |
| 15 | + * 事件名称 | |
| 16 | + */ | |
| 11 | 17 | private String name; |
| 12 | 18 | /** |
| 19 | + * 事件描述 | |
| 20 | + */ | |
| 21 | + private String description; | |
| 22 | + | |
| 23 | + /** | |
| 13 | 24 | * 事件类型 |
| 14 | 25 | * |
| 15 | 26 | * "info"、"alert"、"error" |
| 16 | 27 | */ |
| 17 | 28 | private String type; |
| 18 | 29 | private List<ThingModelArgument> outputData; |
| 19 | - private String description; | |
| 20 | 30 | private String method; |
| 21 | 31 | |
| 22 | 32 | } | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodelfunction/thingModel/ThingModelProperty.java
| ... | ... | @@ -6,11 +6,22 @@ import lombok.Data; |
| 6 | 6 | @Data |
| 7 | 7 | public class ThingModelProperty { |
| 8 | 8 | |
| 9 | + /** | |
| 10 | + * 属性标识符 | |
| 11 | + */ | |
| 9 | 12 | private String identifier; |
| 13 | + /** | |
| 14 | + * 属性名称 | |
| 15 | + */ | |
| 10 | 16 | private String name; |
| 17 | + /** | |
| 18 | + * 属性描述 | |
| 19 | + */ | |
| 20 | + private String description; | |
| 21 | + | |
| 11 | 22 | private String accessMode; // "rw"、"r"、"w" |
| 12 | 23 | private Boolean required; |
| 24 | + // TODO @haohao:这个是不是 dataSpecs 和 dataSpecsList?https://help.aliyun.com/zh/iot/developer-reference/api-a99t11 | |
| 13 | 25 | private ThingModelDataType dataType; |
| 14 | - private String description; | |
| 15 | 26 | |
| 16 | 27 | } | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thinkmodelfunction/thingModel/ThingModelService.java
| ... | ... | @@ -7,9 +7,20 @@ import java.util.List; |
| 7 | 7 | @Data |
| 8 | 8 | public class ThingModelService { |
| 9 | 9 | |
| 10 | + /** | |
| 11 | + * 服务标识符 | |
| 12 | + */ | |
| 10 | 13 | private String identifier; |
| 14 | + /** | |
| 15 | + * 服务名称 | |
| 16 | + */ | |
| 11 | 17 | private String name; |
| 12 | 18 | /** |
| 19 | + * 服务描述 | |
| 20 | + */ | |
| 21 | + private String description; | |
| 22 | + | |
| 23 | + /** | |
| 13 | 24 | * 调用类型 |
| 14 | 25 | * |
| 15 | 26 | * "sync"、"async" |
| ... | ... | @@ -17,7 +28,6 @@ public class ThingModelService { |
| 17 | 28 | private String callType; |
| 18 | 29 | private List<ThingModelArgument> inputData; |
| 19 | 30 | private List<ThingModelArgument> outputData; |
| 20 | - private String description; | |
| 21 | 31 | private String method; |
| 22 | 32 | |
| 23 | 33 | } | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/thinkmodelfunction/IotThinkModelFunctionDO2.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.thinkmodelfunction; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.ThingModelEvent; | |
| 5 | +import cn.iocoder.yudao.module.iot.controller.admin.thinkmodelfunction.thingModel.ThingModelProperty; | |
| 6 | +import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; | |
| 7 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 8 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 9 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 10 | +import lombok.AllArgsConstructor; | |
| 11 | +import lombok.Builder; | |
| 12 | +import lombok.Data; | |
| 13 | +import lombok.NoArgsConstructor; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * IoT 产品物模型功能 DO | |
| 17 | + * | |
| 18 | + * 每个 {@link IotProductDO} 和 {@link IotThinkModelFunctionDO2} 是“一对多”的关系,它的每个属性、事件、服务都对应一条记录 | |
| 19 | + * | |
| 20 | + * @author 芋道源码 | |
| 21 | + */ | |
| 22 | +@TableName("iot_think_model_function") | |
| 23 | +@KeySequence("iot_think_model_function_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 24 | +@Data | |
| 25 | +@Builder | |
| 26 | +@NoArgsConstructor | |
| 27 | +@AllArgsConstructor | |
| 28 | +public class IotThinkModelFunctionDO2 extends BaseDO { | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 物模型功能编号 | |
| 32 | + */ | |
| 33 | + @TableId | |
| 34 | + private Long id; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 功能标识 | |
| 38 | + */ | |
| 39 | + private String identifier; | |
| 40 | + /** | |
| 41 | + * 功能名称 | |
| 42 | + */ | |
| 43 | + private String name; | |
| 44 | + /** | |
| 45 | + * 功能描述 | |
| 46 | + */ | |
| 47 | + private String description; | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 产品标识 | |
| 51 | + * | |
| 52 | + * 关联 {@link IotProductDO#getId()} | |
| 53 | + */ | |
| 54 | + private Long productId; | |
| 55 | + /** | |
| 56 | + * 产品标识 | |
| 57 | + * | |
| 58 | + * 关联 {@link IotProductDO#getProductKey()} | |
| 59 | + */ | |
| 60 | + private String productKey; | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * 功能类型 | |
| 64 | + * | |
| 65 | + * 1 - 属性 | |
| 66 | + * 2 - 服务 | |
| 67 | + * 3 - 事件 | |
| 68 | + */ | |
| 69 | + // TODO @haohao:枚举 | |
| 70 | + private Integer type; | |
| 71 | + | |
| 72 | + /** | |
| 73 | + * 属性 | |
| 74 | + */ | |
| 75 | + private ThingModelProperty property; | |
| 76 | + /** | |
| 77 | + * 事件 | |
| 78 | + */ | |
| 79 | + private ThingModelEvent event; | |
| 80 | + /** | |
| 81 | + * 服务 | |
| 82 | + */ | |
| 83 | + private String service; | |
| 84 | + | |
| 85 | +} | |
| 0 | 86 | \ No newline at end of file | ... | ... |