This commit is contained in:
@@ -153,8 +153,6 @@ final class FilterBeanNode extends FilterNode {
|
|||||||
|
|
||||||
private boolean number;
|
private boolean number;
|
||||||
|
|
||||||
private boolean likefit;
|
|
||||||
|
|
||||||
private boolean ignoreCase;
|
private boolean ignoreCase;
|
||||||
|
|
||||||
private long least;
|
private long least;
|
||||||
@@ -204,7 +202,6 @@ final class FilterBeanNode extends FilterNode {
|
|||||||
newnode.collection = this.collection;
|
newnode.collection = this.collection;
|
||||||
newnode.ignoreCase = this.ignoreCase;
|
newnode.ignoreCase = this.ignoreCase;
|
||||||
newnode.least = this.least;
|
newnode.least = this.least;
|
||||||
newnode.likefit = this.likefit;
|
|
||||||
newnode.number = this.number;
|
newnode.number = this.number;
|
||||||
newnode.string = this.string;
|
newnode.string = this.string;
|
||||||
this.nodes = new FilterNode[]{newnode};
|
this.nodes = new FilterNode[]{newnode};
|
||||||
@@ -222,7 +219,6 @@ final class FilterBeanNode extends FilterNode {
|
|||||||
this.collection = beanNode.collection;
|
this.collection = beanNode.collection;
|
||||||
this.ignoreCase = beanNode.ignoreCase;
|
this.ignoreCase = beanNode.ignoreCase;
|
||||||
this.least = beanNode.least;
|
this.least = beanNode.least;
|
||||||
this.likefit = beanNode.likefit;
|
|
||||||
this.number = beanNode.number;
|
this.number = beanNode.number;
|
||||||
this.string = beanNode.string;
|
this.string = beanNode.string;
|
||||||
}
|
}
|
||||||
@@ -258,7 +254,7 @@ final class FilterBeanNode extends FilterNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(foreign.isEmpty()) return result;
|
if (foreign.isEmpty()) return result;
|
||||||
final Attribute foreignAttr = this.foreignAttribute;
|
final Attribute foreignAttr = this.foreignAttribute;
|
||||||
for (Map.Entry<EntityInfo, Predicate> en : foreign.entrySet()) {
|
for (Map.Entry<EntityInfo, Predicate> en : foreign.entrySet()) {
|
||||||
Attribute<T, Serializable> mainIdAttr = info.getPrimary();
|
Attribute<T, Serializable> mainIdAttr = info.getPrimary();
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ public class FilterNode {
|
|||||||
|
|
||||||
protected FilterExpress express;
|
protected FilterExpress express;
|
||||||
|
|
||||||
|
protected boolean likefit = true;
|
||||||
|
|
||||||
protected FilterNode[] nodes;
|
protected FilterNode[] nodes;
|
||||||
|
|
||||||
private Serializable value;
|
private Serializable value;
|
||||||
@@ -101,6 +103,7 @@ public class FilterNode {
|
|||||||
this.tabalis = node.tabalis;
|
this.tabalis = node.tabalis;
|
||||||
this.column = node.column;
|
this.column = node.column;
|
||||||
this.express = node.express;
|
this.express = node.express;
|
||||||
|
this.likefit = node.likefit;
|
||||||
this.signand = sign;
|
this.signand = sign;
|
||||||
this.value = node.value;
|
this.value = node.value;
|
||||||
}
|
}
|
||||||
@@ -329,19 +332,19 @@ public class FilterNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected StringBuilder formatValue(Object value) {
|
protected StringBuilder formatValue(Object value) {
|
||||||
return formatValue(express, value);
|
return formatValue(likefit, express, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static String formatToString(Object value) {
|
protected static String formatToString(Object value) {
|
||||||
StringBuilder sb = formatValue(null, value);
|
StringBuilder sb = formatValue(true, null, value);
|
||||||
return sb == null ? null : sb.toString();
|
return sb == null ? null : sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static StringBuilder formatValue(FilterExpress express, Object value) {
|
private static StringBuilder formatValue(boolean likefit, FilterExpress express, Object value) {
|
||||||
if (value == null) return null;
|
if (value == null) return null;
|
||||||
if (value instanceof Number) return new StringBuilder().append(value);
|
if (value instanceof Number) return new StringBuilder().append(value);
|
||||||
if (value instanceof CharSequence) {
|
if (value instanceof CharSequence) {
|
||||||
if (express == LIKE || express == NOTLIKE) value = "%" + value + '%';
|
if (likefit && (express == LIKE || express == NOTLIKE)) value = "%" + value + '%';
|
||||||
return new StringBuilder().append('\'').append(value.toString().replace("'", "\\'")).append('\'');
|
return new StringBuilder().append('\'').append(value.toString().replace("'", "\\'")).append('\'');
|
||||||
} else if (value instanceof Range) {
|
} else if (value instanceof Range) {
|
||||||
Range range = (Range) value;
|
Range range = (Range) value;
|
||||||
@@ -364,7 +367,7 @@ public class FilterNode {
|
|||||||
if (len == 0) return null;
|
if (len == 0) return null;
|
||||||
if (len == 1) {
|
if (len == 1) {
|
||||||
Object firstval = Array.get(value, 0);
|
Object firstval = Array.get(value, 0);
|
||||||
if (firstval != null && firstval.getClass().isArray()) return formatValue(express, firstval);
|
if (firstval != null && firstval.getClass().isArray()) return formatValue(likefit, express, firstval);
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append('(');
|
sb.append('(');
|
||||||
|
|||||||
Reference in New Issue
Block a user