소스 검색

查询节点优化

gaodm 5 년 전
부모
커밋
d936864a4e
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      ltkg-service/src/main/resources/mapper/KgMapper.xml

+ 2 - 1
ltkg-service/src/main/resources/mapper/KgMapper.xml

@@ -26,7 +26,8 @@
     </resultMap>
 
     <select id="getNode" parameterType='com.diagbot.vo.KgQueryVO' resultType="com.diagbot.dto.NodeDTO">
-        Match (n:${labelName}) where n.name STARTS WITH #{inputStr} with collect(n.name) as rows1
+        Match (n:${labelName}) where n.name = #{inputStr} with collect(n.name) as rows0
+        OPTIONAL Match (n:${labelName}) where n.name STARTS WITH #{inputStr} with rows0 + collect(n.name) as rows1
         OPTIONAL Match (n:${labelName}) where n.name CONTAINS #{inputStr} with rows1 + collect(n.name) as rows
         unwind rows as row
         with distinct row as x