mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 01:28:24 +08:00
!11 为QueryCondition.java添加when(Predicate<T>)方法
Merge pull request !11 from 落羽er/main
This commit is contained in:
commit
4ceadd94ef
@ -21,6 +21,7 @@ import com.mybatisflex.core.dialect.IDialect;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class QueryCondition implements Serializable {
|
||||
@ -116,6 +117,10 @@ public class QueryCondition implements Serializable {
|
||||
public void when(Supplier<Boolean> fn) {
|
||||
this.effective = fn.get();
|
||||
}
|
||||
public <T> QueryCondition when(Predicate<T> fn){
|
||||
this.effective = fn.test((T) value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean checkEffective() {
|
||||
return effective;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user