mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-27 09:41:58 +08:00
调整Mybaits Plus Join的SQL注入器到YudaoMybatisAutoConfiguration
This commit is contained in:
parent
7e0fb6cb56
commit
95159b0257
@ -1,7 +1,6 @@
|
|||||||
package cn.iocoder.yudao.framework.test.core.ut;
|
package cn.iocoder.yudao.framework.test.core.ut;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration;
|
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.mybatis.config.YudaoMybatisAutoConfiguration;
|
||||||
import cn.iocoder.yudao.framework.test.config.SqlInitializationTestConfiguration;
|
import cn.iocoder.yudao.framework.test.config.SqlInitializationTestConfiguration;
|
||||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||||
@ -37,7 +36,6 @@ public class BaseDbUnitTest {
|
|||||||
// MyBatis 配置类
|
// MyBatis 配置类
|
||||||
YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类
|
YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类
|
||||||
MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类
|
MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类
|
||||||
MybatisPlusJoinConfiguration.class, // MyBatis 的自动配置类
|
|
||||||
// TODO @升平:看看有没可能去掉下面两个类
|
// TODO @升平:看看有没可能去掉下面两个类
|
||||||
JoinInterceptor.class, // MyBatis 的Join配置类
|
JoinInterceptor.class, // MyBatis 的Join配置类
|
||||||
JoinInterceptorConfig.class, // MyBatis 的Join配置类
|
JoinInterceptorConfig.class, // MyBatis 的Join配置类
|
||||||
|
@ -776,7 +776,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSelectUserIncludeDept_success() {
|
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();
|
DeptDO dept = new DeptDO();
|
||||||
@ -798,6 +798,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
|
|||||||
// 断言
|
// 断言
|
||||||
AdminUserDO user = Joins.of(AdminUserDO.class)
|
AdminUserDO user = Joins.of(AdminUserDO.class)
|
||||||
.leftJoin(DeptDO.class, DeptDO::getId, AdminUserDO::getDeptId)
|
.leftJoin(DeptDO.class, DeptDO::getId, AdminUserDO::getDeptId)
|
||||||
|
.oneToOneSelect(AdminUserDO::getDept, DeptDO.class)
|
||||||
.end()
|
.end()
|
||||||
.eq(AdminUserDO::getId, userId)
|
.eq(AdminUserDO::getId, userId)
|
||||||
.joinGetOne(AdminUserDO.class);
|
.joinGetOne(AdminUserDO.class);
|
||||||
|
Loading…
Reference in New Issue
Block a user