Commit f791e3d580e4c2910daf1ccf48ca06123565dfef

Authored by 云中非
1 parent 010a2dd7

fix: 关联网关的传感器没有网关信息

... ... @@ -74,7 +74,7 @@ public class YtDeviceController extends BaseController {
74 74 }
75 75 DeviceDTO newDeviceDTO = null;
76 76 boolean isIncludeRelation = false;
77   - String gateWayDeviceId = deviceDTO.getGateWayDeviceId();
  77 + String gateWayDeviceId = deviceDTO.getGatewayId();
78 78 DeviceDTO gateWayDevice = null;
79 79 if (StringUtils.isNotEmpty(gateWayDeviceId)) {
80 80 gateWayDevice =
... ...
... ... @@ -38,7 +38,8 @@ public class DeviceDTO extends TenantDTO {
38 38 private String profileId;
39 39
40 40 @ApiModelProperty(value = "关联网关设备")
41   - private String gateWayDeviceId;
  41 + private String gatewayId;
  42 + private String gatewayName;
42 43
43 44 @ApiModelProperty(value = "设备凭证")
44 45 private YtCredentialsDto deviceToken;
... ...
... ... @@ -24,6 +24,7 @@ public class YtDevice extends TenantBaseEntity {
24 24 private JsonNode deviceInfo;
25 25 private String profileId;
26 26 private String tbDeviceId;
  27 + private String gatewayId;
27 28 private String deviceTypeId;
28 29 private String label;
29 30 @TableField(typeHandler = EnumTypeHandler.class)
... ...
... ... @@ -25,6 +25,8 @@
25 25 <result property="description" column="description"/>
26 26 <result property="customerId" column="customer_id"/>
27 27 <result property="organizationId" column="organization_id"/>
  28 + <result property="gatewayId" column="gateway_id"/>
  29 + <result property="gatewayName" column="gateway_name"/>
28 30 <association property="deviceProfile" javaType="org.thingsboard.server.common.data.yunteng.dto.DeviceProfileDTO">
29 31 <result property="name" column="profile_name"/>
30 32 <result property="transportType" column="transport_type"/>
... ... @@ -41,6 +43,7 @@
41 43 <result property="createdTime" column="created_time"/>
42 44 <result property="lastOnlineTime" column="last_online_time"/>
43 45 </resultMap>
  46 +
44 47 <sql id="basicColumns">
45 48 ifd.id,ifd.name,ifd.device_info,ifd.profile_id,ifd.active_time,ifd.tenant_id,ifd.description
46 49 ,ifd.tb_device_id,ifd.label,ifd.last_connect_time,ifd.device_type,ifd.device_state,ifd.create_time,ifd.update_time,ifd.creator,
... ... @@ -48,6 +51,7 @@
48 51 </sql>
49 52 <sql id="detailColumns">
50 53 <include refid="basicColumns"/>
  54 + ,ifd.gateway_id,idg.name gateway_name
51 55 ,ifdp.name AS profile_name,ifdp.transport_type
52 56 ,io.name AS organization_name
53 57 </sql>
... ... @@ -109,6 +113,7 @@
109 113 FROM iotfs_device ifd
110 114 LEFT JOIN device_profile ifdp ON ifd.profile_id = CAST (ifdp.id AS VARCHAR)
111 115 LEFT JOIN iotfs_organization io ON io.id = ifd.organization_id
  116 + LEFT JOIN iotfs_device idg ON idg.id = ifd.gateway_id
112 117 <where>
113 118 <if test="tenantId !=null and tenantId !=''">
114 119 AND ifd.tenant_id = #{tenantId}
... ...