改版EntityXInfo
This commit is contained in:
@@ -82,7 +82,9 @@ public abstract class FilterNode {
|
|||||||
|
|
||||||
protected final <T> Predicate<T> createFilterPredicate(final EntityInfo<T> info, Object bean) {
|
protected final <T> Predicate<T> createFilterPredicate(final EntityInfo<T> info, Object bean) {
|
||||||
if (info == null) return null;
|
if (info == null) return null;
|
||||||
Predicate<T> filter = createFilterPredicate(info.getAttribute(column), getValue(bean));
|
final Serializable val = getValue(bean);
|
||||||
|
if (val == null && express != ISNULL && express != ISNOTNULL) return null;
|
||||||
|
Predicate<T> filter = createFilterPredicate(info.getAttribute(column), val);
|
||||||
if (nodes == null) return filter;
|
if (nodes == null) return filter;
|
||||||
for (FilterNode node : this.nodes) {
|
for (FilterNode node : this.nodes) {
|
||||||
Predicate<T> f = node.createFilterPredicate(info, bean);
|
Predicate<T> f = node.createFilterPredicate(info, bean);
|
||||||
@@ -92,9 +94,8 @@ public abstract class FilterNode {
|
|||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final <T> Predicate<T> createFilterPredicate(final Attribute<T, ?> attr, final Serializable val) {
|
private <T> Predicate<T> createFilterPredicate(final Attribute<T, ?> attr, final Serializable val) {
|
||||||
if (attr == null) return null;
|
if (attr == null) return null;
|
||||||
if (val == null && express != ISNULL && express != ISNOTNULL) return null;
|
|
||||||
switch (express) {
|
switch (express) {
|
||||||
case EQUAL: return (T t) -> val.equals(attr.get(t));
|
case EQUAL: return (T t) -> val.equals(attr.get(t));
|
||||||
case NOTEQUAL: return (T t) -> !val.equals(attr.get(t));
|
case NOTEQUAL: return (T t) -> !val.equals(attr.get(t));
|
||||||
|
|||||||
Reference in New Issue
Block a user