修改代码
This commit is contained in:
parent
c08855a3b5
commit
054460beaf
|
|
@ -247,22 +247,13 @@ public class ThingsBoardDomainImpl implements IThingsBoardDomain {
|
||||||
try {
|
try {
|
||||||
DeviceId gatewayId = new DeviceId(UUID.fromString(gatewayDeviceId));
|
DeviceId gatewayId = new DeviceId(UUID.fromString(gatewayDeviceId));
|
||||||
|
|
||||||
// 构建查询参数:从网关出发查询子设备
|
// 调用 findInfoByFrom 查询从网关出发的关系信息
|
||||||
// direction = FROM 表示从 rootId 出发的关系(网关 -> 子设备)
|
// 对应前端 API: GET /api/relations/info?fromId=xxx&fromType=DEVICE&relationTypeGroup=COMMON
|
||||||
RelationsSearchParameters parameters = new RelationsSearchParameters(
|
List<EntityRelationInfo> relationInfos = client.findInfoByFrom(
|
||||||
gatewayId, // rootId: 网关设备ID
|
gatewayId,
|
||||||
EntitySearchDirection.FROM, // direction: 从网关出发
|
RelationTypeGroup.COMMON
|
||||||
1, // maxLevel: 查询深度为1(直接子设备)
|
|
||||||
RelationTypeGroup.COMMON, // relationTypeGroup: COMMON
|
|
||||||
false // fetchLastLevelOnly: false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
EntityRelationsQuery query = new EntityRelationsQuery();
|
|
||||||
query.setParameters(parameters);
|
|
||||||
|
|
||||||
// 调用 findInfoByQuery 查询关系信息
|
|
||||||
List<EntityRelationInfo> relationInfos = client.findInfoByQuery(query);
|
|
||||||
|
|
||||||
if (relationInfos == null || relationInfos.isEmpty()) {
|
if (relationInfos == null || relationInfos.isEmpty()) {
|
||||||
log.debug("网关 {} 没有子设备", gatewayDeviceId);
|
log.debug("网关 {} 没有子设备", gatewayDeviceId);
|
||||||
return childDeviceIds;
|
return childDeviceIds;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue