Quellcode durchsuchen

根据adm前端请求参数,调整查询条件匹配字符,增加无空格的情况

lvxianyun vor 3 Jahren
Ursprung
Commit
ca6563a02e

+ 4 - 2
src/main/java/com/persagy/proxy/adm/utils/AdmQueryCriteriaHelper.java

@@ -26,6 +26,8 @@ public class AdmQueryCriteriaHelper {
 
     /** 条件匹配字符串 */
     private static final String[] COND_STR = {" = "," != "," > "," >= "," < "," <= "," in "," isnull "," contain "," startwith "," endwith "};
+    /** 条件匹配字符串 根据ADM实际调用查看,去掉空格*/
+    private static final String[] COND_STR_TRIM = {"=","!=",">",">=","<","<=","in","isnull","contain","startwith","endwith"};
     /** 需要替换的字段对照 Map<AdmQueryCriteria.name, Map<AdmFieldName, DmpFieldName> */
     private static Map<String, Map<String, String>> RENAME_MAP = new HashMap<>(16);
     /** 与数据中台的操作参数对照 */
@@ -186,7 +188,7 @@ public class AdmQueryCriteriaHelper {
      * @param express
      */
     private static void ensureAndExpress(String name, ObjectNode criteria, String express) {
-        String cond = StrUtil.getContainsStr(express, COND_STR);
+        String cond = StrUtil.isBlank(StrUtil.getContainsStr(express, COND_STR)) ? StrUtil.getContainsStr(express, COND_STR_TRIM) : StrUtil.getContainsStr(express, COND_STR);
         if(StrUtil.isBlank(cond)) {
             return;
         }
@@ -227,7 +229,7 @@ public class AdmQueryCriteriaHelper {
             ObjectNode node = criteria.putObject(column);
             node.set(OPERATOR_MAP.get(operator), getJsonNode(node, value));
         }
-    }
+     }
 
     /**
      * 取Json值对象