From 95159b02579a4964ff40d17783cdc8340bb6d054 Mon Sep 17 00:00:00 2001 From: wangzhs Date: Mon, 13 Mar 2023 09:52:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4Mybaits=20Plus=20Join?= =?UTF-8?q?=E7=9A=84SQL=E6=B3=A8=E5=85=A5=E5=99=A8=E5=88=B0YudaoMybatisAut?= =?UTF-8?q?oConfiguration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iocoder/yudao/framework/test/core/ut/BaseDbUnitTest.java | 2 -- .../module/system/service/user/AdminUserServiceImplTest.java | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseDbUnitTest.java b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseDbUnitTest.java index fc29a1b78..7ff1c4a11 100644 --- a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseDbUnitTest.java +++ b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseDbUnitTest.java @@ -1,7 +1,6 @@ package cn.iocoder.yudao.framework.test.core.ut; import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration; -import cn.iocoder.yudao.framework.mybatis.config.MybatisPlusJoinConfiguration; import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration; import cn.iocoder.yudao.framework.test.config.SqlInitializationTestConfiguration; import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; @@ -37,7 +36,6 @@ public class BaseDbUnitTest { // MyBatis 配置类 YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类 MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类 - MybatisPlusJoinConfiguration.class, // MyBatis 的自动配置类 // TODO @升平:看看有没可能去掉下面两个类 JoinInterceptor.class, // MyBatis 的Join配置类 JoinInterceptorConfig.class, // MyBatis 的Join配置类 diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImplTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImplTest.java index 46d096496..43edc3b59 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImplTest.java @@ -776,7 +776,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { @Test public void testSelectUserIncludeDept_success() { - // 需设置 application-unit-test.yaml 文件中 spring.main.lazy-initialization: true + // 需设置 application-unit-test.yaml 文件中 spring.main.lazy-initialization: false // 准备部门数据 DeptDO dept = new DeptDO(); @@ -798,6 +798,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { // 断言 AdminUserDO user = Joins.of(AdminUserDO.class) .leftJoin(DeptDO.class, DeptDO::getId, AdminUserDO::getDeptId) + .oneToOneSelect(AdminUserDO::getDept, DeptDO.class) .end() .eq(AdminUserDO::getId, userId) .joinGetOne(AdminUserDO.class);