From dbc6e79a58b97cc07e05ddda980e7fb4854af149 Mon Sep 17 00:00:00 2001 From: Suomm <1474983351@qq.com> Date: Fri, 11 Aug 2023 10:03:16 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E6=B5=8B=E8=AF=95=20QueryCondition#whe?= =?UTF-8?q?n=20=E6=96=B9=E6=B3=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../coretest/DynamicConditionTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mybatis-flex-core/src/test/java/com/mybatisflex/coretest/DynamicConditionTest.java b/mybatis-flex-core/src/test/java/com/mybatisflex/coretest/DynamicConditionTest.java index 29226386..613f8a57 100644 --- a/mybatis-flex-core/src/test/java/com/mybatisflex/coretest/DynamicConditionTest.java +++ b/mybatis-flex-core/src/test/java/com/mybatisflex/coretest/DynamicConditionTest.java @@ -19,6 +19,9 @@ package com.mybatisflex.coretest; import com.mybatisflex.core.query.QueryWrapper; import org.junit.Test; +import java.util.Arrays; +import java.util.List; + import static com.mybatisflex.coretest.table.AccountTableDef.ACCOUNT; /** @@ -40,4 +43,17 @@ public class DynamicConditionTest { System.out.println(sql); } + @Test + public void test02() { + List idList = Arrays.asList(1, 2, 3); + + String sql = QueryWrapper.create() + .from(ACCOUNT) + .where(ACCOUNT.ID.in(idList).when(false)) + .where(ACCOUNT.ID.in(idList).when(() -> !idList.isEmpty())) + .toSQL(); + + System.out.println(sql); + } + }