浏览代码

诊断依据检索优化

zhoutg 5 年之前
父节点
当前提交
7679ad6ff6
共有 1 个文件被更改,包括 28 次插入0 次删除
  1. 28 0
      knowledgeman-service/src/main/resources/mapper/DiagnoseMapper.xml

+ 28 - 0
knowledgeman-service/src/main/resources/mapper/DiagnoseMapper.xml

@@ -60,6 +60,32 @@
 
 
     <select id="search" resultType="com.diagbot.entity.LibraryInfo">
+        SELECT a.* FROM kl_library_info a, kl_concept b
+        WHERE a.is_deleted = 'N' and b.is_deleted = 'N'
+        AND a.concept_id = b.id
+        <if test="typeList != null and typeList.size() > 0">
+            AND a.type_id in
+            <foreach  collection="typeList" item="item" open="("  separator=","  close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND (a.NAME = #{name} OR a.spell = #{name})
+
+        union
+
+        SELECT a.* FROM kl_library_info a, kl_concept b
+        WHERE a.is_deleted = 'N' and b.is_deleted = 'N'
+        AND a.concept_id = b.id
+        <if test="typeList != null and typeList.size() > 0">
+            AND a.type_id in
+            <foreach  collection="typeList" item="item" open="("  separator=","  close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND (a.NAME LIKE  concat(#{name},'%') OR a.spell LIKE concat(#{name},'%'))
+
+        union
+
         SELECT a.* FROM kl_library_info a, kl_concept b
         WHERE a.is_deleted = 'N' and b.is_deleted = 'N'
         AND a.concept_id = b.id
@@ -70,6 +96,8 @@
             </foreach>
         </if>
         AND (a.NAME LIKE  concat('%',#{name},'%') OR a.spell LIKE concat('%',#{name},'%'))
+
+
     </select>
 
 </mapper>