Showing
1 changed file
with
13 additions
and
15 deletions
@@ -567,18 +567,16 @@ | @@ -567,18 +567,16 @@ | ||
567 | <include refid="basicColumns"/>,dev.transport_type | 567 | <include refid="basicColumns"/>,dev.transport_type |
568 | FROM device ifd | 568 | FROM device ifd |
569 | left join device_profile dev on ifd.device_profile_id = dev.id | 569 | left join device_profile dev on ifd.device_profile_id = dev.id |
570 | - <if test="isSceneLinkage == true"> | ||
571 | - <!--此设备是边端创建或者已经分配给边端--> | 570 | + <if test="isSceneLinkage == true or isExcludeEdge == true or isExcludeCloud == true"> |
572 | LEFT JOIN relation re on re.to_id = ifd.id and re.from_type = 'EDGE' and( re.relation_type = 'ManagedByEdge' or re.relation_type = 'Contains') | 571 | LEFT JOIN relation re on re.to_id = ifd.id and re.from_type = 'EDGE' and( re.relation_type = 'ManagedByEdge' or re.relation_type = 'Contains') |
573 | </if> | 572 | </if> |
574 | - | ||
575 | - <if test="edgeId != null"> | ||
576 | - LEFT JOIN relation re on re.to_id = ifd.id | ||
577 | - and re.from_id =#{edgeId} | ||
578 | - and re.from_type = 'EDGE' | ||
579 | - and re.relation_type_group = 'EDGE' | ||
580 | - and re.relation_type = 'Contains' | ||
581 | - </if> | 573 | +<!-- <if test="edgeId != null">--> |
574 | +<!-- LEFT JOIN relation re on re.to_id = ifd.id--> | ||
575 | +<!-- and re.from_id =#{edgeId}--> | ||
576 | +<!-- and re.from_type = 'EDGE'--> | ||
577 | +<!-- and re.relation_type_group = 'EDGE'--> | ||
578 | +<!-- and re.relation_type = 'Contains'--> | ||
579 | +<!-- </if>--> | ||
582 | <if test="isEdgeDistribution == true"> | 580 | <if test="isEdgeDistribution == true"> |
583 | <!--此设备是否已被场景联动使用--> | 581 | <!--此设备是否已被场景联动使用--> |
584 | LEFT JOIN tk_do_action action on action.device_id LIKE CONCAT('%',ifd.id ,'%') | 582 | LEFT JOIN tk_do_action action on action.device_id LIKE CONCAT('%',ifd.id ,'%') |
@@ -588,17 +586,17 @@ | @@ -588,17 +586,17 @@ | ||
588 | where | 586 | where |
589 | 1=1 | 587 | 1=1 |
590 | <if test="isExcludeEdge == true"> | 588 | <if test="isExcludeEdge == true"> |
591 | - and ifd.id not in (SELECT dev.id from device dev inner join relation re_edge on dev.id=re_edge.to_id and re_edge.from_type = 'EDGE' and re_edge.relation_type = 'ManagedByEdge') | 589 | + and (dev.transport_type!='GBT28181' or re.to_id is null) |
592 | </if> | 590 | </if> |
593 | <if test="isExcludeCloud == true"> | 591 | <if test="isExcludeCloud == true"> |
594 | - and ifd.id in (SELECT dev.id from device dev inner join relation re_edge on dev.id=re_edge.to_id and re_edge.from_type = 'EDGE' and re_edge.relation_type = 'ManagedByEdge') | 592 | + and (dev.transport_type!='GBT28181' or re.to_id is not null) |
595 | </if> | 593 | </if> |
596 | <if test="isSceneLinkage == true"> | 594 | <if test="isSceneLinkage == true"> |
597 | and re.to_id is null | 595 | and re.to_id is null |
598 | </if> | 596 | </if> |
599 | - <if test="edgeId != null"> | ||
600 | - and re.from_id is null | ||
601 | - </if> | 597 | +<!-- <if test="edgeId != null">--> |
598 | +<!-- and re.from_id is null--> | ||
599 | +<!-- </if>--> | ||
602 | <if test="isEdgeDistribution == true"> | 600 | <if test="isEdgeDistribution == true"> |
603 | and action.device_id is null | 601 | and action.device_id is null |
604 | and cond.entity_id is null | 602 | and cond.entity_id is null |