From c7a64fc8b406d83907db2fff8b77418213ca270a Mon Sep 17 00:00:00 2001 From: xingyu Date: Thu, 21 Jul 2022 23:16:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=8C=BA=E9=97=B4=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=20betweenIfPresent=20=E6=94=AF=E6=8C=81=E4=BC=A0?= =?UTF-8?q?=E5=85=A5=E6=95=B0=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/mybatis/core/query/QueryWrapperX.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 c5198f855b..1effb19edf 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