+ *
+ * copy {@link com.baomidou.mybatisplus.core.conditions.interfaces.Func}
+ */
+@SuppressWarnings({"unused", "unchecked"})
+public interface FuncLambda extends Serializable {
+
+ default Children groupBy(SFunction column) {
+ return groupBy(true, column);
+ }
+
+ default Children groupByLambda(List> column) {
+ return groupByLambda(true, column);
+ }
+
+ Children groupByLambda(boolean condition, List> columns);
+
+ Children groupBy(SFunction column, SFunction... columns);
+
+ Children groupBy(boolean condition, SFunction column, SFunction... columns);
+
+
+ default Children orderByAsc(SFunction column) {
+ return orderByAsc(true, column);
+ }
+
+ default Children orderByAscLambda(List> columns) {
+ return orderByAscLambda(true, columns);
+ }
+
+ Children orderByAscLambda(boolean condition, List> columns);
+
+
+ Children orderByAsc(SFunction column, SFunction... columns);
+
+ Children orderByAsc(boolean condition, SFunction column, SFunction... columns);
+
+ default Children orderByDesc(SFunction column) {
+ return orderByDesc(true, column);
+ }
+
+ default Children orderByDescLambda(List> columns) {
+ return orderByDescLambda(true, columns);
+ }
+
+ Children orderByDescLambda(boolean condition, List> columns);
+
+ Children orderByDesc(SFunction column, SFunction... columns);
+
+ Children orderByDesc(boolean condition, SFunction column, SFunction... columns);
+
+ Children orderBy(boolean condition, boolean isAsc, SFunction column, SFunction... columns);
+}
diff --git a/mybatis-plus-join-test/test-base/src/main/java/com/github/yulichang/test/util/EnabledIf.java b/mybatis-plus-join-test/test-base/src/main/java/com/github/yulichang/test/util/EnabledIfConfig.java
similarity index 52%
rename from mybatis-plus-join-test/test-base/src/main/java/com/github/yulichang/test/util/EnabledIf.java
rename to mybatis-plus-join-test/test-base/src/main/java/com/github/yulichang/test/util/EnabledIfConfig.java
index 2c00885..a9402c0 100644
--- a/mybatis-plus-join-test/test-base/src/main/java/com/github/yulichang/test/util/EnabledIf.java
+++ b/mybatis-plus-join-test/test-base/src/main/java/com/github/yulichang/test/util/EnabledIfConfig.java
@@ -3,16 +3,24 @@ package com.github.yulichang.test.util;
import com.baomidou.mybatisplus.annotation.DbType;
@SuppressWarnings("unused")
-public class EnabledIf {
+public class EnabledIfConfig {
+
+ public static final String runWithMysql = "#{T(com.github.yulichang.test.util.EnabledIfConfig).runWithMysql()}";
public static boolean runWithMysql() {
return DbTypeUtil.getDbType() == DbType.MYSQL;
}
+
+ public static final String runWithPgsql = "#{T(com.github.yulichang.test.util.EnabledIfConfig).runWithPgsql()}";
+
public static boolean runWithPgsql() {
return DbTypeUtil.getDbType() == DbType.POSTGRE_SQL;
}
+
+ public static final String runWithExcludingOracle = "#{T(com.github.yulichang.test.util.EnabledIfConfig).runWithExcludingOracle()}";
+
public static boolean runWithExcludingOracle() {
return DbTypeUtil.getDbType() != DbType.ORACLE;
}
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/ApplyFuncTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/ApplyFuncTest.java
new file mode 100644
index 0000000..8006f83
--- /dev/null
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/ApplyFuncTest.java
@@ -0,0 +1,65 @@
+package com.github.yulichang.test.join.apt.unit;
+
+import com.github.yulichang.test.join.entity.AddressDO;
+import com.github.yulichang.test.join.entity.UserDO;
+import com.github.yulichang.test.join.entity.apt.AddressDOCol;
+import com.github.yulichang.test.join.entity.apt.UserDOCol;
+import com.github.yulichang.test.util.Reset;
+import com.github.yulichang.test.util.ThreadLocalUtils;
+import com.github.yulichang.toolkit.JoinWrappers;
+import com.github.yulichang.wrapper.segments.Fun;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.List;
+
+@SpringBootTest
+public class ApplyFuncTest {
+
+
+ @BeforeEach
+ void setUp() {
+ Reset.reset();
+ }
+
+
+ @Test
+ void applyFunc() {
+ ThreadLocalUtils.set("SELECT t.id, 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)");
+ UserDOCol u = new UserDOCol();
+ AddressDOCol addr = new AddressDOCol();
+
+ List list = JoinWrappers.apt(u)
+ .selectAll()
+ .leftJoin(addr, addr.userId, u.id)
+ .applyFunc("concat(%s,%s,{0}) is not null", arg -> arg.accept(u.id, addr.userId), "12")
+ .applyFunc("concat(%s,%s,{0}) is not null", arg -> arg.accept(u.id, addr.userId), "12")
+ .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)");
+
+ UserDOCol u1 = new UserDOCol();
+ AddressDOCol addr1 = new AddressDOCol();
+
+ List list1 = JoinWrappers.apt(u1)
+ .selectAll(u1, u1.id)
+ .leftJoin(addr1, addr1.userId, u1.id)
+ .applyFunc("concat(%s,%s,{0}) is not null", arg -> arg.accept(u1.id, addr1.userId), "12")
+ .applyFunc("concat(%s,%s,{0}) is not null", arg -> arg.accept(u1.id,addr1.userId), "12")
+ .list();
+
+ list1.forEach(System.out::println);
+ }
+
+}
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/AroundTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/AroundTest.java
new file mode 100644
index 0000000..de7767f
--- /dev/null
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/AroundTest.java
@@ -0,0 +1,33 @@
+package com.github.yulichang.test.join.apt.unit;
+
+import com.github.yulichang.test.join.entity.UserDO;
+import com.github.yulichang.test.join.entity.apt.UserDOCol;
+import com.github.yulichang.test.util.Reset;
+import com.github.yulichang.test.util.ThreadLocalUtils;
+import com.github.yulichang.toolkit.JoinWrappers;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.github.yulichang.wrapper.apt.AptQueryWrapper;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+public class AroundTest {
+
+ @BeforeEach
+ void setUp() {
+ Reset.reset();
+ }
+
+
+ @Test
+ void around() {
+ ThreadLocalUtils.set("SELECT * FROM (SELECT t.id, 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 WHERE t.del = false) tmp");
+ UserDOCol u = new UserDOCol();
+ AptQueryWrapper wrapper = JoinWrappers.apt(u)
+ .around("select * from (", ") tmp");
+ wrapper.list().forEach(System.out::println);
+ }
+
+}
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/ChineseFieldTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/ChineseFieldTest.java
new file mode 100644
index 0000000..875713e
--- /dev/null
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/ChineseFieldTest.java
@@ -0,0 +1,22 @@
+package com.github.yulichang.test.join.apt.unit;
+
+import com.github.yulichang.test.join.entity.UserTenantaDO;
+import com.github.yulichang.test.join.entity.apt.UserTenantDOCol;
+import com.github.yulichang.test.join.entity.apt.UserTenantaDOCol;
+import com.github.yulichang.toolkit.JoinWrappers;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.List;
+
+@SpringBootTest
+public class ChineseFieldTest {
+
+ @Test
+ void chineseField() {
+ UserTenantaDOCol ut = new UserTenantaDOCol();
+ List list = JoinWrappers.apt(ut).list();
+ assert list.get(0).getDetail() != null;
+ list.forEach(System.out::println);
+ }
+}
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/CustomWrapperTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/CustomWrapperTest.java
new file mode 100644
index 0000000..6602000
--- /dev/null
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/CustomWrapperTest.java
@@ -0,0 +1,74 @@
+package com.github.yulichang.test.join.apt.unit;
+
+import com.github.yulichang.apt.BaseColumn;
+import com.github.yulichang.apt.Column;
+import com.github.yulichang.test.join.entity.UserDO;
+import com.github.yulichang.test.join.entity.apt.UserDOCol;
+import com.github.yulichang.test.join.mapper.UserMapper;
+import com.github.yulichang.test.util.Reset;
+import com.github.yulichang.test.util.ThreadLocalUtils;
+import com.github.yulichang.toolkit.Ref;
+import com.github.yulichang.wrapper.apt.AptQueryWrapper;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.List;
+import java.util.Objects;
+
+@SpringBootTest
+public class CustomWrapperTest {
+
+ @Autowired
+ private UserMapper userMapper;
+
+ @BeforeEach
+ void setUp() {
+ Reset.reset();
+ }
+
+
+ //自定义wrapper扩展
+ public static class CWrapper extends AptQueryWrapper {
+
+ public CWrapper(BaseColumn baseColumn) {
+ super(baseColumn);
+ }
+
+ public CWrapper(BaseColumn baseColumn, T entity) {
+ super(baseColumn, entity);
+ }
+
+ public static CWrapper toCWrapper() {
+ return null;
+ }
+
+ @Override
+ public CWrapper eqIfExists(Column column, Object val) {
+ super.eq(Objects.nonNull(val), column, val);
+ return this;
+ }
+ }
+
+ @Test
+ void testWrapperCustomer() {
+ ThreadLocalUtils.set("SELECT t.id, 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 WHERE t.del = false AND (t.id = ?)");
+ UserDOCol u = new UserDOCol();
+ CWrapper wrapper = new CWrapper<>(u)
+ .selectAll()
+ .toChildren(CWrapper::toCWrapper)
+ .eqIfExists(u.id, 1);
+ List dos = userMapper.selectList(wrapper);
+ dos.forEach(System.out::println);
+
+ UserDOCol u1 = new UserDOCol();
+ ThreadLocalUtils.set("SELECT t.id, 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 WHERE t.del = false");
+ CWrapper wrapper1 = new CWrapper<>(u1)
+ .selectAll()
+ .toChildren(new Ref>())
+ .eqIfExists(u1.id, null);
+ List dos1 = userMapper.selectList(wrapper1);
+ dos1.forEach(System.out::println);
+ }
+}
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/EqSqlTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/EqSqlTest.java
new file mode 100644
index 0000000..15b2580
--- /dev/null
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/EqSqlTest.java
@@ -0,0 +1,34 @@
+package com.github.yulichang.test.join.apt.unit;
+
+import com.github.yulichang.test.join.entity.UserDO;
+import com.github.yulichang.test.join.entity.apt.UserDOCol;
+import com.github.yulichang.test.util.Reset;
+import com.github.yulichang.test.util.ThreadLocalUtils;
+import com.github.yulichang.toolkit.JoinWrappers;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+public class EqSqlTest {
+
+ @BeforeEach
+ void setUp() {
+ Reset.reset();
+ }
+
+
+ @Test
+ void eqSql() {
+ ThreadLocalUtils.set("SELECT t.id, 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 WHERE t.del = false AND (t.id = (SELECT id FROM `user` WHERE id = 1))");
+ UserDOCol u = new UserDOCol();
+ JoinWrappers.apt(u).eqSql(u.id, "select id from `user` where id = 1").list();
+
+ ThreadLocalUtils.set("SELECT t.id, 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 WHERE t.del = false AND (t.id = (SELECT id FROM `user` WHERE id = 1))");
+ UserDOCol u1 = new UserDOCol();
+ JoinWrappers.apt(u1).eqSql("t.id", "select id from `user` where id = 1").list();
+ }
+
+}
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/FieldAliasTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/FieldAliasTest.java
new file mode 100644
index 0000000..225247f
--- /dev/null
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/FieldAliasTest.java
@@ -0,0 +1,61 @@
+package com.github.yulichang.test.join.apt.unit;
+
+import com.github.yulichang.test.join.entity.UserDO;
+import com.github.yulichang.test.join.entity.UserTenantDO;
+import com.github.yulichang.test.join.entity.apt.AddressDOCol;
+import com.github.yulichang.test.join.entity.apt.UserDOCol;
+import com.github.yulichang.test.join.entity.apt.UserTenantDOCol;
+import com.github.yulichang.test.join.mapper.UserMapper;
+import com.github.yulichang.test.join.mapper.UserTenantMapper;
+import com.github.yulichang.test.util.Reset;
+import com.github.yulichang.toolkit.JoinWrappers;
+import com.github.yulichang.wrapper.apt.AptQueryWrapper;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.List;
+
+@SpringBootTest
+public class FieldAliasTest {
+
+ @Autowired
+ private UserMapper userMapper;
+
+ @Autowired
+ private UserTenantMapper userTenantMapper;
+
+ @BeforeEach
+ void setUp() {
+ Reset.reset();
+ }
+
+
+ @Test
+ void fieldAlias() {
+ UserDOCol u = new UserDOCol();
+ AddressDOCol addr = new AddressDOCol();
+ List list = userMapper.selectList(JoinWrappers.apt(u)
+ .selectAll()
+ .leftJoin(addr, addr.userId, u.id));
+
+ list.forEach(System.out::println);
+
+ assert list.get(0).getImg() != null;
+
+ }
+
+ @Test
+ void fieldAlias1() {
+ UserTenantDOCol ut = new UserTenantDOCol();
+ UserDOCol u = new UserDOCol();
+ AptQueryWrapper wrapper = JoinWrappers.apt(ut)
+ .selectAll()
+ .leftJoin(u, u.id, ut.uuid);
+ List list = userTenantMapper.selectList(wrapper);
+
+ assert list.get(0).getIdea() != null;
+ assert list.get(0).getUuid() != null;
+ }
+}
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/FieldNameTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/FieldNameTest.java
new file mode 100644
index 0000000..e42925f
--- /dev/null
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/FieldNameTest.java
@@ -0,0 +1,50 @@
+package com.github.yulichang.test.join.apt.unit;
+
+import com.github.yulichang.test.join.dto.AreaDTO;
+import com.github.yulichang.test.join.entity.AreaDO;
+import com.github.yulichang.test.join.entity.apt.AreaDOCol;
+import com.github.yulichang.test.join.entity.apt.UserDtoCol;
+import com.github.yulichang.test.join.mapper.AreaMapper;
+import com.github.yulichang.test.util.Reset;
+import com.github.yulichang.toolkit.JoinWrappers;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.List;
+
+@SpringBootTest
+public class FieldNameTest {
+
+ @Autowired
+ private AreaMapper areaMapper;
+
+ @BeforeEach
+ void setUp() {
+ Reset.reset();
+ }
+
+
+ @Test
+ void testFieldName() {
+ AreaDOCol ar = new AreaDOCol();
+ UserDtoCol ud = new UserDtoCol();
+ List list = areaMapper.selectJoinList(AreaDO.class, JoinWrappers.apt(ar)
+ .select(ar.Postcode)
+ .leftJoin(ud, ud.id, ar.id));
+
+ assert list.get(0).getPostcode() != null;
+ }
+
+ @Test
+ void testFieldName1() {
+ AreaDOCol ar = new AreaDOCol();
+ UserDtoCol ud = new UserDtoCol();
+ List list = areaMapper.selectJoinList(AreaDTO.class, JoinWrappers.apt(ar)
+ .selectAs(ar.Postcode, AreaDTO::getPostcode)
+ .leftJoin(ud, ud.id, ar.id));
+
+ assert list.get(0).getPostcode() != null;
+ }
+}
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/IfExistsTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/IfExistsTest.java
new file mode 100644
index 0000000..0820496
--- /dev/null
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/IfExistsTest.java
@@ -0,0 +1,88 @@
+package com.github.yulichang.test.join.apt.unit;
+
+import com.github.yulichang.config.enums.IfExistsEnum;
+import com.github.yulichang.test.join.entity.UserDO;
+import com.github.yulichang.test.join.entity.apt.UserDOCol;
+import com.github.yulichang.test.util.Reset;
+import com.github.yulichang.test.util.ThreadLocalUtils;
+import com.github.yulichang.toolkit.JoinWrappers;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.github.yulichang.wrapper.apt.AptQueryWrapper;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.List;
+
+@SpringBootTest
+public class IfExistsTest {
+
+ @BeforeEach
+ void setUp() {
+ Reset.reset();
+ }
+
+ @Test
+ void IfExists() {
+ assert IfExistsEnum.NOT_EMPTY.test("\t");
+ assert !IfExistsEnum.NOT_EMPTY.test("");
+ assert IfExistsEnum.NOT_EMPTY.test(" ");
+ assert IfExistsEnum.NOT_EMPTY.test("\r");
+ assert IfExistsEnum.NOT_EMPTY.test("a");
+ assert IfExistsEnum.NOT_EMPTY.test(1);
+ assert IfExistsEnum.NOT_EMPTY.test(true);
+ assert IfExistsEnum.NOT_EMPTY.test('A');
+
+ assert !IfExistsEnum.NOT_BLANK.test("\t");
+ assert !IfExistsEnum.NOT_BLANK.test("");
+ assert !IfExistsEnum.NOT_BLANK.test(" ");
+ assert !IfExistsEnum.NOT_BLANK.test("\r");
+ assert IfExistsEnum.NOT_BLANK.test("a");
+ assert IfExistsEnum.NOT_EMPTY.test(1);
+ assert IfExistsEnum.NOT_EMPTY.test(true);
+ assert IfExistsEnum.NOT_EMPTY.test('A');
+
+ ThreadLocalUtils.set("SELECT t.id, 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 " +
+ "WHERE t.del = false AND (t.id = ? AND t.head_img = ? AND t.`name` = ?)");
+ UserDOCol u = new UserDOCol();
+ AptQueryWrapper wrapper = JoinWrappers.apt(u)
+ .selectAll()
+ .eqIfExists(u.id, 1)
+ .eqIfExists(u.pid, null)
+ .eqIfExists(u.addressId, "")
+ .eqIfExists(u.img, "\t")
+ .eqIfExists(u.name, "张三 1");
+ List list = wrapper.list();
+ list.forEach(System.out::println);
+
+ ThreadLocalUtils.set("SELECT t.id, 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 " +
+ "WHERE t.del = false AND (t.id = ? AND t.`name` = ?)");
+ UserDOCol u1 = new UserDOCol();
+ AptQueryWrapper wrapper1 = JoinWrappers.apt(u1)
+ .selectAll()
+ .setIfExists(IfExistsEnum.NOT_BLANK)
+ .eqIfExists(u1.id, 1)
+ .eqIfExists(u1.pid, null)
+ .eqIfExists(u1.addressId, "")
+ .eqIfExists(u1.img, "\t")
+ .eqIfExists(u1.name, "张三 1");
+ List list1 = wrapper1.list();
+ list1.forEach(System.out::println);
+
+ ThreadLocalUtils.set("SELECT t.id, 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 " +
+ "WHERE t.del = false AND (t.id = ? AND t.`name` = ? AND t.head_img = ? AND t.`name` = ?)");
+ UserDOCol u2 = new UserDOCol();
+ AptQueryWrapper wrapper2 = JoinWrappers.apt(u2)
+ .selectAll()
+ .setIfExists(o -> true)
+ .eqIfExists(u2.id, 1)
+ .eqIfExists(u2.name, "")
+ .eqIfExists(u2.img, "\t")
+ .eqIfExists(u2.name, "张三 1");
+ List list2 = wrapper2.list();
+ list2.forEach(System.out::println);
+ }
+}
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/NotLikeLeftRightTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/NotLikeLeftRightTest.java
new file mode 100644
index 0000000..8bf8b70
--- /dev/null
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/NotLikeLeftRightTest.java
@@ -0,0 +1,44 @@
+package com.github.yulichang.test.join.apt.unit;
+
+import com.github.yulichang.test.join.entity.UserDO;
+import com.github.yulichang.test.join.entity.apt.UserDOCol;
+import com.github.yulichang.test.util.Reset;
+import com.github.yulichang.test.util.ThreadLocalUtils;
+import com.github.yulichang.toolkit.JoinWrappers;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.github.yulichang.wrapper.apt.AptQueryWrapper;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.List;
+
+@SpringBootTest
+public class NotLikeLeftRightTest {
+
+ @BeforeEach
+ void setUp() {
+ Reset.reset();
+ }
+
+ @Test
+ void notLikeLeftRight() {
+ ThreadLocalUtils.set("SELECT t.id, 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 WHERE t.del = false AND (t.`name` NOT LIKE ?)");
+ UserDOCol u = new UserDOCol();
+ AptQueryWrapper wrapper = JoinWrappers.apt(u)
+ .selectAll()
+ .notLikeLeft(u.name, "aa");
+ List list = wrapper.list();
+ list.forEach(System.out::println);
+
+ ThreadLocalUtils.set("SELECT t.id, 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 WHERE t.del = false AND (t.`name` NOT LIKE ?)");
+ UserDOCol u1 = new UserDOCol();
+ AptQueryWrapper wrapper1 = JoinWrappers.apt(u1)
+ .selectAll()
+ .notLikeRight(u1.name, "aa");
+ List list1 = wrapper1.list();
+ list1.forEach(System.out::println);
+ }
+}
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/OrderByTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/OrderByTest.java
new file mode 100644
index 0000000..850c58a
--- /dev/null
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/OrderByTest.java
@@ -0,0 +1,81 @@
+package com.github.yulichang.test.join.apt.unit;
+
+import com.github.yulichang.apt.Column;
+import com.github.yulichang.test.join.dto.UserDTO;
+import com.github.yulichang.test.join.entity.UserDO;
+import com.github.yulichang.test.join.entity.apt.AddressDOCol;
+import com.github.yulichang.test.join.entity.apt.UserDOCol;
+import com.github.yulichang.test.util.EnabledIfConfig;
+import com.github.yulichang.test.util.Reset;
+import com.github.yulichang.test.util.ThreadLocalUtils;
+import com.github.yulichang.toolkit.JoinWrappers;
+import com.github.yulichang.wrapper.apt.AptQueryWrapper;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit.jupiter.EnabledIf;
+
+import java.util.Arrays;
+import java.util.List;
+
+@SpringBootTest
+@EnabledIf(value = EnabledIfConfig.runWithExcludingOracle,loadContext = true)
+public class OrderByTest {
+
+ @BeforeEach
+ void setUp() {
+ Reset.reset();
+ }
+
+ @Test
+ void orderBy() {
+ ThreadLocalUtils.set("SELECT t.id, 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 WHERE t.del = false AND (t.id = ?) ORDER BY t.id ASC, t.`name` ASC, t.pid ASC");
+ UserDOCol u = new UserDOCol();
+ List columList = Arrays.asList(u.id, u.name, u.pid);
+
+ AptQueryWrapper wrapper = JoinWrappers.apt(u)
+ .selectAll()
+ .eq(u.id, 1)
+ .orderByAsc(columList);
+
+
+ List list = wrapper.list();
+ list.forEach(System.out::println);
+ }
+
+ @Test
+ void orderBy1() {
+ ThreadLocalUtils.set("SELECT t.id, 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 WHERE t.del = false AND (t.id = ?) GROUP BY t.id, t.`name`, t.pid");
+ UserDOCol u = new UserDOCol();
+ List columList = Arrays.asList(u.id, u.name, u.pid);
+
+ AptQueryWrapper wrapper = JoinWrappers.apt(u)
+ .selectAll()
+ .eq(u.id, 1)
+ .groupBy(columList);
+
+
+ List list = wrapper.list();
+ list.forEach(System.out::println);
+ }
+
+
+ @Test
+ void orderBy2() {
+ UserDOCol u = new UserDOCol();
+ AddressDOCol addr = new AddressDOCol();
+
+ AptQueryWrapper wrapper = JoinWrappers.apt(u)
+ .selectAll()
+ .selectAs(addr.id, UserDTO::getAddress)
+ .leftJoin(addr, addr.userId, u.id)
+ .orderByAsc(UserDTO::getAddress);
+
+
+ List list = wrapper.list();
+ list.forEach(System.out::println);
+ }
+
+}
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/SelectSubTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/SelectSubTest.java
new file mode 100644
index 0000000..96e86c1
--- /dev/null
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/SelectSubTest.java
@@ -0,0 +1,67 @@
+package com.github.yulichang.test.join.apt.unit;
+
+import com.github.yulichang.test.join.entity.AddressDO;
+import com.github.yulichang.test.join.entity.AreaDO;
+import com.github.yulichang.test.join.entity.UserDO;
+import com.github.yulichang.test.util.EnabledIfConfig;
+import com.github.yulichang.test.util.Reset;
+import com.github.yulichang.test.util.ThreadLocalUtils;
+import com.github.yulichang.toolkit.JoinWrappers;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit.jupiter.EnabledIf;
+
+@SpringBootTest
+@EnabledIf(value = EnabledIfConfig.runWithExcludingOracle, loadContext = true)
+public class SelectSubTest {
+
+ @BeforeEach
+ void setUp() {
+ Reset.reset();
+ }
+
+
+ /**
+ * select 子查询
+ */
+ @Test
+ void sub() {
+ ThreadLocalUtils.set("SELECT (SELECT st.id FROM `user` st WHERE st.del = false AND (st.id = t.id AND st.id = ?) LIMIT 1) AS id, (SELECT st.id FROM `user` st WHERE st.del = false AND (st.id = t.id AND st.id = ?) LIMIT 1) AS name FROM `user` t LEFT JOIN address t1 ON (t1.user_id = t.id) WHERE t.del = false AND t1.del = false AND (t.id <= ?)");
+ MPJLambdaWrapper wrapper = JoinWrappers.lambda(UserDO.class)
+ .selectSub(UserDO.class, w -> w.select(UserDO::getId)
+ .eq(UserDO::getId, UserDO::getId)
+ .eq(UserDO::getId, 2)
+ .last("limit 1"), UserDO::getId)
+ .selectSub(UserDO.class, w -> w.select(UserDO::getId)
+ .eq(UserDO::getId, UserDO::getId)
+ .eq(UserDO::getId, 3)
+ .last("limit 1"), UserDO::getName)
+ .leftJoin(AddressDO.class, AddressDO::getUserId, UserDO::getId)
+ .le(UserDO::getId, 100);
+ wrapper.list();
+
+ ThreadLocalUtils.set("SELECT (SELECT st.id FROM area st WHERE st.del = false AND (st.id = t1.id) LIMIT 1) AS id FROM `user` t LEFT JOIN address t1 ON (t1.user_id = t.id) WHERE t.del = false AND t1.del = false AND (t.id <= ?)");
+ MPJLambdaWrapper wrapper1 = JoinWrappers.lambda(UserDO.class)
+ .selectSub(AreaDO.class, w -> w.select(AreaDO::getId)
+ .eq(AreaDO::getId, AddressDO::getId)
+ .last("limit 1"), UserDO::getId)
+ .leftJoin(AddressDO.class, AddressDO::getUserId, UserDO::getId)
+ .le(UserDO::getId, 100);
+ wrapper1.list();
+ }
+
+ @Test
+ void sub1() {
+ ThreadLocalUtils.set("SELECT (SELECT st.id FROM `area` st WHERE st.del = false AND (st.id = t1.id) LIMIT 1) AS id FROM `user` t LEFT JOIN address t1 ON (t1.user_id = t.id) WHERE t.del = false AND t1.del = false AND (t.id <= ?)");
+ MPJLambdaWrapper wrapper1 = JoinWrappers.lambda(UserDO.class)
+ .selectSub(AreaDO.class, w -> w.select(AreaDO::getId)
+ .eq(AreaDO::getId, AddressDO::getId)
+ .setTableName(t -> "`" + t + "`")
+ .last("limit 1"), UserDO::getId)
+ .leftJoin(AddressDO.class, AddressDO::getUserId, UserDO::getId)
+ .le(UserDO::getId, 100);
+ wrapper1.list();
+ }
+}
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/StringColumTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/StringColumTest.java
new file mode 100644
index 0000000..a0d8ea8
--- /dev/null
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/StringColumTest.java
@@ -0,0 +1,49 @@
+package com.github.yulichang.test.join.apt.unit;
+
+import com.github.yulichang.test.join.dto.UserDTO;
+import com.github.yulichang.test.join.entity.apt.AddressDOCol;
+import com.github.yulichang.test.join.entity.apt.UserDOCol;
+import com.github.yulichang.test.join.mapper.UserMapper;
+import com.github.yulichang.test.util.Reset;
+import com.github.yulichang.test.util.ThreadLocalUtils;
+import com.github.yulichang.wrapper.apt.AptQueryWrapper;
+import lombok.SneakyThrows;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@SpringBootTest
+public class StringColumTest {
+
+ @Resource
+ private UserMapper userMapper;
+
+ @BeforeEach
+ void setUp() {
+ Reset.reset();
+ }
+
+
+ @Test
+ @SneakyThrows
+ void stringColum() {
+ ThreadLocalUtils.set("SELECT (SELECT id FROM `user` u WHERE u.id = t.id) id, t.`name` AS PName, t.`name` PName, t.`name`," +
+ " (SELECT id FROM `user` u WHERE u.id = t.id), t1.id AS joina_id, t1.user_id, t1.area_id, t1.tel, " +
+ "t1.address, t1.del FROM `user` t LEFT JOIN address t1 ON (t1.user_id = t.id) WHERE t.del = false AND t1.del = false");
+ UserDOCol u = new UserDOCol();
+ AddressDOCol addr = new AddressDOCol();
+ List l3 = userMapper.selectJoinList(UserDTO.class, new AptQueryWrapper<>(u)
+ .select("(select id from `user` u where u.id = t.id) id")
+ .select("t.`name` as PName")
+ .select("t.`name` PName")
+ .select("t.`name`")
+ .select("(select id from `user` u where u.id = t.id) ")
+ .selectAssociation(addr, UserDTO::getAddressDTO)
+ .leftJoin(addr, addr.userId, u.id));
+ assert l3.get(0).getPName() != null;
+ l3.forEach(System.out::println);
+ }
+}
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/TableAliasTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/TableAliasTest.java
new file mode 100644
index 0000000..c74afd6
--- /dev/null
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/TableAliasTest.java
@@ -0,0 +1,123 @@
+package com.github.yulichang.test.join.apt.unit;
+
+import com.github.yulichang.test.join.entity.UserDO;
+import com.github.yulichang.test.join.entity.apt.AddressDOCol;
+import com.github.yulichang.test.join.entity.apt.AreaDOCol;
+import com.github.yulichang.test.join.entity.apt.UserDOCol;
+import com.github.yulichang.test.join.mapper.UserMapper;
+import com.github.yulichang.test.util.EnabledIfConfig;
+import com.github.yulichang.test.util.Reset;
+import com.github.yulichang.test.util.ThreadLocalUtils;
+import com.github.yulichang.toolkit.JoinWrappers;
+import com.github.yulichang.wrapper.apt.AptQueryWrapper;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit.jupiter.EnabledIf;
+
+import java.util.List;
+
+@SpringBootTest
+@EnabledIf(value = EnabledIfConfig.runWithExcludingOracle, loadContext = true)
+public class TableAliasTest {
+
+ @Autowired
+ private UserMapper userMapper;
+
+ @BeforeEach
+ void setUp() {
+ Reset.reset();
+ }
+
+ @Test
+ void tableAlias() {
+ ThreadLocalUtils.set("SELECT t.id, 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 addr1 ON (addr1.id = t.address_id) " +
+ "LEFT JOIN address addr2 ON (addr2.id = t.address_id2) " +
+ "LEFT JOIN area area1 ON (area1.id = addr1.area_id) " +
+ "WHERE t.del = false AND addr1.del = false AND addr2.del = false AND area1.del = false " +
+ "GROUP BY t.id");
+ UserDOCol u = new UserDOCol();
+ AddressDOCol addr1 = new AddressDOCol("addr1");
+ AddressDOCol addr2 = new AddressDOCol("addr2");
+ AreaDOCol area1 = new AreaDOCol("area1");
+
+ AptQueryWrapper wrapper = JoinWrappers.apt(u)
+ .selectAll()
+ .leftJoin(addr1, addr1.id, u.addressId)
+ .leftJoin(addr2, addr2.id, u.addressId2)
+ .leftJoin(area1, area1.id, addr1.areaId)
+ .groupBy(u.id);
+
+ List dos = userMapper.selectJoinList(UserDO.class, wrapper);
+ dos.forEach(System.out::println);
+ }
+
+ @Test
+ void tableAlias2() {
+ ThreadLocalUtils.set("SELECT t.id, 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 addr1 ON (addr1.id = t.address_id) " +
+ "LEFT JOIN address addr2 ON (addr2.id = t.address_id2) " +
+ "LEFT JOIN area area1 ON (area1.id = addr2.area_id) " +
+ "WHERE t.del = false AND addr1.del = false AND addr2.del = false AND area1.del = false " +
+ "GROUP BY t.id,addr1.id ORDER BY addr1.id DESC");
+
+ UserDOCol u = new UserDOCol();
+ AddressDOCol addr1 = new AddressDOCol("addr1");
+ AddressDOCol addr2 = new AddressDOCol("addr2");
+ AreaDOCol area1 = new AreaDOCol("area1");
+
+ AptQueryWrapper wrapper = JoinWrappers.apt(u)
+ .selectAll()
+ .leftJoin(addr1, addr1.id, u.addressId)
+ .leftJoin(addr2, addr2.id, u.addressId2)
+ .leftJoin(area1, area1.id, addr2.areaId)
+ .groupBy(u.id)
+ .groupBy(addr1.id)
+ .orderByDesc(addr1.id);
+
+ List dos = userMapper.selectJoinList(UserDO.class, wrapper);
+ dos.forEach(System.out::println);
+ }
+
+
+ @Test
+ void tableAliasEQ() {
+ ThreadLocalUtils.set("SELECT t.id, 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 addr1 ON (addr1.id = t.address_id) " +
+ "LEFT JOIN address addr2 ON (addr2.id = t.address_id2) " +
+ "LEFT JOIN area area1 ON (area1.id = addr2.area_id) WHERE t.del = false AND addr1.del = false AND addr2.del = false AND area1.del = false " +
+ "AND (addr1.id = ? AND addr2.id = ? AND addr1.id = ?)");
+
+ UserDOCol u = new UserDOCol();
+ AddressDOCol addr1 = new AddressDOCol("addr1");
+ AddressDOCol addr2 = new AddressDOCol("addr2");
+ AreaDOCol area1 = new AreaDOCol("area1");
+
+ AptQueryWrapper wrapper = JoinWrappers.apt(u)
+ .selectAll()
+ .leftJoin(addr1, addr1.id, u.addressId)
+ .leftJoin(addr2, addr2.id, u.addressId2)
+ .leftJoin(area1, area1.id, addr2.areaId)
+ .eq(addr1.id, 1)
+ .eq(addr2.id, 2)
+ .eq(addr1.id, 3);
+
+ List dos = userMapper.selectJoinList(UserDO.class, wrapper);
+ dos.forEach(System.out::println);
+ }
+
+ @Test
+ void tableAlias3() {
+ ThreadLocalUtils.set("SELECT aaa.id, aaa.pid, aaa.`name`, aaa.`json`, aaa.sex, aaa.head_img, aaa.create_time, " +
+ "aaa.address_id, aaa.address_id2, aaa.del, aaa.create_by, aaa.update_by FROM `user` aaa WHERE aaa.`name` = ? AND aaa.del = false");
+
+ UserDOCol u = new UserDOCol("aaa");
+
+ UserDO userDO = new UserDO();
+ userDO.setName("aaa");
+ AptQueryWrapper wrapper = JoinWrappers.apt(u, userDO);
+ wrapper.list();
+ }
+}
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/UnionTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/UnionTest.java
new file mode 100644
index 0000000..90debe9
--- /dev/null
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/apt/unit/UnionTest.java
@@ -0,0 +1,45 @@
+package com.github.yulichang.test.join.apt.unit;
+
+import com.github.yulichang.test.join.entity.AddressDO;
+import com.github.yulichang.test.join.entity.AreaDO;
+import com.github.yulichang.test.join.entity.UserDO;
+import com.github.yulichang.test.util.Reset;
+import com.github.yulichang.test.util.ThreadLocalUtils;
+import com.github.yulichang.toolkit.JoinWrappers;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.List;
+
+@SpringBootTest
+public class UnionTest {
+
+ @BeforeEach
+ void setUp() {
+ Reset.reset();
+ }
+
+
+ @Test
+ void unionAll1() {
+ ThreadLocalUtils.set("SELECT t.id FROM `user` t WHERE t.del = false AND (t.id = ?) UNION ALL SELECT t.id FROM address t WHERE (t.id = ?) UNION ALL SELECT (SELECT st.id FROM area st WHERE st.del = false AND (st.id = ? AND (st.id = ?))) AS id FROM area t WHERE t.del = false AND (t.id = ? AND (t.id = ?))");
+ MPJLambdaWrapper wrapper = JoinWrappers.lambda(UserDO.class)
+ .select(UserDO::getId)
+ .eq(UserDO::getId, 1)
+ .unionAll(AddressDO.class, union -> union
+ .select(AddressDO::getId)
+ .disableLogicDel()
+ .eq(UserDO::getId, 2))
+ .unionAll(AreaDO.class, union -> union
+ .selectSub(AreaDO.class, sub -> sub
+ .select(AreaDO::getId)
+ .eq(AreaDO::getId, 3)
+ .and(and -> and.eq(AreaDO::getId, 4)), AreaDO::getId)
+ .eq(AreaDO::getId, 5)
+ .and(and -> and.eq(AreaDO::getId, 6)));
+ List list = wrapper.list();
+ assert list.size() == 2 && list.get(0).getId() != null;
+ }
+}
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/mysql/DeleteJoinTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/mysql/DeleteJoinTest.java
index d0462a3..04b03ef 100644
--- a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/mysql/DeleteJoinTest.java
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/mysql/DeleteJoinTest.java
@@ -3,22 +3,23 @@ package com.github.yulichang.test.join.mysql;
import com.github.yulichang.test.join.entity.*;
import com.github.yulichang.test.join.mapper.OrderMapper;
import com.github.yulichang.test.join.mapper.UserMapper;
+import com.github.yulichang.test.util.EnabledIfConfig;
import com.github.yulichang.test.util.Reset;
import com.github.yulichang.test.util.ThreadLocalUtils;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.DeleteJoinWrapper;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledIf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit.jupiter.EnabledIf;
/**
* 连表删除没有同意语法语法,不同数据库差别较大
* MPJ 连表更新 目前只支持 mysql
*/
@SpringBootTest("spring.profiles.active=mysql")
-@EnabledIf("com.github.yulichang.test.util.EnabledIf#runWithMysql")
+@EnabledIf(value = EnabledIfConfig.runWithMysql, loadContext = true)
public class DeleteJoinTest {
@Autowired
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/mysql/MysqlTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/mysql/MysqlTest.java
index aa891f3..3d1f742 100644
--- a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/mysql/MysqlTest.java
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/mysql/MysqlTest.java
@@ -3,22 +3,23 @@ package com.github.yulichang.test.join.mysql;
import com.github.yulichang.test.join.entity.AddressDO;
import com.github.yulichang.test.join.entity.UserDO;
import com.github.yulichang.test.join.mapper.UserMapper;
+import com.github.yulichang.test.util.EnabledIfConfig;
import com.github.yulichang.test.util.Reset;
import com.github.yulichang.test.util.ThreadLocalUtils;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.github.yulichang.wrapper.segments.Fun;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledIf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit.jupiter.EnabledIf;
/**
* 由于不同数据库函数支持情况不同
* 此类用于测试 mysql 专属语法或函数
*/
@SpringBootTest("spring.profiles.active=mysql")
-@EnabledIf("com.github.yulichang.test.util.EnabledIf#runWithMysql")
+@EnabledIf(value = EnabledIfConfig.runWithMysql, loadContext = true)
public class MysqlTest {
@Autowired
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/mysql/UpdateJoinTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/mysql/UpdateJoinTest.java
index 6a720c2..142c19e 100644
--- a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/mysql/UpdateJoinTest.java
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/mysql/UpdateJoinTest.java
@@ -6,15 +6,16 @@ import com.github.yulichang.test.join.entity.AddressDO;
import com.github.yulichang.test.join.entity.OrderDO;
import com.github.yulichang.test.join.entity.UserDO;
import com.github.yulichang.test.join.mapper.UserMapper;
+import com.github.yulichang.test.util.EnabledIfConfig;
import com.github.yulichang.test.util.Reset;
import com.github.yulichang.test.util.ThreadLocalUtils;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.UpdateJoinWrapper;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledIf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit.jupiter.EnabledIf;
import java.util.HashMap;
import java.util.List;
@@ -24,7 +25,7 @@ import java.util.List;
* MPJ 连表更新 目前只支持 mysql
*/
@SpringBootTest("spring.profiles.active=mysql")
-@EnabledIf("com.github.yulichang.test.util.EnabledIf#runWithMysql")
+@EnabledIf(value = EnabledIfConfig.runWithMysql,loadContext = true)
public class UpdateJoinTest {
@Autowired
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/OrderByTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/OrderByTest.java
index 035dd05..244d0f8 100644
--- a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/OrderByTest.java
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/OrderByTest.java
@@ -4,20 +4,21 @@ import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.github.yulichang.test.join.dto.UserDTO;
import com.github.yulichang.test.join.entity.AddressDO;
import com.github.yulichang.test.join.entity.UserDO;
+import com.github.yulichang.test.util.EnabledIfConfig;
import com.github.yulichang.test.util.Reset;
import com.github.yulichang.test.util.ThreadLocalUtils;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledIf;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit.jupiter.EnabledIf;
import java.util.Arrays;
import java.util.List;
@SpringBootTest
-@EnabledIf("com.github.yulichang.test.util.EnabledIf#runWithExcludingOracle")
+@EnabledIf(value = EnabledIfConfig.runWithExcludingOracle, loadContext = true)
public class OrderByTest {
@BeforeEach
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/SelectSubTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/SelectSubTest.java
index 6b5fe4f..f28c8e7 100644
--- a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/SelectSubTest.java
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/SelectSubTest.java
@@ -3,17 +3,18 @@ package com.github.yulichang.test.join.unit;
import com.github.yulichang.test.join.entity.AddressDO;
import com.github.yulichang.test.join.entity.AreaDO;
import com.github.yulichang.test.join.entity.UserDO;
+import com.github.yulichang.test.util.EnabledIfConfig;
import com.github.yulichang.test.util.Reset;
import com.github.yulichang.test.util.ThreadLocalUtils;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledIf;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit.jupiter.EnabledIf;
@SpringBootTest
-@EnabledIf("com.github.yulichang.test.util.EnabledIf#runWithExcludingOracle")
+@EnabledIf(value = EnabledIfConfig.runWithExcludingOracle, loadContext = true)
public class SelectSubTest {
@BeforeEach
diff --git a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/TableAliasTest.java b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/TableAliasTest.java
index 3a09d6e..58eafbc 100644
--- a/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/TableAliasTest.java
+++ b/mybatis-plus-join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/TableAliasTest.java
@@ -4,20 +4,21 @@ import com.github.yulichang.test.join.entity.AddressDO;
import com.github.yulichang.test.join.entity.AreaDO;
import com.github.yulichang.test.join.entity.UserDO;
import com.github.yulichang.test.join.mapper.UserMapper;
+import com.github.yulichang.test.util.EnabledIfConfig;
import com.github.yulichang.test.util.Reset;
import com.github.yulichang.test.util.ThreadLocalUtils;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledIf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit.jupiter.EnabledIf;
import java.util.List;
@SpringBootTest
-@EnabledIf("com.github.yulichang.test.util.EnabledIf#runWithExcludingOracle")
+@EnabledIf(value = EnabledIfConfig.runWithExcludingOracle, loadContext = true)
public class TableAliasTest {
@Autowired
private UserMapper userMapper;