Commit 01eea2e083b8edfe9eff18f463d6fde215da4511

Authored by lijianfa_14810364212
1 parent 7b71937e

fix:分配边端设备排除云端GBT28181

... ... @@ -567,18 +567,16 @@
567 567 <include refid="basicColumns"/>,dev.transport_type
568 568 FROM device ifd
569 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 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 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 580 <if test="isEdgeDistribution == true">
583 581 <!--此设备是否已被场景联动使用-->
584 582 LEFT JOIN tk_do_action action on action.device_id LIKE CONCAT('%',ifd.id ,'%')
... ... @@ -588,17 +586,17 @@
588 586 where
589 587 1=1
590 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 590 </if>
593 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 593 </if>
596 594 <if test="isSceneLinkage == true">
597 595 and re.to_id is null
598 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 600 <if test="isEdgeDistribution == true">
603 601 and action.device_id is null
604 602 and cond.entity_id is null
... ...