mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
remove: 移除可能出现泛型错误的代码。
This commit is contained in:
parent
24ab62e615
commit
c7089b55b3
@ -27,7 +27,6 @@ import com.mybatisflex.core.util.StringUtil;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.List;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class QueryCondition implements CloneSupport<QueryCondition> {
|
||||
|
||||
@ -126,38 +125,6 @@ public class QueryCondition implements CloneSupport<QueryCondition> {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>动态条件构造。
|
||||
*
|
||||
* <p>推荐将 {@link Predicate} 推断写在填写的值的后面,以确保泛型对应,例如:
|
||||
* <pre>{@code
|
||||
* ACCOUNT.ID.in(idList, CollectionUtil::isNotEmpty);
|
||||
* }</pre>
|
||||
*
|
||||
* @see #when(boolean)
|
||||
* @see #when(BooleanSupplier)
|
||||
* @deprecated 由于 {@link QueryCondition} 中属性 {@link #value} 的类型为 Object
|
||||
* 类型,没有使用泛型,所以该方法泛型推断可能会出现问题。
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> QueryCondition when(Predicate<T> fn) {
|
||||
Object val = this.value;
|
||||
if ((SqlConsts.LIKE.equals(logic) || SqlConsts.NOT_LIKE.equals(logic))
|
||||
&& val instanceof String) {
|
||||
String valStr = (String) val;
|
||||
if (valStr.startsWith(SqlConsts.PERCENT_SIGN)) {
|
||||
valStr = valStr.substring(1);
|
||||
}
|
||||
if (valStr.endsWith(SqlConsts.PERCENT_SIGN)) {
|
||||
valStr = valStr.substring(0, valStr.length() - 1);
|
||||
}
|
||||
val = valStr;
|
||||
}
|
||||
this.effective = fn.test((T) val);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean checkEffective() {
|
||||
return effective;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user