gaodm пре 3 година
родитељ
комит
c80ece3a65

+ 5 - 0
src/main/java/com/diagbot/dto/RuleQueryDTO.java

@@ -1,5 +1,6 @@
 package com.diagbot.dto;
 
+import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RuleTypeEnum;
 import lombok.Getter;
 import lombok.Setter;
@@ -18,6 +19,10 @@ public class RuleQueryDTO {
     private Integer ruleType;
     private String ruleTypeName;
 
+    public String getLibTypeName() {
+        return LexiconEnum.getName(libType);
+    }
+
     public String getRuleTypeName() {
         return RuleTypeEnum.getName(ruleType);
     }

+ 15 - 21
src/main/resources/mapper/KlRuleMapper.xml

@@ -609,24 +609,16 @@
         SELECT DISTINCT
         t12.libName AS libName,
         t12.libType AS libType,
-        t12.ruleType AS ruleType,
-        t13.`name` AS libTypeName
+        t12.ruleType AS ruleType
         FROM
         (
         SELECT
         t1.concept_id AS conceptId,
-        CONCAT_WS(
-        "_",
-        t1.concept_id,
-        t1.rule_type
-        ) AS conceptGroup,
         t1.id AS ruleId,
         t4.lib_name AS libName,
         t4.lib_type AS libType,
         t1.rule_type AS ruleType,
         t1.has_sub_cond AS hasSubCond,
-        t1.description AS description,
-        t1.msg AS msg,
         t1.gmt_modified AS gmtModified
         FROM
         kl_rule t1,
@@ -639,17 +631,23 @@
         AND t4. STATUS = 1
         AND t4.lib_type BETWEEN 100
         AND 299
-        UNION
+        <if test="libName!=null and libName!=''">
+            AND UPPER(t4.lib_name) LIKE CONCAT('%', UPPER(trim(#{libName})), '%')
+        </if>
+        <if test="libType !=null">
+            AND t4.lib_type = #{libType}
+        </if>
+        <if test="ruleType !=null">
+            AND t1.rule_type = #{ruleType}
+        </if>
+        UNION ALL
         SELECT
         t11.id AS conceptId,
-        CONCAT_WS("_", t11.id, t1.rule_type) AS conceptGroup,
         t1.id AS ruleId,
         t11.lib_name AS libName,
         t11.lib_type AS libType,
         t1.rule_type AS ruleType,
         t1.has_sub_cond AS hasSubCond,
-        t1.description AS description,
-        t1.msg AS msg,
         t1.gmt_modified AS gmtModified
         FROM
         kl_rule t1,
@@ -673,20 +671,16 @@
         AND t11.is_deleted = "N"
         AND t10. STATUS = 1
         AND t11. STATUS = 1
-        ) t12,
-        kl_lexicon t13
-        WHERE
-        t12.libType = t13.`code`
-        AND t13.is_deleted = "N"
         <if test="libName!=null and libName!=''">
-            AND UPPER(t12.libName) LIKE CONCAT('%', UPPER(trim(#{libName})), '%')
+            AND UPPER(t11.lib_name) LIKE CONCAT('%', UPPER(trim(#{libName})), '%')
         </if>
         <if test="libType !=null">
-            AND t12.libType = #{libType}
+            AND t11.lib_type = #{libType}
         </if>
         <if test="ruleType !=null">
-            AND t12.ruleType = #{ruleType}
+            AND t1.rule_type = #{ruleType}
         </if>
+        ) t12
         ORDER BY
         t12.conceptId,
         t12.ruleType,