Преглед изворни кода

Merge branch 'wrdp' into 'develop'

Wrdp

See merge request o2oa/o2oa!1992
o2null пре 5 година
родитељ
комит
64de99f716

+ 13 - 0
o2server/x_query_core_express/src/main/java/com/x/query/core/express/plan/Comparison.java

@@ -12,6 +12,7 @@ public abstract class Comparison {
 	private static String[] like = new String[] { "like" };
 	private static String[] notLike = new String[] { "notLike", "not like" };
 	private static String[] between = new String[] { "range", "between" };
+	private static String[] isMember = new String[] { "isMember", "in" };
 
 	public static boolean isEquals(String comparison) throws Exception {
 		for (String str : equals) {
@@ -94,6 +95,15 @@ public abstract class Comparison {
 		return false;
 	}
 
+	public static boolean isIsMember(String comparison) throws Exception {
+		for (String str : isMember) {
+			if (StringUtils.equalsIgnoreCase(str, StringUtils.trim(comparison))) {
+				return true;
+			}
+		}
+		return false;
+	}
+
 	public static String getMatchCom(String comparison) throws Exception {
 		if(isNotEquals(comparison)){
 			return notEquals[notEquals.length-1];
@@ -116,6 +126,9 @@ public abstract class Comparison {
 		}else if(isNotLike(comparison)){
 			return notLike[notLike.length-1];
 
+		}else if(isIsMember(comparison)){
+			return isMember[isMember.length-1];
+
 		}else{
 			return equals[equals.length-1];
 		}

+ 13 - 2
o2server/x_query_core_express/src/main/java/com/x/query/core/express/plan/FilterEntry.java

@@ -1,7 +1,6 @@
 package com.x.query.core.express.plan;
 
-import java.util.Date;
-import java.util.Objects;
+import java.util.*;
 
 import javax.persistence.criteria.CriteriaBuilder;
 import javax.persistence.criteria.Predicate;
@@ -559,6 +558,12 @@ public class FilterEntry extends GsonPropertyObject {
 					p = cb.and(p, cb.notLike(root.get(Item_.stringShortValue), "%" + compareValue + "%"));
 				} else if (Comparison.isBetween(this.comparison)) {
 					p = cb.and(p, cb.between(root.get(Item_.stringShortValue), compareValue, compareOtherValue));
+				} else if (Comparison.isIsMember(this.comparison)) {
+					if(compareValue.indexOf(",") > -1){
+						p = cb.and(p,  root.get(Item_.stringShortValue).in(Arrays.asList(compareValue.split(","))));
+					}else{
+						p = cb.and(p, cb.equal(root.get(Item_.stringShortValue), compareValue));
+					}
 				} else {
 					p = cb.and(p, cb.equal(root.get(Item_.stringShortValue), compareValue));
 				}
@@ -974,6 +979,12 @@ public class FilterEntry extends GsonPropertyObject {
 					p = cb.and(p, cb.notLike(root.get(paramName), "%" + compareValue + "%"));
 				} else if (Comparison.isBetween(this.comparison)) {
 					p = cb.and(p, cb.between(root.get(paramName), compareValue, compareOtherValue));
+				} else if (Comparison.isIsMember(this.comparison)) {
+					if(compareValue.indexOf(",") > -1){
+						p = cb.and(p,  root.get(paramName).in(Arrays.asList(compareValue.split(","))));
+					}else{
+						p = cb.and(p, cb.equal(root.get(paramName), compareValue));
+					}
 				} else {
 					p = cb.and(p, cb.equal(root.get(paramName), compareValue));
 				}