DataQuery 添加条件.
This commit is contained in:
@@ -34,7 +34,7 @@ public interface IMapper<T> extends BaseMapper<T> {
|
|||||||
* @return 获取 wrapper
|
* @return 获取 wrapper
|
||||||
*/
|
*/
|
||||||
default LambdaQueryWrapper<T> lambda() {
|
default LambdaQueryWrapper<T> lambda() {
|
||||||
return new LambdaQueryWrapper<>();
|
return Conditions.lambda();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,16 @@ public class Conditions {
|
|||||||
private Conditions() {
|
private Conditions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 LambdaQueryWrapper
|
||||||
|
*
|
||||||
|
* @param <T> T
|
||||||
|
* @return wrapper
|
||||||
|
*/
|
||||||
|
public static <T> LambdaQueryWrapper<T> lambda() {
|
||||||
|
return new LambdaQueryWrapper<>();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 条件有效性验证 wrapper
|
* 条件有效性验证 wrapper
|
||||||
*
|
*
|
||||||
@@ -67,4 +77,28 @@ public class Conditions {
|
|||||||
return new LambdaQueryWrapper<T>().in(mapping, es);
|
return new LambdaQueryWrapper<T>().in(mapping, es);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有效性验证
|
||||||
|
*
|
||||||
|
* @param objects objects
|
||||||
|
* @return isValidate
|
||||||
|
*/
|
||||||
|
public static boolean isIllegal(Object... objects) {
|
||||||
|
for (Object object : objects) {
|
||||||
|
// 非 null 检查
|
||||||
|
if (object == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 字符串 非空校验
|
||||||
|
if (object instanceof String) {
|
||||||
|
return ((String) object).isEmpty();
|
||||||
|
}
|
||||||
|
// 集合 非空校验
|
||||||
|
if (object instanceof Collection<?>) {
|
||||||
|
return ((Collection<?>) object).isEmpty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
package com.orion.ops.framework.mybatis.core.query;
|
package com.orion.ops.framework.mybatis.core.query;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.interfaces.Join;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||||
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
||||||
import com.orion.lang.define.wrapper.DataGrid;
|
import com.orion.lang.define.wrapper.DataGrid;
|
||||||
import com.orion.lang.define.wrapper.IPageRequest;
|
import com.orion.lang.define.wrapper.IPageRequest;
|
||||||
|
import com.orion.lang.define.wrapper.PageRequest;
|
||||||
import com.orion.lang.define.wrapper.Pager;
|
import com.orion.lang.define.wrapper.Pager;
|
||||||
|
import com.orion.lang.utils.Exceptions;
|
||||||
import com.orion.lang.utils.Objects1;
|
import com.orion.lang.utils.Objects1;
|
||||||
import com.orion.lang.utils.Valid;
|
import com.orion.lang.utils.Valid;
|
||||||
import com.orion.lang.utils.collect.Lists;
|
import com.orion.lang.utils.collect.Lists;
|
||||||
@@ -35,13 +38,13 @@ public class DataQuery<T> {
|
|||||||
|
|
||||||
private IPageRequest page;
|
private IPageRequest page;
|
||||||
|
|
||||||
private LambdaQueryWrapper<T> wrapper;
|
private Wrapper<T> wrapper;
|
||||||
|
|
||||||
private DataQuery(BaseMapper<T> dao) {
|
private DataQuery(BaseMapper<T> dao) {
|
||||||
this.dao = dao;
|
this.dao = dao;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DataQuery(BaseMapper<T> dao, LambdaQueryWrapper<T> wrapper) {
|
private DataQuery(BaseMapper<T> dao, Wrapper<T> wrapper) {
|
||||||
this.dao = dao;
|
this.dao = dao;
|
||||||
this.wrapper = wrapper;
|
this.wrapper = wrapper;
|
||||||
}
|
}
|
||||||
@@ -65,7 +68,7 @@ public class DataQuery<T> {
|
|||||||
return new DataQuery<>(dao);
|
return new DataQuery<>(dao);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> DataQuery<T> of(BaseMapper<T> dao, LambdaQueryWrapper<T> wrapper) {
|
public static <T> DataQuery<T> of(BaseMapper<T> dao, Wrapper<T> wrapper) {
|
||||||
Valid.notNull(dao, "dao is null");
|
Valid.notNull(dao, "dao is null");
|
||||||
return new DataQuery<>(dao, wrapper);
|
return new DataQuery<>(dao, wrapper);
|
||||||
}
|
}
|
||||||
@@ -75,14 +78,45 @@ public class DataQuery<T> {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataQuery<T> wrapper(LambdaQueryWrapper<T> wrapper) {
|
public DataQuery<T> page(int page, int limit) {
|
||||||
|
this.page = new PageRequest(page, limit);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataQuery<T> wrapper(Wrapper<T> wrapper) {
|
||||||
this.wrapper = Valid.notNull(wrapper, "wrapper is null");
|
this.wrapper = Valid.notNull(wrapper, "wrapper is null");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------- condition --------------------
|
||||||
|
|
||||||
|
public ThenLambdaWrapper<T> createWrapper() {
|
||||||
|
return this.createWrapper(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ThenLambdaWrapper<T> createValidateWrapper() {
|
||||||
|
return this.createWrapper(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ThenLambdaWrapper<T> createWrapper(boolean validate) {
|
||||||
|
ThenLambdaWrapper<T> then = validate
|
||||||
|
? new ThenValidateLambdaWrapper<>(this)
|
||||||
|
: new ThenLambdaWrapper<>(this);
|
||||||
|
this.wrapper = then;
|
||||||
|
return then;
|
||||||
|
}
|
||||||
|
|
||||||
public DataQuery<T> only() {
|
public DataQuery<T> only() {
|
||||||
wrapper.last(Const.LIMIT_1);
|
return this.last(Const.LIMIT_1);
|
||||||
return this;
|
}
|
||||||
|
|
||||||
|
public DataQuery<T> last(String lastSql) {
|
||||||
|
if (wrapper instanceof Join) {
|
||||||
|
((Join<?>) wrapper).last(lastSql);
|
||||||
|
return this;
|
||||||
|
} else {
|
||||||
|
throw Exceptions.argument("wrapper not implements Join");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------- id --------------------
|
// -------------------- id --------------------
|
||||||
@@ -176,8 +210,9 @@ public class DataQuery<T> {
|
|||||||
pager.setTotal(count.intValue());
|
pager.setTotal(count.intValue());
|
||||||
boolean next = pager.hasMoreData();
|
boolean next = pager.hasMoreData();
|
||||||
if (next) {
|
if (next) {
|
||||||
wrapper.last(pager.getSql());
|
this.last(pager.getSql());
|
||||||
List<R> rows = dao.selectList(wrapper).stream()
|
List<R> rows = dao.selectList(wrapper)
|
||||||
|
.stream()
|
||||||
.map(mapper)
|
.map(mapper)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
pager.setRows(rows);
|
pager.setRows(rows);
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.orion.ops.framework.mybatis.core.query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 链式操作
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2023/10/7 14:57
|
||||||
|
*/
|
||||||
|
public interface Then<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取
|
||||||
|
*
|
||||||
|
* @return T
|
||||||
|
*/
|
||||||
|
T then();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
package com.orion.ops.framework.mybatis.core.query;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.AbstractLambdaWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.SharedString;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.Query;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复制 LambdaQueryWrapper
|
||||||
|
* 实现 Then
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2023/10/8 15:13
|
||||||
|
*/
|
||||||
|
public class ThenLambdaWrapper<T> extends AbstractLambdaWrapper<T, ThenLambdaWrapper<T>>
|
||||||
|
implements Query<ThenLambdaWrapper<T>, T, SFunction<T, ?>>, Then<DataQuery<T>> {
|
||||||
|
|
||||||
|
private final DataQuery<T> dataQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字段
|
||||||
|
*/
|
||||||
|
private SharedString sqlSelect = new SharedString();
|
||||||
|
|
||||||
|
public ThenLambdaWrapper(DataQuery<T> dataQuery) {
|
||||||
|
this((T) null, dataQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ThenLambdaWrapper(T entity, DataQuery<T> dataQuery) {
|
||||||
|
super.setEntity(entity);
|
||||||
|
super.initNeed();
|
||||||
|
this.dataQuery = dataQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
ThenLambdaWrapper(T entity, Class<T> entityClass, SharedString sqlSelect, AtomicInteger paramNameSeq,
|
||||||
|
Map<String, Object> paramNameValuePairs, MergeSegments mergeSegments, SharedString paramAlias,
|
||||||
|
SharedString lastSql, SharedString sqlComment, SharedString sqlFirst, DataQuery<T> dataQuery) {
|
||||||
|
super.setEntity(entity);
|
||||||
|
super.setEntityClass(entityClass);
|
||||||
|
this.paramNameSeq = paramNameSeq;
|
||||||
|
this.paramNameValuePairs = paramNameValuePairs;
|
||||||
|
this.expression = mergeSegments;
|
||||||
|
this.sqlSelect = sqlSelect;
|
||||||
|
this.paramAlias = paramAlias;
|
||||||
|
this.lastSql = lastSql;
|
||||||
|
this.sqlComment = sqlComment;
|
||||||
|
this.sqlFirst = sqlFirst;
|
||||||
|
this.dataQuery = dataQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SafeVarargs
|
||||||
|
@Override
|
||||||
|
public final ThenLambdaWrapper<T> select(SFunction<T, ?>... columns) {
|
||||||
|
return select(Arrays.asList(columns));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ThenLambdaWrapper<T> select(List<SFunction<T, ?>> columns) {
|
||||||
|
if (CollectionUtils.isNotEmpty(columns)) {
|
||||||
|
this.sqlSelect.setStringValue(columnsToString(false, columns));
|
||||||
|
}
|
||||||
|
return typedThis;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> select(Class<T> entityClass, Predicate<TableFieldInfo> predicate) {
|
||||||
|
if (entityClass == null) {
|
||||||
|
entityClass = getEntityClass();
|
||||||
|
} else {
|
||||||
|
setEntityClass(entityClass);
|
||||||
|
}
|
||||||
|
Assert.notNull(entityClass, "entityClass can not be null");
|
||||||
|
this.sqlSelect.setStringValue(TableInfoHelper.getTableInfo(entityClass).chooseSelect(predicate));
|
||||||
|
return typedThis;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSqlSelect() {
|
||||||
|
return sqlSelect.getStringValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ThenLambdaWrapper<T> instance() {
|
||||||
|
return new ThenLambdaWrapper<>(getEntity(), getEntityClass(), null, paramNameSeq, paramNameValuePairs,
|
||||||
|
new MergeSegments(), paramAlias, SharedString.emptyString(), SharedString.emptyString(), SharedString.emptyString(),
|
||||||
|
dataQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
super.clear();
|
||||||
|
sqlSelect.toNull();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataQuery<T> then() {
|
||||||
|
return dataQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
package com.orion.ops.framework.mybatis.core.query;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import static com.orion.ops.framework.mybatis.core.query.Conditions.isIllegal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复制 ValidateLambdaWrapper
|
||||||
|
* 继承 ThenLambdaWrapper
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2023/10/7 15:26
|
||||||
|
*/
|
||||||
|
public class ThenValidateLambdaWrapper<T> extends ThenLambdaWrapper<T> {
|
||||||
|
|
||||||
|
public ThenValidateLambdaWrapper(DataQuery<T> dataQuery) {
|
||||||
|
super(dataQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> eq(SFunction<T, ?> column, Object val) {
|
||||||
|
if (isIllegal(val)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.eq(column, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> ne(SFunction<T, ?> column, Object val) {
|
||||||
|
if (isIllegal(val)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.ne(column, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> gt(SFunction<T, ?> column, Object val) {
|
||||||
|
if (isIllegal(val)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.gt(column, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> ge(SFunction<T, ?> column, Object val) {
|
||||||
|
if (isIllegal(val)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.ge(column, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> lt(SFunction<T, ?> column, Object val) {
|
||||||
|
if (isIllegal(val)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.lt(column, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> le(SFunction<T, ?> column, Object val) {
|
||||||
|
if (isIllegal(val)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.le(column, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> between(SFunction<T, ?> column, Object val1, Object val2) {
|
||||||
|
if (isIllegal(val1, val2)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.between(column, val1, val2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> notBetween(SFunction<T, ?> column, Object val1, Object val2) {
|
||||||
|
if (isIllegal(val1, val2)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.notBetween(column, val1, val2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> like(SFunction<T, ?> column, Object val) {
|
||||||
|
if (isIllegal(val)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.like(column, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> notLike(SFunction<T, ?> column, Object val) {
|
||||||
|
if (isIllegal(val)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.notLike(column, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> notLikeLeft(SFunction<T, ?> column, Object val) {
|
||||||
|
if (isIllegal(val)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.notLikeLeft(column, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> notLikeRight(SFunction<T, ?> column, Object val) {
|
||||||
|
if (isIllegal(val)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.notLikeRight(column, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> likeLeft(SFunction<T, ?> column, Object val) {
|
||||||
|
if (isIllegal(val)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.likeLeft(column, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> likeRight(SFunction<T, ?> column, Object val) {
|
||||||
|
if (isIllegal(val)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.likeRight(column, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> in(SFunction<T, ?> column, Collection<?> coll) {
|
||||||
|
if (isIllegal(coll)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.in(column, coll);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> in(SFunction<T, ?> column, Object... values) {
|
||||||
|
if (isIllegal(values)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.in(column, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> notIn(SFunction<T, ?> column, Collection<?> coll) {
|
||||||
|
if (isIllegal(coll)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.notIn(column, coll);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThenLambdaWrapper<T> notIn(SFunction<T, ?> column, Object... value) {
|
||||||
|
if (isIllegal(value)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return super.notIn(column, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,10 +2,11 @@ package com.orion.ops.framework.mybatis.core.query;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
import com.orion.lang.utils.Strings;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import static com.orion.ops.framework.mybatis.core.query.Conditions.isIllegal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 有效性验证 wrapper
|
* 有效性验证 wrapper
|
||||||
*
|
*
|
||||||
@@ -26,33 +27,9 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
super(entityClass);
|
super(entityClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 有效性验证
|
|
||||||
*
|
|
||||||
* @param objects objects
|
|
||||||
* @return isValidate
|
|
||||||
*/
|
|
||||||
private boolean isIllegal(Object... objects) {
|
|
||||||
for (Object object : objects) {
|
|
||||||
// 非 null 检查
|
|
||||||
if (object == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// 字符串 非空校验
|
|
||||||
if (object instanceof String) {
|
|
||||||
return Strings.isEmpty((String) object);
|
|
||||||
}
|
|
||||||
// 集合 非空校验
|
|
||||||
if (object instanceof Collection<?>) {
|
|
||||||
return ((Collection<?>) object).isEmpty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> eq(SFunction<T, ?> column, Object val) {
|
public LambdaQueryWrapper<T> eq(SFunction<T, ?> column, Object val) {
|
||||||
if (this.isIllegal(val)) {
|
if (isIllegal(val)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.eq(column, val);
|
return super.eq(column, val);
|
||||||
@@ -60,7 +37,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> ne(SFunction<T, ?> column, Object val) {
|
public LambdaQueryWrapper<T> ne(SFunction<T, ?> column, Object val) {
|
||||||
if (this.isIllegal(val)) {
|
if (isIllegal(val)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.ne(column, val);
|
return super.ne(column, val);
|
||||||
@@ -68,7 +45,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> gt(SFunction<T, ?> column, Object val) {
|
public LambdaQueryWrapper<T> gt(SFunction<T, ?> column, Object val) {
|
||||||
if (this.isIllegal(val)) {
|
if (isIllegal(val)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.gt(column, val);
|
return super.gt(column, val);
|
||||||
@@ -76,7 +53,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> ge(SFunction<T, ?> column, Object val) {
|
public LambdaQueryWrapper<T> ge(SFunction<T, ?> column, Object val) {
|
||||||
if (this.isIllegal(val)) {
|
if (isIllegal(val)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.ge(column, val);
|
return super.ge(column, val);
|
||||||
@@ -84,7 +61,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> lt(SFunction<T, ?> column, Object val) {
|
public LambdaQueryWrapper<T> lt(SFunction<T, ?> column, Object val) {
|
||||||
if (this.isIllegal(val)) {
|
if (isIllegal(val)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.lt(column, val);
|
return super.lt(column, val);
|
||||||
@@ -92,7 +69,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> le(SFunction<T, ?> column, Object val) {
|
public LambdaQueryWrapper<T> le(SFunction<T, ?> column, Object val) {
|
||||||
if (this.isIllegal(val)) {
|
if (isIllegal(val)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.le(column, val);
|
return super.le(column, val);
|
||||||
@@ -100,7 +77,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> between(SFunction<T, ?> column, Object val1, Object val2) {
|
public LambdaQueryWrapper<T> between(SFunction<T, ?> column, Object val1, Object val2) {
|
||||||
if (this.isIllegal(val1, val2)) {
|
if (isIllegal(val1, val2)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.between(column, val1, val2);
|
return super.between(column, val1, val2);
|
||||||
@@ -108,7 +85,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> notBetween(SFunction<T, ?> column, Object val1, Object val2) {
|
public LambdaQueryWrapper<T> notBetween(SFunction<T, ?> column, Object val1, Object val2) {
|
||||||
if (this.isIllegal(val1, val2)) {
|
if (isIllegal(val1, val2)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.notBetween(column, val1, val2);
|
return super.notBetween(column, val1, val2);
|
||||||
@@ -116,7 +93,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> like(SFunction<T, ?> column, Object val) {
|
public LambdaQueryWrapper<T> like(SFunction<T, ?> column, Object val) {
|
||||||
if (this.isIllegal(val)) {
|
if (isIllegal(val)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.like(column, val);
|
return super.like(column, val);
|
||||||
@@ -124,7 +101,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> notLike(SFunction<T, ?> column, Object val) {
|
public LambdaQueryWrapper<T> notLike(SFunction<T, ?> column, Object val) {
|
||||||
if (this.isIllegal(val)) {
|
if (isIllegal(val)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.notLike(column, val);
|
return super.notLike(column, val);
|
||||||
@@ -132,7 +109,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> notLikeLeft(SFunction<T, ?> column, Object val) {
|
public LambdaQueryWrapper<T> notLikeLeft(SFunction<T, ?> column, Object val) {
|
||||||
if (this.isIllegal(val)) {
|
if (isIllegal(val)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.notLikeLeft(column, val);
|
return super.notLikeLeft(column, val);
|
||||||
@@ -140,7 +117,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> notLikeRight(SFunction<T, ?> column, Object val) {
|
public LambdaQueryWrapper<T> notLikeRight(SFunction<T, ?> column, Object val) {
|
||||||
if (this.isIllegal(val)) {
|
if (isIllegal(val)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.notLikeRight(column, val);
|
return super.notLikeRight(column, val);
|
||||||
@@ -148,7 +125,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> likeLeft(SFunction<T, ?> column, Object val) {
|
public LambdaQueryWrapper<T> likeLeft(SFunction<T, ?> column, Object val) {
|
||||||
if (this.isIllegal(val)) {
|
if (isIllegal(val)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.likeLeft(column, val);
|
return super.likeLeft(column, val);
|
||||||
@@ -156,7 +133,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> likeRight(SFunction<T, ?> column, Object val) {
|
public LambdaQueryWrapper<T> likeRight(SFunction<T, ?> column, Object val) {
|
||||||
if (this.isIllegal(val)) {
|
if (isIllegal(val)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.likeRight(column, val);
|
return super.likeRight(column, val);
|
||||||
@@ -164,7 +141,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> in(SFunction<T, ?> column, Collection<?> coll) {
|
public LambdaQueryWrapper<T> in(SFunction<T, ?> column, Collection<?> coll) {
|
||||||
if (this.isIllegal(coll)) {
|
if (isIllegal(coll)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.in(column, coll);
|
return super.in(column, coll);
|
||||||
@@ -172,7 +149,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> in(SFunction<T, ?> column, Object... values) {
|
public LambdaQueryWrapper<T> in(SFunction<T, ?> column, Object... values) {
|
||||||
if (this.isIllegal(values)) {
|
if (isIllegal(values)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.in(column, values);
|
return super.in(column, values);
|
||||||
@@ -180,7 +157,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> notIn(SFunction<T, ?> column, Collection<?> coll) {
|
public LambdaQueryWrapper<T> notIn(SFunction<T, ?> column, Collection<?> coll) {
|
||||||
if (this.isIllegal(coll)) {
|
if (isIllegal(coll)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.notIn(column, coll);
|
return super.notIn(column, coll);
|
||||||
@@ -188,7 +165,7 @@ public class ValidateLambdaWrapper<T> extends LambdaQueryWrapper<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LambdaQueryWrapper<T> notIn(SFunction<T, ?> column, Object... value) {
|
public LambdaQueryWrapper<T> notIn(SFunction<T, ?> column, Object... value) {
|
||||||
if (this.isIllegal(value)) {
|
if (isIllegal(value)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return super.notIn(column, value);
|
return super.notIn(column, value);
|
||||||
|
|||||||
Reference in New Issue
Block a user