From 2838731d29a04c2e39c24a714db5ec9c6d1bc3a7 Mon Sep 17 00:00:00 2001 From: yulichang <570810310@qq.com> Date: Sat, 1 Jun 2024 07:00:34 +0800 Subject: [PATCH] 1.4.13 --- .../yulichang/test/join/unit/ApplyFuncTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/ApplyFuncTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/ApplyFuncTest.java index 1b02ca2e..81e011f6 100644 --- a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/ApplyFuncTest.java +++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/ApplyFuncTest.java @@ -39,6 +39,22 @@ void applyFunc() { .list(); list.forEach(System.out::println); + + ThreadLocalUtils.set("SELECT t.pid, t.`name`, t.`json`, t.sex, t.head_img, t.create_time, t.address_id, " + + "t.address_id2, t.del, t.create_by, t.update_by FROM `user` t " + + "LEFT JOIN address t1 ON (t1.user_id = t.id) WHERE t.del = false AND t1.del = false " + + "AND (concat(t.id, t1.user_id, ?) IS NOT NULL " + + "AND concat(t.id, t1.user_id, ?) IS NOT NULL)"); + List list1 = JoinWrappers.lambda(UserDO.class) + .selectAll(UserDO.class, UserDO::getId) + .leftJoin(AddressDO.class, AddressDO::getUserId, UserDO::getId) + .applyFunc("concat(%s,%s,{0}) is not null", arg -> arg.accept(UserDO::getId, AddressDO::getUserId), "12") + .applyFunc("concat(%s,%s,{0}) is not null", arg -> arg.accept( + Fun.f("t", UserDO::getId), + Fun.f("t1", AddressDO::getUserId)), "12") + .list(); + + list1.forEach(System.out::println); } }