|
@@ -30,7 +30,7 @@ public class ConditionNode extends Node {
|
|
|
// 包含
|
|
|
operatorMap.put("in", "var:containsAny(%s, %s)");
|
|
|
// 不包含
|
|
|
- operatorMap.put("ni", "var:notContainsAny(%s, %s)");
|
|
|
+ operatorMap.put("ni", "!var:containsAny(%s, %s)");
|
|
|
// 为空
|
|
|
operatorMap.put("ul", "var:isNull(%s)");
|
|
|
// 不为空
|
|
@@ -49,6 +49,10 @@ public class ConditionNode extends Node {
|
|
|
operatorMap.put("ge", "var:gte(%s, %s)");
|
|
|
// 介于
|
|
|
operatorMap.put("bt", "var > %s && var < %s");
|
|
|
+ // 包含全部
|
|
|
+ operatorMap.put("ia", "var:containsAll(%s, %s)");
|
|
|
+ // 不包含全部
|
|
|
+ operatorMap.put("na", "!var:containsAll(%s, %s)");
|
|
|
}
|
|
|
|
|
|
protected static String stringVal(Object val) {
|
|
@@ -69,15 +73,25 @@ public class ConditionNode extends Node {
|
|
|
value = ((Collection<?>) value).stream()
|
|
|
.map(ConditionNode::stringVal)
|
|
|
.collect(Collectors.joining(","));
|
|
|
+ if ("in".equals(operator)) {
|
|
|
+ operator = "ia";
|
|
|
+ } else if ("ni".equals(operator)) {
|
|
|
+ operator = "na";
|
|
|
+ }
|
|
|
} else if (value instanceof Object[]) {
|
|
|
value = Arrays.stream((Object[]) value)
|
|
|
.map(ConditionNode::stringVal)
|
|
|
.collect(Collectors.joining(","));
|
|
|
+ if ("in".equals(operator)) {
|
|
|
+ operator = "ia";
|
|
|
+ } else if ("ni".equals(operator)) {
|
|
|
+ operator = "na";
|
|
|
+ }
|
|
|
} else {
|
|
|
value = stringVal(value);
|
|
|
}
|
|
|
String field = condition.getField();
|
|
|
- return String.format(operatorMap.get(condition.getOperator()), field, value);
|
|
|
+ return String.format(operatorMap.get(operator), field, value);
|
|
|
}
|
|
|
return "";
|
|
|
}).collect(Collectors.joining("and".equals(filterGroup.getOperator()) ? " && " : " ||"));
|