diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/QueryWrapperX.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/QueryWrapperX.java index c5198f855..1effb19ed 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/QueryWrapperX.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/QueryWrapperX.java @@ -94,6 +94,19 @@ public class QueryWrapperX extends QueryWrapper { return this; } + public QueryWrapperX betweenIfPresent(String column, Object[] values) { + if (values!= null && values[0] != null && values[1] != null) { + return (QueryWrapperX) super.between(column, values[0], values[1]); + } + if (values!= null && values[0] != null) { + return (QueryWrapperX) ge(column, values[0]); + } + if (values!= null && values[1] != null) { + return (QueryWrapperX) le(column, values[1]); + } + return this; + } + // ========== 重写父类方法,方便链式调用 ========== @Override