调整Mybaits Plus Join的SQL注入器到YudaoMybatisAutoConfiguration

This commit is contained in:
wangzhs 2023-03-13 09:52:27 +08:00
parent 7e0fb6cb56
commit 95159b0257
2 changed files with 2 additions and 3 deletions

View File

@ -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配置类

View File

@ -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);