Browse Source

术语多层关系概念搜索修改

rgb 6 years ago
parent
commit
4b0c46e037

+ 2 - 2
knowledgeman-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -203,8 +203,8 @@ public class ConceptFacade extends ConceptServiceImpl {
             QueryWrapper<Relation> relationQe = new QueryWrapper<>();
             relationQe.eq("relation_id", getAllForRelationVO.getRelationId());
             if (getAllForRelationVO.getRelationPosition() == 1) {
-                relationQe.in("start_id", conceptIdList);
-                relationQe.eq(getAllForRelationVO.getRelationConceptId() != null, "end_id", getAllForRelationVO.getRelationConceptId());
+            	relationQe.eq(getAllForRelationVO.getRelationConceptId() != null, "end_id", getAllForRelationVO.getRelationConceptId());
+            	relationQe.and(wrapper->wrapper.in("start_id", conceptIdList).or(getAllForRelationVO.getRelationConceptId() == null).in("end_id", conceptIdList));
                 reCouMap = relationFacade.list(relationQe).stream().collect(Collectors.groupingBy(Relation::getStartId, Collectors.counting()));
             } else if(getAllForRelationVO.getRelationConceptId() != null) {
                 relationQe.in("end_id", conceptIdList);