浏览代码

更新术语静态知识接口,能够按条件查询所有匹配结果

MarkHuang 6 年之前
父节点
当前提交
9083543fa5

+ 6 - 6
knowledgeman-service/src/main/java/com/diagbot/dto/LibraryDetailDTO.java

@@ -47,21 +47,21 @@ public class LibraryDetailDTO {
      */
     private String modifier;
 
-    /**
-     * 提示概念id
-     */
-    private Long conceptId;
-
     /**
      * 概念名称
      */
     private String name;
 
-/**
+    /**
      * 概念类型
      */
     private String type;
 
+    /**
+     * 提示概念id
+     */
+    private Long conceptId;
+
     /**
      * 静态知识来源
      */

+ 25 - 21
knowledgeman-service/src/main/resources/mapper/LibraryDetailMapper.xml

@@ -22,30 +22,34 @@
 
     <select id="getAllKnowledge" resultType="com.diagbot.dto.LibraryDetailDTO">
         SELECT
-        a.id,
-        a.is_deleted,
-        a.gmt_create,
-        a.gmt_modified,
-        a.creator,
-        a.modifier,
+        id,
+        is_deleted,
+        gmt_create,
+        gmt_modified,
+        creator,
+        modifier,
         b.name,
         b.type,
         a.concept_id,
-        a.source,
-        a.title,
-        a.content,
-        a.text,
-        a.order_no,
-        a.position,
-        a.is_reason
-        FROM library_detail a,  library_info b
-        WHERE a.is_deleted = "N" AND a.concept_id = b.concept_id AND b.is_concept=1
-        <if test = "term != ''">
-            AND b.name like '%#{term}%'
-        </if>
-        <if test = "type != ''">
-            AND b.type = #{type}
-        </if>
+        source,
+        title,
+        content,
+        text,
+        order_no,
+        position,
+        is_reason
+        FROM library_detail a,
+        (SELECT concept_id, name, type
+            FROM library_info
+            WHERE is_concept = 1
+            <if test = "term != ''">
+                AND name LIKE concat('%',#{term},'%')
+            </if>
+            <if test = "type != ''">
+                AND type = #{type}
+            </if>
+        ) b
+        WHERE a.is_deleted = "N" AND a.concept_id = b.concept_id
         ORDER BY a.concept_id
     </select>