FilterNode优化
This commit is contained in:
@@ -218,21 +218,19 @@ public class ObjectDecoder<R extends Reader, T> implements Decodeable<R, T> {
|
||||
}
|
||||
if (cps != null) { //可能存在某些构造函数中的字段名不存在setter方法
|
||||
for (final String constructorField : cps) {
|
||||
boolean flag = false;
|
||||
for (DeMember m : list) {
|
||||
if (m.attribute.field().equals(constructorField)) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
if (Utility.contains(list, m -> m.attribute.field().equals(constructorField))) {
|
||||
continue;
|
||||
}
|
||||
//不存在setter方法
|
||||
try {
|
||||
Field f = clazz.getDeclaredField(constructorField);
|
||||
ConvertColumnEntry ref2 = factory.findRef(clazz, f);
|
||||
Type t = TypeToken.createClassType(f.getGenericType(), this.type);
|
||||
list.add(new DeMember(ObjectEncoder.createAttribute(factory, type, clazz, f, null, null), factory.loadDecoder(t), f, null));
|
||||
DeMember member = new DeMember(ObjectEncoder.createAttribute(factory, type, clazz, f, null, null), factory.loadDecoder(t), f, null);
|
||||
if (ref2 != null) {
|
||||
member.index = ref2.getIndex();
|
||||
}
|
||||
list.add(member);
|
||||
} catch (NoSuchFieldException nsfe) { //不存在field, 可能存在getter方法
|
||||
char[] fs = constructorField.toCharArray();
|
||||
fs[0] = Character.toUpperCase(fs[0]);
|
||||
@@ -243,8 +241,13 @@ public class ObjectDecoder<R extends Reader, T> implements Decodeable<R, T> {
|
||||
} catch (NoSuchMethodException ex) {
|
||||
getter = clazz.getMethod("is" + mn);
|
||||
}
|
||||
ConvertColumnEntry ref2 = factory.findRef(clazz, getter);
|
||||
Type t = TypeToken.createClassType(TypeToken.getGenericType(getter.getGenericParameterTypes()[0], this.type), this.type);
|
||||
list.add(new DeMember(ObjectEncoder.createAttribute(factory, type, clazz, null, getter, null), factory.loadDecoder(t), ConvertFactory.readGetSetField(getter), getter));
|
||||
DeMember member = new DeMember(ObjectEncoder.createAttribute(factory, type, clazz, null, getter, null), factory.loadDecoder(t), ConvertFactory.readGetSetField(getter), getter);
|
||||
if (ref2 != null) {
|
||||
member.index = ref2.getIndex();
|
||||
}
|
||||
list.add(member);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,8 +139,8 @@ public class ObjectEncoder<W extends Writer, T> implements Encodeable<W, T> {
|
||||
if (factory.isConvertDisabled(method)) {
|
||||
continue;
|
||||
}
|
||||
String convertname = ConvertFactory.readGetSetFieldName(method);
|
||||
if (reversible && (cps == null || !contains(cps, convertname))) {
|
||||
String convertName = ConvertFactory.readGetSetFieldName(method);
|
||||
if (reversible && (cps == null || !contains(cps, convertName))) {
|
||||
boolean is = method.getName().startsWith("is");
|
||||
try {
|
||||
clazz.getMethod(method.getName().replaceFirst(is ? "is" : "get", "set"), method.getReturnType());
|
||||
@@ -155,7 +155,7 @@ public class ObjectEncoder<W extends Writer, T> implements Encodeable<W, T> {
|
||||
ConvertSmallString small = method.getAnnotation(ConvertSmallString.class);
|
||||
if (small == null) {
|
||||
try {
|
||||
Field f = clazz.getDeclaredField(convertname);
|
||||
Field f = clazz.getDeclaredField(convertName);
|
||||
if (f != null) {
|
||||
small = f.getAnnotation(ConvertSmallString.class);
|
||||
}
|
||||
@@ -179,31 +179,33 @@ public class ObjectEncoder<W extends Writer, T> implements Encodeable<W, T> {
|
||||
fieldCoder = colFactory.loadEncoder(t);
|
||||
}
|
||||
EnMember member = new EnMember(createAttribute(colFactory, type, clazz, null, method, null), fieldCoder, maybeField, method);
|
||||
if (Utility.contains(list, m -> m.attribute.field().equals(member.attribute.field()))) {
|
||||
continue;
|
||||
}
|
||||
if (ref != null) {
|
||||
member.index = ref.getIndex();
|
||||
}
|
||||
list.add(member);
|
||||
}
|
||||
|
||||
List<EnMember> sorts = new ArrayList<>(list);
|
||||
if (cps != null) {
|
||||
Set<EnMember> dissorts = new LinkedHashSet<>(list);
|
||||
for (final String constructorField : cps) { //reversible模式下需要确保DeMember与EnMember的个数和顺序保持一致,不然postition会不一致导致反序列化对应的字段顺序不同
|
||||
boolean flag = false;
|
||||
for (EnMember m : dissorts) {
|
||||
if (m.attribute.field().equals(constructorField)) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
if (Utility.contains(dissorts, m -> m.attribute.field().equals(constructorField))) {
|
||||
continue;
|
||||
}
|
||||
//不存在setter方法
|
||||
try {
|
||||
Field f = clazz.getDeclaredField(constructorField);
|
||||
Type t = TypeToken.createClassType(f.getGenericType(), this.type);
|
||||
ConvertColumnEntry ref2 = factory.findRef(clazz, f);
|
||||
//Type t = TypeToken.createClassType(f.getGenericType(), this.type);
|
||||
try {
|
||||
dissorts.add(new EnMember(createAttribute(factory, type, clazz, f, null, null), null, f, null)); //虚构
|
||||
EnMember member = new EnMember(createAttribute(factory, type, clazz, f, null, null), null, f, null);
|
||||
if (ref2 != null) {
|
||||
member.index = ref2.getIndex();
|
||||
}
|
||||
dissorts.add(member); //虚构
|
||||
} catch (RuntimeException e) {
|
||||
//do nothing
|
||||
}
|
||||
@@ -217,9 +219,14 @@ public class ObjectEncoder<W extends Writer, T> implements Encodeable<W, T> {
|
||||
} catch (NoSuchMethodException ex) {
|
||||
getter = clazz.getMethod("is" + mn);
|
||||
}
|
||||
Type t = TypeToken.createClassType(TypeToken.getGenericType(getter.getGenericParameterTypes()[0], this.type), this.type);
|
||||
ConvertColumnEntry ref2 = factory.findRef(clazz, getter);
|
||||
//Type t = TypeToken.createClassType(TypeToken.getGenericType(getter.getGenericParameterTypes()[0], this.type), this.type);
|
||||
try {
|
||||
dissorts.add(new EnMember(createAttribute(factory, type, clazz, null, getter, null), null, null, null)); //虚构
|
||||
EnMember member = new EnMember(createAttribute(factory, type, clazz, null, getter, null), null, null, null);
|
||||
if (ref2 != null) {
|
||||
member.index = ref2.getIndex();
|
||||
}
|
||||
dissorts.add(member); //虚构
|
||||
} catch (RuntimeException e) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@@ -698,12 +698,12 @@ public abstract class AbstractDataSource extends AbstractService implements Data
|
||||
|
||||
@Override
|
||||
public <T> T find(final Class<T> clazz, final String column, final Serializable colval) {
|
||||
return find(clazz, null, FilterNode.create(column, colval));
|
||||
return find(clazz, null, FilterNodes.create(column, colval));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> CompletableFuture<T> findAsync(final Class<T> clazz, final String column, final Serializable colval) {
|
||||
return findAsync(clazz, null, FilterNode.create(column, colval));
|
||||
return findAsync(clazz, null, FilterNodes.create(column, colval));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -789,12 +789,12 @@ public abstract class AbstractDataSource extends AbstractService implements Data
|
||||
//-----------------------list set----------------------------
|
||||
@Override
|
||||
public <T, V extends Serializable> Set<V> queryColumnSet(final String selectedColumn, final Class<T> clazz, final String column, final Serializable colval) {
|
||||
return queryColumnSet(selectedColumn, clazz, null, FilterNode.create(column, colval));
|
||||
return queryColumnSet(selectedColumn, clazz, null, FilterNodes.create(column, colval));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T, V extends Serializable> CompletableFuture<Set<V>> queryColumnSetAsync(final String selectedColumn, final Class<T> clazz, final String column, final Serializable colval) {
|
||||
return queryColumnSetAsync(selectedColumn, clazz, null, FilterNode.create(column, colval));
|
||||
return queryColumnSetAsync(selectedColumn, clazz, null, FilterNodes.create(column, colval));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -829,12 +829,12 @@ public abstract class AbstractDataSource extends AbstractService implements Data
|
||||
|
||||
@Override
|
||||
public <T, V extends Serializable> List<V> queryColumnList(final String selectedColumn, final Class<T> clazz, final String column, final Serializable colval) {
|
||||
return queryColumnList(selectedColumn, clazz, null, FilterNode.create(column, colval));
|
||||
return queryColumnList(selectedColumn, clazz, null, FilterNodes.create(column, colval));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T, V extends Serializable> CompletableFuture<List<V>> queryColumnListAsync(final String selectedColumn, final Class<T> clazz, final String column, final Serializable colval) {
|
||||
return queryColumnListAsync(selectedColumn, clazz, null, FilterNode.create(column, colval));
|
||||
return queryColumnListAsync(selectedColumn, clazz, null, FilterNodes.create(column, colval));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -986,12 +986,12 @@ public abstract class AbstractDataSource extends AbstractService implements Data
|
||||
*/
|
||||
@Override
|
||||
public <T> Set<T> querySet(final Class<T> clazz, final String column, final Serializable colval) {
|
||||
return querySet(clazz, (SelectColumn) null, null, FilterNode.create(column, colval));
|
||||
return querySet(clazz, (SelectColumn) null, null, FilterNodes.create(column, colval));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> CompletableFuture<Set<T>> querySetAsync(final Class<T> clazz, final String column, final Serializable colval) {
|
||||
return querySetAsync(clazz, (SelectColumn) null, null, FilterNode.create(column, colval));
|
||||
return querySetAsync(clazz, (SelectColumn) null, null, FilterNodes.create(column, colval));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1065,12 +1065,12 @@ public abstract class AbstractDataSource extends AbstractService implements Data
|
||||
|
||||
@Override
|
||||
public <T> Set<T> querySet(final Class<T> clazz, final Flipper flipper, final String column, final Serializable colval) {
|
||||
return querySet(clazz, null, flipper, FilterNode.create(column, colval));
|
||||
return querySet(clazz, null, flipper, FilterNodes.create(column, colval));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> CompletableFuture<Set<T>> querySetAsync(final Class<T> clazz, final Flipper flipper, final String column, final Serializable colval) {
|
||||
return querySetAsync(clazz, null, flipper, FilterNode.create(column, colval));
|
||||
return querySetAsync(clazz, null, flipper, FilterNodes.create(column, colval));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1115,12 +1115,12 @@ public abstract class AbstractDataSource extends AbstractService implements Data
|
||||
*/
|
||||
@Override
|
||||
public <T> List<T> queryList(final Class<T> clazz, final String column, final Serializable colval) {
|
||||
return queryList(clazz, (SelectColumn) null, null, FilterNode.create(column, colval));
|
||||
return queryList(clazz, (SelectColumn) null, null, FilterNodes.create(column, colval));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> CompletableFuture<List<T>> queryListAsync(final Class<T> clazz, final String column, final Serializable colval) {
|
||||
return queryListAsync(clazz, (SelectColumn) null, null, FilterNode.create(column, colval));
|
||||
return queryListAsync(clazz, (SelectColumn) null, null, FilterNodes.create(column, colval));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1194,12 +1194,12 @@ public abstract class AbstractDataSource extends AbstractService implements Data
|
||||
|
||||
@Override
|
||||
public <T> List<T> queryList(final Class<T> clazz, final Flipper flipper, final String column, final Serializable colval) {
|
||||
return queryList(clazz, null, flipper, FilterNode.create(column, colval));
|
||||
return queryList(clazz, null, flipper, FilterNodes.create(column, colval));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> CompletableFuture<List<T>> queryListAsync(final Class<T> clazz, final Flipper flipper, final String column, final Serializable colval) {
|
||||
return queryListAsync(clazz, null, flipper, FilterNode.create(column, colval));
|
||||
return queryListAsync(clazz, null, flipper, FilterNodes.create(column, colval));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2126,7 +2126,7 @@ public abstract class AbstractDataSqlSource extends AbstractDataSource implement
|
||||
String column = info.getPrimary().field();
|
||||
int c = 0;
|
||||
for (Serializable id : pks) {
|
||||
Sheet<T> sheet = querySheet(false, true, false, clazz, null, FLIPPER_ONE, FilterNode.create(column, id));
|
||||
Sheet<T> sheet = querySheet(false, true, false, clazz, null, FLIPPER_ONE, FilterNodes.create(column, id));
|
||||
T value = sheet.isEmpty() ? null : sheet.list().get(0);
|
||||
if (value != null) {
|
||||
c += cache.update(value);
|
||||
@@ -2554,7 +2554,7 @@ public abstract class AbstractDataSqlSource extends AbstractDataSource implement
|
||||
|
||||
protected <T> CompletableFuture<T[]> findsDBAsync(final EntityInfo<T> info, final SelectColumn selects, Serializable... pks) {
|
||||
final Attribute<T, Serializable> primary = info.getPrimary();
|
||||
return queryListAsync(info.getType(), selects, null, FilterNode.create(info.getPrimarySQLColumn(), FilterExpress.IN, pks)).thenApply(list -> {
|
||||
return queryListAsync(info.getType(), selects, null, FilterNodes.in(info.getPrimarySQLColumn(), pks)).thenApply(list -> {
|
||||
T[] rs = info.getArrayer().apply(pks.length);
|
||||
for (int i = 0; i < rs.length; i++) {
|
||||
T t = null;
|
||||
@@ -2580,7 +2580,7 @@ public abstract class AbstractDataSqlSource extends AbstractDataSource implement
|
||||
public <D extends Serializable, T> CompletableFuture<List<T>> findsListAsync(final Class<T> clazz, final Stream<D> pks) {
|
||||
final EntityInfo<T> info = loadEntityInfo(clazz);
|
||||
Serializable[] ids = pks.toArray(serialArrayFunc);
|
||||
return queryListAsync(info.getType(), null, null, FilterNode.create(info.getPrimarySQLColumn(), FilterExpress.IN, ids));
|
||||
return queryListAsync(info.getType(), null, null, FilterNodes.in(info.getPrimarySQLColumn(), ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -3077,7 +3077,7 @@ public abstract class AbstractDataSqlSource extends AbstractDataSource implement
|
||||
final ArrayList<K> ids = new ArrayList<>();
|
||||
keyStream.forEach(k -> ids.add(k));
|
||||
final Attribute<T, Serializable> primary = info.getPrimary();
|
||||
List<T> rs = queryList(clazz, FilterNode.create(primary.field(), ids));
|
||||
List<T> rs = queryList(clazz, FilterNodes.in(primary.field(), ids));
|
||||
Map<K, T> map = new LinkedHashMap<>();
|
||||
if (rs.isEmpty()) {
|
||||
return new LinkedHashMap<>();
|
||||
@@ -3097,7 +3097,7 @@ public abstract class AbstractDataSqlSource extends AbstractDataSource implement
|
||||
final ArrayList<K> pks = new ArrayList<>();
|
||||
keyStream.forEach(k -> pks.add(k));
|
||||
final Attribute<T, Serializable> primary = info.getPrimary();
|
||||
return queryListAsync(clazz, FilterNode.create(primary.field(), pks)).thenApply((List<T> rs) -> {
|
||||
return queryListAsync(clazz, FilterNodes.in(primary.field(), pks)).thenApply((List<T> rs) -> {
|
||||
Map<K, T> map = new LinkedHashMap<>();
|
||||
if (rs.isEmpty()) {
|
||||
return new LinkedHashMap<>();
|
||||
|
||||
@@ -2192,7 +2192,7 @@ public class DataJdbcSource extends AbstractDataSqlSource {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return queryList(info.getType(), null, null, FilterNode.create(info.getPrimarySQLColumn(), FilterExpress.IN, ids));
|
||||
return queryList(info.getType(), null, null, FilterNodes.in(info.getPrimarySQLColumn(), ids));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public @interface FilterColumn {
|
||||
*
|
||||
* @return 字段表达式
|
||||
*/
|
||||
FilterExpress express() default FilterExpress.EQUAL;
|
||||
FilterExpress express() default FilterExpress.EQ;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,48 +15,108 @@ package org.redkale.source;
|
||||
*/
|
||||
public enum FilterExpress {
|
||||
|
||||
EQUAL("="),
|
||||
IGNORECASEEQUAL("="),//不区分大小写的 =
|
||||
NOTEQUAL("<>"),
|
||||
IGNORECASENOTEQUAL("="),//不区分大小写的 <>
|
||||
GREATERTHAN(">"),
|
||||
LESSTHAN("<"),
|
||||
GREATERTHANOREQUALTO(">="),
|
||||
LESSTHANOREQUALTO("<="),
|
||||
STARTSWITH("LIKE"),
|
||||
NOTSTARTSWITH("NOT LIKE"),
|
||||
ENDSWITH("LIKE"),
|
||||
NOTENDSWITH("NOT LIKE"),
|
||||
EQ("="),
|
||||
IG_EQ("="),//不区分大小写的 =
|
||||
NOT_EQ("<>"), //
|
||||
IG_NOT_EQ("="),//不区分大小写的 <>
|
||||
GT(">"),
|
||||
LT("<"),
|
||||
GE(">="),
|
||||
LE("<="),
|
||||
LIKE("LIKE"),
|
||||
NOTLIKE("NOT LIKE"),
|
||||
IGNORECASELIKE("LIKE"), //不区分大小写的 LIKE
|
||||
IGNORECASENOTLIKE("NOT LIKE"), //不区分大小写的 NOT LIKE
|
||||
LENGTH_EQUAL("="), //字符串值的长度
|
||||
LENGTH_LESSTHAN("<"), //字符串值的长度 <
|
||||
LENGTH_LESSTHANOREQUALTO("<="), //字符串值的长度 <=
|
||||
LENGTH_GREATERTHAN(">"), //字符串值的长度 >
|
||||
LENGTH_GREATERTHANOREQUALTO(">="), //字符串值的长度 >=
|
||||
NOT_LIKE("NOT LIKE"),
|
||||
IG_LIKE("LIKE"), //不区分大小写的 LIKE
|
||||
IG_NOT_LIKE("NOT LIKE"), //不区分大小写的 NOT LIKE
|
||||
STARTS("LIKE"),
|
||||
ENDS("LIKE"),
|
||||
NOT_STARTS("NOT LIKE"),
|
||||
NOT_ENDS("NOT LIKE"),
|
||||
LEN_EQ("="), //字符串值的长度
|
||||
LEN_GT(">"), //字符串值的长度 >
|
||||
LEN_LT("<"), //字符串值的长度 <
|
||||
LEN_GE(">="), //字符串值的长度 >=
|
||||
LEN_LE("<="), //字符串值的长度 <=
|
||||
|
||||
CONTAIN("CONTAIN"), //包含, 相当于反向LIKE
|
||||
NOTCONTAIN("NOT CONTAIN"), //不包含, 相当于反向LIKE
|
||||
IGNORECASECONTAIN("CONTAIN"), //不区分大小写的 CONTAIN
|
||||
IGNORECASENOTCONTAIN("NOT CONTAIN"), //不区分大小写的 NOT CONTAIN
|
||||
NOT_CONTAIN("NOT CONTAIN"), //不包含, 相当于反向LIKE
|
||||
IG_CONTAIN("CONTAIN"), //不区分大小写的 CONTAIN
|
||||
IG_NOT_CONTAIN("NOT CONTAIN"), //不区分大小写的 NOT CONTAIN
|
||||
|
||||
BETWEEN("BETWEEN"),
|
||||
NOTBETWEEN("NOT BETWEEN"),
|
||||
NOT_BETWEEN("NOT BETWEEN"),
|
||||
IN("IN"),
|
||||
NOTIN("NOT IN"),
|
||||
ISNULL("IS NULL"),
|
||||
ISNOTNULL("IS NOT NULL"),
|
||||
ISEMPTY("="),//值为空
|
||||
ISNOTEMPTY("<>"), //值不为空
|
||||
NOT_IN("NOT IN"),
|
||||
IS_NULL("IS NULL"),
|
||||
NOT_NULL("IS NOT NULL"),
|
||||
IS_EMPTY("="),//值为空
|
||||
NOT_EMPTY("<>"), //值不为空
|
||||
OPAND("&"), //与运算 > 0
|
||||
OPOR("|"), //或运算 > 0
|
||||
OPANDNO("&"), //与运算 == 0
|
||||
NOT_OPAND("&"), //与运算 == 0
|
||||
FV_MOD("%"), //取模运算,需要与FilterValue配合使用
|
||||
FV_DIV("DIV"), //整除运算,需要与FilterValue配合使用
|
||||
|
||||
AND("AND"),
|
||||
OR("OR");
|
||||
OR("OR"),
|
||||
//------------------------ 过期 ------------------------
|
||||
@Deprecated(since = "2.8.0")
|
||||
EQUAL("="),
|
||||
@Deprecated(since = "2.8.0")
|
||||
IGNORECASELIKE("LIKE"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
IGNORECASENOTLIKE("NOT LIKE"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
ENDSWITH("LIKE"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
STARTSWITH("LIKE"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
IGNORECASEEQUAL("="),
|
||||
@Deprecated(since = "2.8.0")
|
||||
NOTEQUAL("<>"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
GREATERTHAN(">"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
LESSTHAN("<"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
GREATERTHANOREQUALTO(">="),
|
||||
@Deprecated(since = "2.8.0")
|
||||
LESSTHANOREQUALTO("<="),
|
||||
@Deprecated(since = "2.8.0")
|
||||
NOTLIKE("NOT LIKE"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
IGNORECASENOTEQUAL("="),
|
||||
@Deprecated(since = "2.8.0")
|
||||
NOTENDSWITH("NOT LIKE"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
NOTSTARTSWITH("NOT LIKE"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
LENGTH_EQUAL("="),
|
||||
@Deprecated(since = "2.8.0")
|
||||
LENGTH_GREATERTHAN(">"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
LENGTH_LESSTHAN("<"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
LENGTH_GREATERTHANOREQUALTO(">="),
|
||||
@Deprecated(since = "2.8.0")
|
||||
IGNORECASENOTCONTAIN("NOT CONTAIN"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
IGNORECASECONTAIN("CONTAIN"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
LENGTH_LESSTHANOREQUALTO("<="),
|
||||
@Deprecated(since = "2.8.0")
|
||||
NOTCONTAIN("NOT CONTAIN"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
ISEMPTY("="),
|
||||
@Deprecated(since = "2.8.0")
|
||||
ISNOTNULL("IS NOT NULL"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
NOTBETWEEN("NOT BETWEEN"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
NOTIN("NOT IN"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
ISNULL("IS NULL"),
|
||||
@Deprecated(since = "2.8.0")
|
||||
ISNOTEMPTY("<>");
|
||||
|
||||
private final String value;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.*;
|
||||
import static org.redkale.source.FilterExpress.EQUAL;
|
||||
import static org.redkale.source.FilterExpress.EQ;
|
||||
import org.redkale.util.*;
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ public class FilterJoinNode extends FilterNode {
|
||||
this.joinClass = joinClass;
|
||||
this.joinColumns = joinColumns;
|
||||
this.column = column;
|
||||
this.express = express == null ? EQUAL : express;
|
||||
this.express = express == null ? EQ : express;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -79,21 +79,21 @@ public final class FilterNodeBean<T extends FilterBean> implements Comparable<Fi
|
||||
compType = (Class) pt;
|
||||
}
|
||||
}
|
||||
if ((exp == null || exp == EQUAL) && (type.isArray() || Collection.class.isAssignableFrom(type))) {
|
||||
if ((exp == null || exp == EQ) && (type.isArray() || Collection.class.isAssignableFrom(type))) {
|
||||
if (compType != null && Range.class.isAssignableFrom(compType)) {
|
||||
if (AND != exp) {
|
||||
exp = OR;
|
||||
}
|
||||
} else if (NOTIN != exp) {
|
||||
} else if (NOT_IN != exp) {
|
||||
exp = IN;
|
||||
}
|
||||
} else if (Range.class.isAssignableFrom(type)) {
|
||||
if (NOTBETWEEN != exp) {
|
||||
if (NOT_BETWEEN != exp) {
|
||||
exp = BETWEEN;
|
||||
}
|
||||
}
|
||||
if (exp == null) {
|
||||
exp = EQUAL;
|
||||
exp = EQ;
|
||||
}
|
||||
this.express = exp;
|
||||
|
||||
@@ -178,7 +178,7 @@ public final class FilterNodeBean<T extends FilterBean> implements Comparable<Fi
|
||||
}
|
||||
if (!skip) {
|
||||
if (this.joinClass == null) {
|
||||
node = FilterNode.create(column, express, val);
|
||||
node = FilterNodes.create(column, express, val);
|
||||
} else {
|
||||
node = FilterJoinNode.create(joinClass, joinColumns, column, express, val);
|
||||
}
|
||||
@@ -419,16 +419,16 @@ public final class FilterNodeBean<T extends FilterBean> implements Comparable<Fi
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (column != null) {
|
||||
String col = prefix == null ? column : (prefix + "." + column);
|
||||
if (express == ISNULL || express == ISNOTNULL) {
|
||||
if (express == IS_NULL || express == NOT_NULL) {
|
||||
sb.append(col).append(' ').append(express.value());
|
||||
} else if (express == ISEMPTY || express == ISNOTEMPTY) {
|
||||
} else if (express == IS_EMPTY || express == NOT_EMPTY) {
|
||||
sb.append(col).append(' ').append(express.value()).append(" ''");
|
||||
} else if (express == LENGTH_EQUAL || express == LENGTH_LESSTHAN || express == LENGTH_LESSTHANOREQUALTO
|
||||
|| express == LENGTH_GREATERTHAN || express == LENGTH_GREATERTHANOREQUALTO) {
|
||||
} else if (express == LEN_EQ || express == LEN_LT || express == LEN_LE
|
||||
|| express == LEN_GT || express == LEN_GE) {
|
||||
sb.append("LENGTH(").append(col).append(") ").append(express.value()).append(" ?");
|
||||
} else {
|
||||
boolean lower = (express == IGNORECASEEQUAL || express == IGNORECASENOTEQUAL || express == IGNORECASELIKE
|
||||
|| express == IGNORECASENOTLIKE || express == IGNORECASECONTAIN || express == IGNORECASENOTCONTAIN);
|
||||
boolean lower = (express == IG_EQ || express == IG_NOT_EQ || express == IG_LIKE
|
||||
|| express == IG_NOT_LIKE || express == IG_CONTAIN || express == IG_NOT_CONTAIN);
|
||||
sb.append(lower ? ("LOWER(" + col + ')') : col).append(' ').append(express.value()).append(" ?");
|
||||
}
|
||||
}
|
||||
|
||||
571
src/main/java/org/redkale/source/FilterNodes.java
Normal file
571
src/main/java/org/redkale/source/FilterNodes.java
Normal file
@@ -0,0 +1,571 @@
|
||||
/*
|
||||
*
|
||||
*/
|
||||
package org.redkale.source;
|
||||
|
||||
import java.io.Serializable;
|
||||
import static org.redkale.source.FilterExpress.*;
|
||||
import org.redkale.util.LambdaFunction;
|
||||
import org.redkale.util.LambdaSupplier;
|
||||
|
||||
/**
|
||||
* FilterNode的工具类
|
||||
*
|
||||
* <p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public final class FilterNodes {
|
||||
|
||||
private FilterNodes() {
|
||||
//do nothind
|
||||
}
|
||||
|
||||
public static FilterNode create(String column, Serializable value) {
|
||||
return new FilterNode(column, null, value);
|
||||
}
|
||||
|
||||
public static FilterNode create(String column, FilterExpress express, Serializable value) {
|
||||
return new FilterNode(column, express, value);
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode create(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), null, func.get());
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode create(LambdaSupplier<F> func, FilterExpress express) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), express, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode create(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), null, value);
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode create(LambdaFunction<T, F> func, FilterExpress express, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), express, value);
|
||||
}
|
||||
|
||||
public static FilterNode eq(String column, Serializable value) {
|
||||
return new FilterNode(column, EQ, value);
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode eq(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), EQ, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode eq(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), EQ, value);
|
||||
}
|
||||
|
||||
public static FilterNode igEq(String column, Serializable value) {
|
||||
return new FilterNode(column, IG_EQ, value);
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode igEq(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), IG_EQ, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode igEq(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), IG_EQ, value);
|
||||
}
|
||||
|
||||
public static FilterNode notEq(String column, Serializable value) {
|
||||
return new FilterNode(column, NOT_EQ, value);
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode notEq(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), NOT_EQ, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode notEq(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), NOT_EQ, value);
|
||||
}
|
||||
|
||||
public static FilterNode igNotEq(String column, Serializable value) {
|
||||
return new FilterNode(column, IG_NOT_EQ, value);
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode igNotEq(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), IG_NOT_EQ, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode igNotEq(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), IG_NOT_EQ, value);
|
||||
}
|
||||
|
||||
public static FilterNode gt(String column, Number value) {
|
||||
return new FilterNode(column, GT, value);
|
||||
}
|
||||
|
||||
public static <F extends Number> FilterNode gt(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), GT, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Number> FilterNode gt(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), GT, value);
|
||||
}
|
||||
|
||||
public static FilterNode lt(String column, Number value) {
|
||||
return new FilterNode(column, LT, value);
|
||||
}
|
||||
|
||||
public static <F extends Number> FilterNode lt(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), LT, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Number> FilterNode lt(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), LT, value);
|
||||
}
|
||||
|
||||
public static FilterNode ge(String column, Number value) {
|
||||
return new FilterNode(column, GE, value);
|
||||
}
|
||||
|
||||
public static <F extends Number> FilterNode ge(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), GE, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Number> FilterNode ge(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), GE, value);
|
||||
}
|
||||
|
||||
public static FilterNode le(String column, Number value) {
|
||||
return new FilterNode(column, LE, value);
|
||||
}
|
||||
|
||||
public static <F extends Number> FilterNode le(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), LE, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Number> FilterNode le(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), LE, value);
|
||||
}
|
||||
|
||||
public static FilterNode like(String column, String value) {
|
||||
return new FilterNode(column, LIKE, value);
|
||||
}
|
||||
|
||||
public static FilterNode like(LambdaSupplier<String> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), LIKE, func.get());
|
||||
}
|
||||
|
||||
public static <T> FilterNode like(LambdaFunction<T, String> func, String value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), LIKE, value);
|
||||
}
|
||||
|
||||
public static FilterNode notLike(String column, String value) {
|
||||
return new FilterNode(column, NOT_LIKE, value);
|
||||
}
|
||||
|
||||
public static FilterNode notLike(LambdaSupplier<String> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), NOT_LIKE, func.get());
|
||||
}
|
||||
|
||||
public static <T> FilterNode notLike(LambdaFunction<T, String> func, String value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), NOT_LIKE, value);
|
||||
}
|
||||
|
||||
public static FilterNode igLike(String column, String value) {
|
||||
return new FilterNode(column, IG_LIKE, value);
|
||||
}
|
||||
|
||||
public static FilterNode igLike(LambdaSupplier<String> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), IG_LIKE, func.get());
|
||||
}
|
||||
|
||||
public static <T> FilterNode igLike(LambdaFunction<T, String> func, String value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), IG_LIKE, value);
|
||||
}
|
||||
|
||||
public static FilterNode igNotLike(String column, String value) {
|
||||
return new FilterNode(column, IG_NOT_LIKE, value);
|
||||
}
|
||||
|
||||
public static FilterNode igNotLike(LambdaSupplier<String> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), IG_NOT_LIKE, func.get());
|
||||
}
|
||||
|
||||
public static <T> FilterNode igNotLike(LambdaFunction<T, String> func, String value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), IG_NOT_LIKE, value);
|
||||
}
|
||||
|
||||
public static FilterNode starts(String column, String value) {
|
||||
return new FilterNode(column, STARTS, value);
|
||||
}
|
||||
|
||||
public static FilterNode starts(LambdaSupplier<String> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), STARTS, func.get());
|
||||
}
|
||||
|
||||
public static <T> FilterNode starts(LambdaFunction<T, String> func, String value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), STARTS, value);
|
||||
}
|
||||
|
||||
public static FilterNode ends(String column, String value) {
|
||||
return new FilterNode(column, ENDS, value);
|
||||
}
|
||||
|
||||
public static FilterNode ends(LambdaSupplier<String> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), ENDS, func.get());
|
||||
}
|
||||
|
||||
public static <T> FilterNode ends(LambdaFunction<T, String> func, String value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), ENDS, value);
|
||||
}
|
||||
|
||||
public static FilterNode notStarts(String column, String value) {
|
||||
return new FilterNode(column, NOT_STARTS, value);
|
||||
}
|
||||
|
||||
public static FilterNode notStarts(LambdaSupplier<String> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), NOT_STARTS, func.get());
|
||||
}
|
||||
|
||||
public static <T> FilterNode notStarts(LambdaFunction<T, String> func, String value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), NOT_STARTS, value);
|
||||
}
|
||||
|
||||
public static FilterNode notEnds(String column, String value) {
|
||||
return new FilterNode(column, NOT_ENDS, value);
|
||||
}
|
||||
|
||||
public static FilterNode notEnds(LambdaSupplier<String> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), NOT_ENDS, func.get());
|
||||
}
|
||||
|
||||
public static <T> FilterNode notEnds(LambdaFunction<T, String> func, String value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), NOT_ENDS, value);
|
||||
}
|
||||
|
||||
public static FilterNode lenEq(String column, Number value) {
|
||||
return new FilterNode(column, LEN_EQ, value);
|
||||
}
|
||||
|
||||
public static <F extends Number> FilterNode lenEq(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), LEN_EQ, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Number> FilterNode lenEq(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), LEN_EQ, value);
|
||||
}
|
||||
|
||||
public static FilterNode lenGt(String column, Number value) {
|
||||
return new FilterNode(column, LEN_GT, value);
|
||||
}
|
||||
|
||||
public static <F extends Number> FilterNode lenGt(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), LEN_GT, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Number> FilterNode lenGt(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), LEN_GT, value);
|
||||
}
|
||||
|
||||
public static FilterNode lenLt(String column, Number value) {
|
||||
return new FilterNode(column, LEN_LT, value);
|
||||
}
|
||||
|
||||
public static <F extends Number> FilterNode lenLt(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), LEN_LT, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Number> FilterNode lenLt(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), LEN_LT, value);
|
||||
}
|
||||
|
||||
public static FilterNode lenGe(String column, Number value) {
|
||||
return new FilterNode(column, LEN_GE, value);
|
||||
}
|
||||
|
||||
public static <F extends Number> FilterNode lenGe(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), LEN_GE, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Number> FilterNode lenGe(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), LEN_GE, value);
|
||||
}
|
||||
|
||||
public static FilterNode lenLe(String column, Number value) {
|
||||
return new FilterNode(column, LEN_LE, value);
|
||||
}
|
||||
|
||||
public static <F extends Number> FilterNode lenLe(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), LEN_LE, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Number> FilterNode lenLe(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), LEN_LE, value);
|
||||
}
|
||||
|
||||
public static FilterNode contain(String column, Serializable value) {
|
||||
return new FilterNode(column, CONTAIN, value);
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode contain(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), CONTAIN, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode contain(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), CONTAIN, value);
|
||||
}
|
||||
|
||||
public static FilterNode notContain(String column, Serializable value) {
|
||||
return new FilterNode(column, NOT_CONTAIN, value);
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode notContain(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), NOT_CONTAIN, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode notContain(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), NOT_CONTAIN, value);
|
||||
}
|
||||
|
||||
public static FilterNode igContain(String column, Serializable value) {
|
||||
return new FilterNode(column, IG_CONTAIN, value);
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode igContain(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), IG_CONTAIN, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode igContain(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), IG_CONTAIN, value);
|
||||
}
|
||||
|
||||
public static FilterNode igNotContain(String column, Serializable value) {
|
||||
return new FilterNode(column, IG_NOT_CONTAIN, value);
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode igNotContain(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), IG_NOT_CONTAIN, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode igNotContain(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), IG_NOT_CONTAIN, value);
|
||||
}
|
||||
|
||||
public static FilterNode between(String column, Range value) {
|
||||
return new FilterNode(column, BETWEEN, value);
|
||||
}
|
||||
|
||||
public static <F extends Range> FilterNode between(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), BETWEEN, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Range> FilterNode between(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), BETWEEN, value);
|
||||
}
|
||||
|
||||
public static FilterNode notBetween(String column, Range value) {
|
||||
return new FilterNode(column, NOT_BETWEEN, value);
|
||||
}
|
||||
|
||||
public static <F extends Range> FilterNode notBetween(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), NOT_BETWEEN, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Range> FilterNode notBetween(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), NOT_BETWEEN, value);
|
||||
}
|
||||
|
||||
public static FilterNode in(String column, Serializable value) {
|
||||
return new FilterNode(column, IN, value);
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode in(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), IN, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode in(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), IN, value);
|
||||
}
|
||||
|
||||
public static FilterNode notIn(String column, Serializable value) {
|
||||
return new FilterNode(column, NOT_IN, value);
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode notIn(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), NOT_IN, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode notIn(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), NOT_IN, value);
|
||||
}
|
||||
|
||||
public static FilterNode isNull(String column) {
|
||||
return new FilterNode(column, IS_NULL, null);
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode isNull(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), IS_NULL, null);
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode isNull(LambdaFunction<T, F> func) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), IS_NULL, null);
|
||||
}
|
||||
|
||||
public static FilterNode notNull(String column) {
|
||||
return new FilterNode(column, NOT_NULL, null);
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode notNull(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), NOT_NULL, null);
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode notNull(LambdaFunction<T, F> func) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), NOT_NULL, null);
|
||||
}
|
||||
|
||||
public static FilterNode isEmpty(String column) {
|
||||
return new FilterNode(column, IS_EMPTY, null);
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode isEmpty(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), IS_EMPTY, null);
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode isEmpty(LambdaFunction<T, F> func) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), IS_EMPTY, null);
|
||||
}
|
||||
|
||||
public static FilterNode notEmpty(String column) {
|
||||
return new FilterNode(column, NOT_EMPTY, null);
|
||||
}
|
||||
|
||||
public static <F extends Serializable> FilterNode notEmpty(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), NOT_EMPTY, null);
|
||||
}
|
||||
|
||||
public static <T, F extends Serializable> FilterNode notEmpty(LambdaFunction<T, F> func) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), NOT_EMPTY, null);
|
||||
}
|
||||
|
||||
public static FilterNode opand(String column, Number value) {
|
||||
return new FilterNode(column, OPAND, value);
|
||||
}
|
||||
|
||||
public static <F extends Number> FilterNode opand(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), OPAND, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Number> FilterNode opand(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), OPAND, value);
|
||||
}
|
||||
|
||||
public static FilterNode opor(String column, Number value) {
|
||||
return new FilterNode(column, OPOR, value);
|
||||
}
|
||||
|
||||
public static <F extends Number> FilterNode opor(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), OPOR, func.get());
|
||||
}
|
||||
|
||||
public <T, F extends Number> FilterNode opor(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), OPOR, value);
|
||||
}
|
||||
|
||||
public static FilterNode notOpand(String column, Number value) {
|
||||
return new FilterNode(column, NOT_OPAND, value);
|
||||
}
|
||||
|
||||
public static <F extends Number> FilterNode notOpand(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), NOT_OPAND, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends Number> FilterNode notOpand(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), NOT_OPAND, value);
|
||||
}
|
||||
|
||||
public static FilterNode fvmode(String column, FilterValue value) {
|
||||
return new FilterNode(column, FV_MOD, value);
|
||||
}
|
||||
|
||||
public static <F extends FilterValue> FilterNode fvmode(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), FV_MOD, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends FilterValue> FilterNode fvmode(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), FV_MOD, value);
|
||||
}
|
||||
|
||||
public static FilterNode fvdiv(String column, FilterValue value) {
|
||||
return new FilterNode(column, FV_DIV, value);
|
||||
}
|
||||
|
||||
public static <F extends FilterValue> FilterNode fvdiv(LambdaSupplier<F> func) {
|
||||
return new FilterNode(LambdaSupplier.readColumn(func), FV_DIV, func.get());
|
||||
}
|
||||
|
||||
public static <T, F extends FilterValue> FilterNode fvdiv(LambdaFunction<T, F> func, F value) {
|
||||
return new FilterNode(LambdaFunction.readColumn(func), FV_DIV, value);
|
||||
}
|
||||
|
||||
static FilterExpress oldExpress(FilterExpress express) {
|
||||
switch (express) {
|
||||
case EQUAL:
|
||||
return EQ;
|
||||
case IGNORECASEEQUAL:
|
||||
return IG_EQ;
|
||||
case NOTEQUAL:
|
||||
return NOT_EQ;
|
||||
case IGNORECASENOTEQUAL:
|
||||
return IG_NOT_EQ;
|
||||
case GREATERTHAN:
|
||||
return GT;
|
||||
case LESSTHAN:
|
||||
return LT;
|
||||
case GREATERTHANOREQUALTO:
|
||||
return GE;
|
||||
case LESSTHANOREQUALTO:
|
||||
return LE;
|
||||
case NOTLIKE:
|
||||
return NOT_LIKE;
|
||||
case IGNORECASELIKE:
|
||||
return IG_LIKE;
|
||||
case IGNORECASENOTLIKE:
|
||||
return IG_NOT_LIKE;
|
||||
case STARTSWITH:
|
||||
return STARTS;
|
||||
case ENDSWITH:
|
||||
return ENDS;
|
||||
case NOTSTARTSWITH:
|
||||
return NOT_STARTS;
|
||||
case NOTENDSWITH:
|
||||
return NOT_ENDS;
|
||||
case LENGTH_EQUAL:
|
||||
return LEN_EQ;
|
||||
case LENGTH_GREATERTHAN:
|
||||
return LEN_GT;
|
||||
case LENGTH_LESSTHAN:
|
||||
return LEN_LT;
|
||||
case LENGTH_GREATERTHANOREQUALTO:
|
||||
return LEN_GE;
|
||||
case LENGTH_LESSTHANOREQUALTO:
|
||||
return LEN_LE;
|
||||
case NOTCONTAIN:
|
||||
return NOT_CONTAIN;
|
||||
case IGNORECASECONTAIN:
|
||||
return IG_CONTAIN;
|
||||
case IGNORECASENOTCONTAIN:
|
||||
return IG_NOT_CONTAIN;
|
||||
case NOTBETWEEN:
|
||||
return NOT_BETWEEN;
|
||||
case NOTIN:
|
||||
return NOT_IN;
|
||||
case ISNULL:
|
||||
return IS_NULL;
|
||||
case ISNOTNULL:
|
||||
return NOT_NULL;
|
||||
case ISEMPTY:
|
||||
return IS_EMPTY;
|
||||
case ISNOTEMPTY:
|
||||
return NOT_EMPTY;
|
||||
default:
|
||||
return express;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class FilterValue implements java.io.Serializable {
|
||||
}
|
||||
|
||||
public FilterValue(Number left, Number right) {
|
||||
this(left, FilterExpress.EQUAL, right);
|
||||
this(left, FilterExpress.EQ, right);
|
||||
}
|
||||
|
||||
public FilterValue(Number left, FilterExpress express) {
|
||||
@@ -40,7 +40,7 @@ public class FilterValue implements java.io.Serializable {
|
||||
|
||||
public FilterValue(Number left, FilterExpress express, Number right) {
|
||||
this.left = left;
|
||||
this.express = express;
|
||||
this.express = FilterNodes.oldExpress(express);
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class FilterValue implements java.io.Serializable {
|
||||
}
|
||||
|
||||
public FilterExpress getExpress() {
|
||||
return express == null ? FilterExpress.EQUAL : express;
|
||||
return express == null ? FilterExpress.EQ : express;
|
||||
}
|
||||
|
||||
public void setExpress(FilterExpress express) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.nio.charset.*;
|
||||
import java.util.*;
|
||||
import java.util.function.*;
|
||||
import org.redkale.annotation.ConstructorParameters;
|
||||
import org.redkale.convert.ConvertColumn;
|
||||
import org.redkale.convert.ConvertDisabled;
|
||||
|
||||
/**
|
||||
@@ -64,12 +65,15 @@ public abstract class AnyValue {
|
||||
*/
|
||||
public static final BiPredicate<String, String> EQUALS_IGNORE = (name1, name2) -> name1.equalsIgnoreCase(name2);
|
||||
|
||||
@ConvertColumn(index = 1)
|
||||
private boolean ignoreCase;
|
||||
|
||||
private BiPredicate<String, String> predicate;
|
||||
|
||||
@ConvertColumn(index = 2)
|
||||
private Entry<String>[] stringEntrys = new Entry[0];
|
||||
|
||||
@ConvertColumn(index = 3)
|
||||
private Entry<DefaultAnyValue>[] anyEntrys = new Entry[0];
|
||||
|
||||
private int parentArrayIndex = -1; //只可能被loadFromProperties方法赋值
|
||||
@@ -353,6 +357,7 @@ public abstract class AnyValue {
|
||||
*
|
||||
* @return DefaultAnyValue
|
||||
*/
|
||||
@ConvertDisabled
|
||||
public DefaultAnyValue setAll(final AnyValue av) {
|
||||
if (av == null) {
|
||||
return this;
|
||||
@@ -644,8 +649,10 @@ public abstract class AnyValue {
|
||||
/**
|
||||
* 字段名
|
||||
*/
|
||||
@ConvertColumn(index = 1)
|
||||
public final String name;
|
||||
|
||||
@ConvertColumn(index = 2)
|
||||
T value;
|
||||
|
||||
@ConstructorParameters({"name", "value"})
|
||||
|
||||
@@ -2696,6 +2696,27 @@ public final class Utility {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断指定值是否包含指定的数组中,包含返回true
|
||||
*
|
||||
* @param <T> 泛型
|
||||
* @param values 集合
|
||||
* @param predicate 过滤条件
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static <T> boolean contains(Collection<T> values, Predicate<T> predicate) {
|
||||
if (values == null) {
|
||||
return false;
|
||||
}
|
||||
for (T v : values) {
|
||||
if (predicate.test(v)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将指定的short元素是否数组中完全包含,重复元素的次数也要相同 <br>
|
||||
* 例如: <br>
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
*/
|
||||
package org.redkale.test.convert.protobuf;
|
||||
|
||||
import org.redkale.convert.protobuf.ProtobufObjectEncoder;
|
||||
import org.redkale.convert.protobuf.ProtobufReader;
|
||||
import org.redkale.convert.protobuf.ProtobufObjectDecoder;
|
||||
import org.redkale.convert.protobuf.ProtobufConvert;
|
||||
import java.lang.annotation.*;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
import java.lang.annotation.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.function.*;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.redkale.convert.*;
|
||||
import org.redkale.convert.json.JsonConvert;
|
||||
import org.redkale.convert.protobuf.ProtobufConvert;
|
||||
import org.redkale.convert.protobuf.ProtobufObjectDecoder;
|
||||
import org.redkale.convert.protobuf.ProtobufObjectEncoder;
|
||||
import org.redkale.convert.protobuf.ProtobufReader;
|
||||
import org.redkale.util.*;
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,9 @@ public class PBCustMessage2Test {
|
||||
@Test
|
||||
public void run() throws Exception {
|
||||
final BiFunction<Attribute, Object, Object> objFieldFunc = (Attribute t, Object u) -> {
|
||||
if (t.field().equals("retinfo")) return null;
|
||||
if (t.field().equals("retinfo")) {
|
||||
return null;
|
||||
}
|
||||
return t.get(u);
|
||||
};
|
||||
OnPlayerLeaveMessage msg1 = new OnPlayerLeaveMessage(100, "haha");
|
||||
@@ -43,19 +45,25 @@ public class PBCustMessage2Test {
|
||||
byte[] bs2 = ProtobufConvert.root().convertTo(msg2);
|
||||
System.out.println(Arrays.toString(bs1));
|
||||
System.out.println(Arrays.toString(bs2));
|
||||
if (!main) Assertions.assertEquals(Arrays.toString(bs1), Arrays.toString(bs2));
|
||||
if (!main) {
|
||||
Assertions.assertEquals(Arrays.toString(bs1), Arrays.toString(bs2));
|
||||
}
|
||||
System.out.println();
|
||||
|
||||
OnPlayerLeaveMessage2 newmsg2 = ProtobufConvert.root().convertFrom(OnPlayerLeaveMessage2.class, bs1);
|
||||
byte[] newbs2 = ProtobufConvert.root().convertTo(newmsg2);
|
||||
System.out.println(Arrays.toString(newbs2));
|
||||
if (!main) Assertions.assertEquals(Arrays.toString(bs1), Arrays.toString(newbs2));
|
||||
if (!main) {
|
||||
Assertions.assertEquals(Arrays.toString(bs1), Arrays.toString(newbs2));
|
||||
}
|
||||
System.out.println();
|
||||
|
||||
ProtobufConvert convert = ProtobufConvert.root().newConvert(objFieldFunc);
|
||||
System.out.println(Arrays.toString(convert.convertTo(msg1)));
|
||||
System.out.println(Arrays.toString(convert.convertTo(msg2)));
|
||||
if (!main) Assertions.assertEquals(Arrays.toString(convert.convertTo(msg1)), Arrays.toString(convert.convertTo(msg2)));
|
||||
if (!main) {
|
||||
Assertions.assertEquals(Arrays.toString(convert.convertTo(msg1)), Arrays.toString(convert.convertTo(msg2)));
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
@@ -72,7 +80,9 @@ public class PBCustMessage2Test {
|
||||
|
||||
public static String getMessageName(Class<?> clazz) {
|
||||
MessageName mn = clazz.getAnnotation(MessageName.class);
|
||||
if (mn != null) return mn.value();
|
||||
if (mn != null) {
|
||||
return mn.value();
|
||||
}
|
||||
char[] fieldChars = clazz.getSimpleName().toCharArray();
|
||||
fieldChars[0] = Character.toLowerCase(fieldChars[0]);
|
||||
return new String(fieldChars);
|
||||
@@ -165,8 +175,10 @@ public class PBCustMessage2Test {
|
||||
|
||||
public static class OnPlayerLeaveMessage {
|
||||
|
||||
@ConvertColumn(index = 1)
|
||||
private String event = "onPlayerLeaveMessage";
|
||||
|
||||
@ConvertColumn(index = 2)
|
||||
private OnPlayerLeaveContent result;
|
||||
|
||||
public OnPlayerLeaveMessage() {
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
*/
|
||||
package org.redkale.test.convert.protobuf;
|
||||
|
||||
import org.redkale.convert.protobuf.ProtobufObjectEncoder;
|
||||
import org.redkale.convert.protobuf.ProtobufReader;
|
||||
import org.redkale.convert.protobuf.ProtobufFactory;
|
||||
import org.redkale.convert.protobuf.ProtobufObjectDecoder;
|
||||
import org.redkale.convert.protobuf.ProtobufConvert;
|
||||
import java.lang.annotation.*;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
@@ -15,6 +10,11 @@ import java.util.function.*;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.redkale.convert.*;
|
||||
import org.redkale.convert.json.JsonConvert;
|
||||
import org.redkale.convert.protobuf.ProtobufConvert;
|
||||
import org.redkale.convert.protobuf.ProtobufFactory;
|
||||
import org.redkale.convert.protobuf.ProtobufObjectDecoder;
|
||||
import org.redkale.convert.protobuf.ProtobufObjectEncoder;
|
||||
import org.redkale.convert.protobuf.ProtobufReader;
|
||||
import org.redkale.util.*;
|
||||
|
||||
/**
|
||||
@@ -148,6 +148,7 @@ public class PBCustMessageTest {
|
||||
|
||||
public static class OnPlayerLeaveMessage {
|
||||
|
||||
@ConvertColumn(index = 1)
|
||||
private OnPlayerLeaveContent onPlayerLeaveMessage;
|
||||
|
||||
public OnPlayerLeaveMessage() {
|
||||
|
||||
@@ -42,12 +42,12 @@ public class CacheTestBean {
|
||||
System.out.println(cache.queryColumnMap("pkgid", FilterFunc.MAX, "price", null));
|
||||
System.out.println(cache.queryColumnMap("pkgid", FilterFunc.MIN, "price", null));
|
||||
|
||||
System.out.println(cache.find(null, FilterNode.create("name", FilterExpress.EQUAL, "BB")));
|
||||
System.out.println(cache.find(null, FilterNode.create("name", FilterExpress.IGNORECASEEQUAL, "BB")));
|
||||
System.out.println(cache.querySheet(null, null, FilterNode.create("name", FilterExpress.IGNORECASENOTLIKE, "B")));
|
||||
System.out.println(cache.find(null, FilterNode.create(CacheTestBean::getName, FilterExpress.EQUAL, "BB")));
|
||||
System.out.println(cache.find(null, FilterNode.create(CacheTestBean::getName, FilterExpress.IGNORECASEEQUAL, "BB")));
|
||||
System.out.println(cache.querySheet(null, null, FilterNode.create(CacheTestBean::getName, FilterExpress.IGNORECASENOTLIKE, "B")));
|
||||
System.out.println(cache.find(null, FilterNodes.eq("name", "BB")));
|
||||
System.out.println(cache.find(null, FilterNodes.igEq("name", "BB")));
|
||||
System.out.println(cache.querySheet(null, null, FilterNodes.igNotLike("name", "B")));
|
||||
System.out.println(cache.find(null, FilterNodes.eq(CacheTestBean::getName, "BB")));
|
||||
System.out.println(cache.find(null, FilterNodes.igEq(CacheTestBean::getName, "BB")));
|
||||
System.out.println(cache.querySheet(null, null, FilterNodes.igNotLike(CacheTestBean::getName, "B")));
|
||||
}
|
||||
|
||||
public CacheTestBean() {
|
||||
|
||||
@@ -5,22 +5,18 @@
|
||||
*/
|
||||
package org.redkale.test.source;
|
||||
|
||||
import org.redkale.persistence.Cacheable;
|
||||
import org.redkale.persistence.Id;
|
||||
import org.redkale.persistence.Transient;
|
||||
import org.redkale.source.*;
|
||||
import org.redkale.annotation.AutoLoad;
|
||||
|
||||
import static org.redkale.source.FilterExpress.*;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.*;
|
||||
|
||||
import org.redkale.convert.json.*;
|
||||
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.redkale.annotation.AutoLoad;
|
||||
import org.redkale.convert.json.*;
|
||||
import org.redkale.persistence.Cacheable;
|
||||
import org.redkale.persistence.Id;
|
||||
import org.redkale.persistence.Transient;
|
||||
import org.redkale.source.*;
|
||||
import static org.redkale.source.FilterExpress.*;
|
||||
|
||||
/**
|
||||
* @author zhangjx
|
||||
@@ -105,9 +101,9 @@ public class FilterNodeTest {
|
||||
public void run() throws Exception {
|
||||
final CarTestBean bean = CarTestBean.create();
|
||||
FilterNode joinNode1 = FilterJoinNode.create(UserTestTable.class, new String[]{"userid", "username"}, "username", LIKE, bean.username)
|
||||
.or(FilterJoinNode.create(UserTestTable.class, new String[]{"userid", "username"}, "createtime", GREATERTHAN, bean.createtime));
|
||||
.or(FilterJoinNode.create(UserTestTable.class, new String[]{"userid", "username"}, "createtime", GT, bean.createtime));
|
||||
FilterNode joinNode2 = FilterJoinNode.create(CarTypeTestTable.class, "cartype", "typename", LIKE, bean.typename);
|
||||
final FilterNode node = CarTestBean.caridTransient() ? (joinNode2.or(joinNode1)) : FilterNode.create("carid", GREATERTHAN, bean.carid).and(joinNode1).or(joinNode2);
|
||||
final FilterNode node = CarTestBean.caridTransient() ? (joinNode2.or(joinNode1)) : FilterNodes.gt("carid", bean.carid).and(joinNode1).or(joinNode2);
|
||||
final FilterNode beanNode = FilterNodeBean.createFilterNode(bean);
|
||||
System.out.println("node.string = " + node);
|
||||
System.out.println("bean.string = " + beanNode);
|
||||
@@ -136,7 +132,7 @@ public class FilterNodeTest {
|
||||
public static class CarTestBean implements FilterBean {
|
||||
|
||||
@FilterGroup("[OR].[AND]a")
|
||||
@FilterColumn(express = GREATERTHAN)
|
||||
@FilterColumn(express = GT)
|
||||
@Transient
|
||||
public long carid;
|
||||
|
||||
@@ -146,7 +142,7 @@ public class FilterNodeTest {
|
||||
public String username;
|
||||
|
||||
@FilterGroup("[OR].[AND]a.[OR]c")
|
||||
@FilterColumn(express = GREATERTHAN)
|
||||
@FilterColumn(express = GT)
|
||||
@FilterJoinColumn(table = UserTestTable.class, columns = {"userid", "username"})
|
||||
public long createtime;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class TestSourceCache {
|
||||
|
||||
public static class TestEntityBean implements FilterBean {
|
||||
|
||||
@FilterColumn(express = FilterExpress.GREATERTHAN)
|
||||
@FilterColumn(express = FilterExpress.GT)
|
||||
public int userid;
|
||||
|
||||
@FilterColumn(express = FilterExpress.LIKE)
|
||||
@@ -60,9 +60,9 @@ public class TestSourceCache {
|
||||
|
||||
final Flipper flipper = new Flipper(2);
|
||||
flipper.setSort("userid DESC, createtime DESC");
|
||||
final FilterNode node = FilterNode.create("userid", FilterExpress.GREATERTHAN, 1000).and("username", FilterExpress.LIKE, "用户");
|
||||
final FilterNode node = FilterNodes.gt("userid", 1000).like("username", "用户");
|
||||
System.out.println("node = " + node);
|
||||
final FilterNode node2 = FilterNode.create(TestEntity::getUserid, FilterExpress.GREATERTHAN, 1000).and("username", FilterExpress.LIKE, "用户");
|
||||
final FilterNode node2 = FilterNodes.gt(TestEntity::getUserid, 1000).like("username", "用户");
|
||||
Assertions.assertEquals(node.toString(), node2.toString());
|
||||
Sheet<TestEntity> sheet = info.getCache().querySheet(null, flipper, node);
|
||||
System.out.println(sheet);
|
||||
|
||||
Reference in New Issue
Block a user