mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 09:38:26 +08:00
optimize QueryCondition.java
This commit is contained in:
parent
61e5657078
commit
4a0b46826a
@ -115,11 +115,13 @@ public class QueryCondition implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void when(Supplier<Boolean> fn) {
|
public void when(Supplier<Boolean> fn) {
|
||||||
this.effective = fn.get();
|
Boolean effective = fn.get();
|
||||||
|
this.effective = (effective != null && effective);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> QueryCondition when(Predicate<T> fn){
|
public <T> QueryCondition when(Predicate<T> fn){
|
||||||
Object val = this.value;
|
Object val = this.value;
|
||||||
if (LOGIC_LIKE.equals(logic)) {
|
if (LOGIC_LIKE.equals(logic) && val instanceof String) {
|
||||||
String valStr = (String) val;
|
String valStr = (String) val;
|
||||||
if (valStr.startsWith("%")) {
|
if (valStr.startsWith("%")) {
|
||||||
valStr = valStr.substring(1);
|
valStr = valStr.substring(1);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user