Showing
9 changed files
with
60 additions
and
18 deletions
... | ... | @@ -6,6 +6,7 @@ import lombok.Data; |
6 | 6 | import lombok.EqualsAndHashCode; |
7 | 7 | import org.thingsboard.server.common.data.yunteng.enums.ActionTypeEnum; |
8 | 8 | import org.thingsboard.server.common.data.yunteng.enums.CallTypeEnum; |
9 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceTypeEnum; | |
9 | 10 | import org.thingsboard.server.common.data.yunteng.enums.ScopeEnum; |
10 | 11 | |
11 | 12 | import java.util.List; |
... | ... | @@ -28,6 +29,9 @@ public class DoActionDTO extends TenantDTO { |
28 | 29 | @ApiModelProperty(value = "设备配置ID") |
29 | 30 | private String deviceProfileId; |
30 | 31 | |
32 | + @ApiModelProperty(value = "设备类型") | |
33 | + private DeviceTypeEnum deviceType; | |
34 | + | |
31 | 35 | @ApiModelProperty(value = "调用类型:sync同步/async异步") |
32 | 36 | private CallTypeEnum callType; |
33 | 37 | ... | ... |
... | ... | @@ -5,6 +5,7 @@ import lombok.Data; |
5 | 5 | import lombok.EqualsAndHashCode; |
6 | 6 | import org.thingsboard.server.common.data.device.profile.AlarmCondition; |
7 | 7 | import org.thingsboard.server.common.data.device.profile.AlarmRule; |
8 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceTypeEnum; | |
8 | 9 | import org.thingsboard.server.common.data.yunteng.enums.ScopeEnum; |
9 | 10 | import org.thingsboard.server.common.data.yunteng.enums.TriggerTypeEnum; |
10 | 11 | |
... | ... | @@ -23,6 +24,9 @@ public class DoConditionDTO extends TenantDTO { |
23 | 24 | @ApiModelProperty(value = "设备配置ID") |
24 | 25 | private String deviceProfileId; |
25 | 26 | |
27 | + @ApiModelProperty(value = "设备类型") | |
28 | + private DeviceTypeEnum deviceType; | |
29 | + | |
26 | 30 | @ApiModelProperty(value = "触发器关联实体") |
27 | 31 | private ScopeEnum entityType; |
28 | 32 | ... | ... |
... | ... | @@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty; |
4 | 4 | import lombok.Data; |
5 | 5 | import lombok.EqualsAndHashCode; |
6 | 6 | import org.thingsboard.server.common.data.device.profile.AlarmRule; |
7 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceTypeEnum; | |
7 | 8 | import org.thingsboard.server.common.data.yunteng.enums.ScopeEnum; |
8 | 9 | import org.thingsboard.server.common.data.yunteng.enums.TriggerTypeEnum; |
9 | 10 | |
... | ... | @@ -22,6 +23,9 @@ public class TriggerDTO extends TenantDTO { |
22 | 23 | @ApiModelProperty(value = "设备配置ID") |
23 | 24 | private String deviceProfileId; |
24 | 25 | |
26 | + @ApiModelProperty(value = "设备类型") | |
27 | + private DeviceTypeEnum deviceType; | |
28 | + | |
25 | 29 | @ApiModelProperty(value = "触发器关联实体,例如:设备ID、场景联动ID、定时任务CRON表达式") |
26 | 30 | private ScopeEnum entityType; |
27 | 31 | ... | ... |
... | ... | @@ -10,6 +10,7 @@ import org.apache.ibatis.type.EnumTypeHandler; |
10 | 10 | import org.thingsboard.server.common.data.yunteng.constant.ModelConstants; |
11 | 11 | import org.thingsboard.server.common.data.yunteng.enums.ActionTypeEnum; |
12 | 12 | import org.thingsboard.server.common.data.yunteng.enums.CallTypeEnum; |
13 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceTypeEnum; | |
13 | 14 | import org.thingsboard.server.common.data.yunteng.enums.ScopeEnum; |
14 | 15 | import org.thingsboard.server.dao.yunteng.mapper.ListStringTypeHandler; |
15 | 16 | import java.util.List; |
... | ... | @@ -28,6 +29,9 @@ public class TkDoActionEntity extends TenantBaseEntity { |
28 | 29 | private List<String> deviceId; |
29 | 30 | |
30 | 31 | @TableField(typeHandler = EnumTypeHandler.class) |
32 | + private DeviceTypeEnum deviceType; | |
33 | + | |
34 | + @TableField(typeHandler = EnumTypeHandler.class) | |
31 | 35 | private ScopeEnum entityType; |
32 | 36 | |
33 | 37 | @TableField(typeHandler = EnumTypeHandler.class) | ... | ... |
... | ... | @@ -3,11 +3,13 @@ package org.thingsboard.server.dao.yunteng.entities; |
3 | 3 | import com.baomidou.mybatisplus.annotation.TableField; |
4 | 4 | import com.baomidou.mybatisplus.annotation.TableName; |
5 | 5 | import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; |
6 | +import io.swagger.annotations.ApiModelProperty; | |
6 | 7 | import lombok.Data; |
7 | 8 | import lombok.EqualsAndHashCode; |
8 | 9 | import org.apache.ibatis.type.EnumTypeHandler; |
9 | 10 | import org.thingsboard.server.common.data.device.profile.AlarmRule; |
10 | 11 | import org.thingsboard.server.common.data.yunteng.constant.ModelConstants; |
12 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceTypeEnum; | |
11 | 13 | import org.thingsboard.server.common.data.yunteng.enums.ScopeEnum; |
12 | 14 | import org.thingsboard.server.common.data.yunteng.enums.TriggerTypeEnum; |
13 | 15 | import org.thingsboard.server.dao.yunteng.mapper.ListStringTypeHandler; |
... | ... | @@ -29,6 +31,9 @@ public class TkDoConditionEntity extends TenantBaseEntity { |
29 | 31 | private String deviceProfileId; |
30 | 32 | |
31 | 33 | @TableField(typeHandler = EnumTypeHandler.class) |
34 | + private DeviceTypeEnum deviceType; | |
35 | + | |
36 | + @TableField(typeHandler = EnumTypeHandler.class) | |
32 | 37 | private ScopeEnum entityType; |
33 | 38 | |
34 | 39 | @TableField(typeHandler = EnumTypeHandler.class) | ... | ... |
... | ... | @@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode; |
8 | 8 | import org.apache.ibatis.type.EnumTypeHandler; |
9 | 9 | import org.thingsboard.server.common.data.device.profile.AlarmRule; |
10 | 10 | import org.thingsboard.server.common.data.yunteng.constant.ModelConstants; |
11 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceTypeEnum; | |
11 | 12 | import org.thingsboard.server.common.data.yunteng.enums.ScopeEnum; |
12 | 13 | import org.thingsboard.server.common.data.yunteng.enums.TriggerTypeEnum; |
13 | 14 | import org.thingsboard.server.dao.yunteng.mapper.ListStringTypeHandler; |
... | ... | @@ -30,6 +31,9 @@ public class TkTriggerEntity extends TenantBaseEntity { |
30 | 31 | private String deviceProfileId; |
31 | 32 | |
32 | 33 | @TableField(typeHandler = EnumTypeHandler.class) |
34 | + private DeviceTypeEnum deviceType; | |
35 | + | |
36 | + @TableField(typeHandler = EnumTypeHandler.class) | |
33 | 37 | private ScopeEnum entityType; |
34 | 38 | |
35 | 39 | @TableField(typeHandler = EnumTypeHandler.class) | ... | ... |
... | ... | @@ -4,9 +4,12 @@ |
4 | 4 | <mapper namespace="org.thingsboard.server.dao.yunteng.mapper.DoActionMapper"> |
5 | 5 | <resultMap id="actionDTO" type="org.thingsboard.server.common.data.yunteng.dto.DoActionDTO"> |
6 | 6 | <result property="id" column="id"/> |
7 | - <result property="deviceId" column="device_id" typeHandler="org.thingsboard.server.dao.yunteng.mapper.ListStringTypeHandler"/> | |
7 | + <result property="deviceId" column="device_id" | |
8 | + typeHandler="org.thingsboard.server.dao.yunteng.mapper.ListStringTypeHandler"/> | |
8 | 9 | <result property="entityType" column="entity_type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> |
9 | - <result property="doContext" column="do_context" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> | |
10 | + <result property="deviceType" column="device_type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> | |
11 | + <result property="doContext" column="do_context" | |
12 | + typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> | |
10 | 13 | <result property="outTarget" column="out_target" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> |
11 | 14 | <result property="callType" column="call_type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> |
12 | 15 | <result property="commandType" column="command_type"/> |
... | ... | @@ -19,14 +22,14 @@ |
19 | 22 | <result property="updateTime" column="update_time"/> |
20 | 23 | <result property="createTime" column="create_time"/> |
21 | 24 | <result property="creator" column="creator"/> |
22 | - | |
23 | 25 | </resultMap> |
24 | 26 | <sql id="columns"> |
25 | - id,device_id,entity_type,do_context,out_target,call_type,scene_linkage_id,alarm_profile_id, | |
27 | + id,device_id,entity_type,device_type,do_context,out_target,call_type,scene_linkage_id,alarm_profile_id, | |
26 | 28 | tenant_id,updater,update_time,create_time,creator,command_type,things_model_id,device_profile_id |
27 | 29 | </sql> |
28 | 30 | <select id="listBySceneId" resultMap="actionDTO"> |
29 | - SELECT <include refid="columns"/> FROM tk_do_action WHERE scene_linkage_id = #{sceneId} | |
31 | + SELECT | |
32 | + <include refid="columns"/> | |
33 | + FROM tk_do_action WHERE scene_linkage_id = #{sceneId} | |
30 | 34 | </select> |
31 | - | |
32 | 35 | </mapper> | ... | ... |
... | ... | @@ -4,22 +4,29 @@ |
4 | 4 | <mapper namespace="org.thingsboard.server.dao.yunteng.mapper.DoConditionMapper"> |
5 | 5 | <resultMap id="conditionDTO" type="org.thingsboard.server.common.data.yunteng.dto.DoConditionDTO"> |
6 | 6 | <result property="id" column="id"/> |
7 | - <result property="entityId" column="entity_id" typeHandler="org.thingsboard.server.dao.yunteng.mapper.ListStringTypeHandler"/> | |
7 | + <result property="entityId" column="entity_id" | |
8 | + typeHandler="org.thingsboard.server.dao.yunteng.mapper.ListStringTypeHandler"/> | |
8 | 9 | <result property="entityType" column="entity_type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> |
9 | - <result property="triggerCondition" column="trigger_condition" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> | |
10 | + <result property="deviceType" column="device_type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> | |
11 | + <result property="triggerCondition" column="trigger_condition" | |
12 | + typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> | |
10 | 13 | <result property="triggerType" column="trigger_type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> |
11 | 14 | <result property="sceneLinkageId" column="scene_linkage_id"/> |
12 | - <result property="description" column="description"/> | |
13 | 15 | <result property="tenantId" column="tenant_id"/> |
14 | 16 | <result property="updater" column="updater"/> |
15 | 17 | <result property="updateTime" column="update_time"/> |
16 | 18 | <result property="createTime" column="create_time"/> |
17 | 19 | <result property="creator" column="creator"/> |
18 | - | |
19 | 20 | </resultMap> |
20 | 21 | |
22 | + <sql id="columns"> | |
23 | + id,entity_id,entity_type,device_type,trigger_condition,trigger_type,scene_linkage_id,tenant_id | |
24 | + ,creator,updater,create_time,update_time | |
25 | + </sql> | |
26 | + | |
21 | 27 | <select id="listBySceneId" resultMap="conditionDTO"> |
22 | - SELECT * FROM tk_do_condition WHERE scene_linkage_id = #{sceneId} | |
28 | + SELECT | |
29 | + <include refid="columns"/> | |
30 | + FROM tk_do_condition WHERE scene_linkage_id = #{sceneId} | |
23 | 31 | </select> |
24 | - | |
25 | 32 | </mapper> | ... | ... |
... | ... | @@ -4,22 +4,29 @@ |
4 | 4 | <mapper namespace="org.thingsboard.server.dao.yunteng.mapper.TriggerMapper"> |
5 | 5 | <resultMap id="triggerDTO" type="org.thingsboard.server.common.data.yunteng.dto.TriggerDTO"> |
6 | 6 | <result property="id" column="id"/> |
7 | - <result property="entityId" column="entity_id" typeHandler="org.thingsboard.server.dao.yunteng.mapper.ListStringTypeHandler"/> | |
7 | + <result property="entityId" column="entity_id" | |
8 | + typeHandler="org.thingsboard.server.dao.yunteng.mapper.ListStringTypeHandler"/> | |
8 | 9 | <result property="entityType" column="entity_type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> |
9 | - <result property="triggerCondition" column="trigger_condition" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> | |
10 | + <result property="deviceType" column="device_type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> | |
11 | + <result property="triggerCondition" column="trigger_condition" | |
12 | + typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> | |
10 | 13 | <result property="triggerType" column="trigger_type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> |
11 | 14 | <result property="sceneLinkageId" column="scene_linkage_id"/> |
12 | - <result property="description" column="description"/> | |
13 | 15 | <result property="tenantId" column="tenant_id"/> |
14 | 16 | <result property="updater" column="updater"/> |
15 | 17 | <result property="updateTime" column="update_time"/> |
16 | 18 | <result property="createTime" column="create_time"/> |
17 | 19 | <result property="creator" column="creator"/> |
18 | - | |
19 | 20 | </resultMap> |
20 | 21 | |
22 | + <sql id="columns"> | |
23 | + id,entity_id,entity_type,device_type,trigger_condition,trigger_type,scene_linkage_id,tenant_id,creator | |
24 | + ,updater,create_time,update_time | |
25 | + </sql> | |
26 | + | |
21 | 27 | <select id="listBySceneId" resultMap="triggerDTO"> |
22 | - SELECT * FROM tk_trigger WHERE scene_linkage_id = #{sceneId} | |
28 | + SELECT | |
29 | + <include refid="columns"/> | |
30 | + FROM tk_trigger WHERE scene_linkage_id = #{sceneId} | |
23 | 31 | </select> |
24 | - | |
25 | 32 | </mapper> | ... | ... |