fix(config): 修复租户ID获取逻辑并调整注释格式
- 优化异常处理,改为忽略异常并使用默认逻辑 - 增加最后从登录用户获取租户ID的尝试逻辑 - 统一未获取到租户ID时返回null而非undefined - 调整注释格式,使其更规范美观 - 注释掉部分表名,保持代码清晰
This commit is contained in:
@@ -67,13 +67,13 @@ public class MybatisPlusConfig {
|
|||||||
// 忽略异常,使用默认逻辑
|
// 忽略异常,使用默认逻辑
|
||||||
System.err.println("获取租户ID异常: " + e.getMessage());
|
System.err.println("获取租户ID异常: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 最后尝试从登录用户获取
|
// 最后尝试从登录用户获取
|
||||||
Expression loginUserTenantId = getLoginUserTenantId();
|
Expression loginUserTenantId = getLoginUserTenantId();
|
||||||
if (loginUserTenantId instanceof LongValue) {
|
if (loginUserTenantId instanceof LongValue) {
|
||||||
return loginUserTenantId;
|
return loginUserTenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果都获取不到,返回null而不是undefined
|
// 如果都获取不到,返回null而不是undefined
|
||||||
return new NullValue();
|
return new NullValue();
|
||||||
}
|
}
|
||||||
@@ -92,6 +92,7 @@ public class MybatisPlusConfig {
|
|||||||
"sys_dictionary_data",
|
"sys_dictionary_data",
|
||||||
"apps_test_data",
|
"apps_test_data",
|
||||||
"cms_lang"
|
"cms_lang"
|
||||||
|
// "cms_model"
|
||||||
// "hjm_car",
|
// "hjm_car",
|
||||||
// "hjm_fence"
|
// "hjm_fence"
|
||||||
// "cms_website"
|
// "cms_website"
|
||||||
|
|||||||
Reference in New Issue
Block a user