...
|
...
|
@@ -39,6 +39,7 @@ |
39
|
39
|
<result property="organizationId" column="organization_id"/>
|
40
|
40
|
<result property="gatewayId" column="gateway_id"/>
|
41
|
41
|
<result property="gatewayName" column="gateway_name"/>
|
|
42
|
+ <result property="gatewayAlias" column="gateway_alias"/>
|
42
|
43
|
<association property="deviceProfile"
|
43
|
44
|
javaType="org.thingsboard.server.common.data.yunteng.dto.DeviceProfileDTO">
|
44
|
45
|
<result property="name" column="profile_name"/>
|
...
|
...
|
@@ -50,8 +51,9 @@ |
50
|
51
|
</association>
|
51
|
52
|
</resultMap>
|
52
|
53
|
<resultMap id="relationDeviceMap" type="org.thingsboard.server.common.data.yunteng.dto.RelationDeviceDTO">
|
53
|
|
- <result property="tbDeviceId" column="id"/>
|
|
54
|
+ <result property="tbDeviceId" column="tb_device_id"/>
|
54
|
55
|
<result property="tbDeviceName" column="name"/>
|
|
56
|
+ <result property="alias" column="alias"/>
|
55
|
57
|
<result property="label" column="label"/>
|
56
|
58
|
<result property="deviceState" column="status"/>
|
57
|
59
|
<result property="createdTime" column="created_time"/>
|
...
|
...
|
@@ -71,7 +73,7 @@ |
71
|
73
|
</sql>
|
72
|
74
|
<sql id="detailColumns">
|
73
|
75
|
<include refid="pageColumns"/>
|
74
|
|
- ,ifd.gateway_id,idg.name gateway_name
|
|
76
|
+ ,ifd.gateway_id,idg.name gateway_name,idg.alias gateway_alias
|
75
|
77
|
</sql>
|
76
|
78
|
<sql id="pageColumns">
|
77
|
79
|
<include refid="basicColumns"/>
|
...
|
...
|
@@ -209,27 +211,26 @@ |
209
|
211
|
</select>
|
210
|
212
|
<select id="getRelationDevicePage" resultMap="relationDeviceMap">
|
211
|
213
|
SELECT
|
212
|
|
- de.id,
|
|
214
|
+ de.tb_device_id,
|
213
|
215
|
de.name,
|
|
216
|
+ de.alias,
|
214
|
217
|
de.label,
|
215
|
|
- de.created_time,
|
|
218
|
+ de.create_time as created_time,
|
216
|
219
|
A.bool_v AS status,
|
217
|
220
|
b.long_v AS last_online_time
|
218
|
221
|
FROM
|
219
|
|
- device de
|
220
|
|
- LEFT JOIN relation rt ON de."id" = rt.to_id
|
221
|
|
- LEFT JOIN attribute_kv A ON de."id" = A.entity_id
|
|
222
|
+ tk_device de
|
|
223
|
+ LEFT JOIN relation rt ON de.tb_device_id::uuid = rt.to_id
|
|
224
|
+ LEFT JOIN attribute_kv A ON de.tb_device_id::uuid = A.entity_id
|
222
|
225
|
AND A.entity_type = 'DEVICE'
|
223
|
226
|
AND A.attribute_key = 'active'
|
224
|
|
- LEFT JOIN attribute_kv b ON de."id" = b.entity_id
|
|
227
|
+ LEFT JOIN attribute_kv b ON de.tb_device_id::uuid = b.entity_id
|
225
|
228
|
AND b.entity_type = 'DEVICE'
|
226
|
229
|
AND b.attribute_key = 'lastActivityTime'
|
227
|
230
|
<where>
|
228
|
231
|
rt.from_id ::TEXT = #{queryMap.fromId}
|
229
|
|
- AND de.tenant_id ::TEXT = #{queryMap.tenantId}
|
230
|
|
- <if test="queryMap.customerId !=null and queryMap.customerId !=''">
|
231
|
|
- AND de.customer_id ::TEXT = #{queryMap.customerId}
|
232
|
|
- </if>
|
|
232
|
+ AND de.tenant_id = #{queryMap.tenantId}
|
|
233
|
+
|
233
|
234
|
<if test="queryMap.name !=null and queryMap.name !=''">
|
234
|
235
|
AND de.name LIKE concat('%',#{queryMap.name}::TEXT,'%')
|
235
|
236
|
</if>
|
...
|
...
|
|