fix(tenant): 修复用户忽略租户隔离查询功能中的SQL表名错误
- 修正 UserMapper.xml 中 sys_user 表的数据库前缀名称 - 修正文档中对应的 SQL 查询语句表名错误 - 确保查询逻辑在忽略租户隔离时能正确执行
This commit is contained in:
@@ -424,6 +424,7 @@ public class WxLoginController extends BaseController {
|
||||
public void getOrderQRCodeUnlimited(@PathVariable("scene") String scene, HttpServletResponse response) throws IOException {
|
||||
try {
|
||||
// 从scene参数中解析租户ID
|
||||
System.out.println("scene = " + scene);
|
||||
Integer tenantId = extractTenantIdFromScene(scene);
|
||||
System.out.println("从scene参数中解析租户ID = " + tenantId);
|
||||
if (tenantId == null) {
|
||||
@@ -641,7 +642,7 @@ public class WxLoginController extends BaseController {
|
||||
try {
|
||||
// 直接在Redis中创建配置
|
||||
String key = MP_WX_KEY + tenantId;
|
||||
|
||||
|
||||
// 创建配置内容
|
||||
Map<String, String> config = new HashMap<>();
|
||||
config.put("appId", appId);
|
||||
@@ -649,7 +650,7 @@ public class WxLoginController extends BaseController {
|
||||
config.put("tenantId", tenantId.toString());
|
||||
config.put("settingKey", "mp-weixin");
|
||||
config.put("settingId", "301");
|
||||
|
||||
|
||||
// 保存到Redis缓存
|
||||
redisUtil.set(key, JSON.toJSONString(config));
|
||||
|
||||
@@ -722,9 +723,11 @@ public class WxLoginController extends BaseController {
|
||||
if (scene != null && scene.startsWith("uid_")) {
|
||||
String userIdStr = scene.substring(4); // 去掉"uid_"前缀
|
||||
Integer userId = Integer.parseInt(userIdStr);
|
||||
System.out.println("userId = " + userId);
|
||||
|
||||
// 根据用户ID查询用户信息,获取租户ID
|
||||
User user = userService.getByIdIgnoreTenant(userId);
|
||||
System.out.println("user = " + user);
|
||||
if (user != null) {
|
||||
System.out.println("从用户ID " + userId + " 获取到租户ID: " + user.getTenantId());
|
||||
return user.getTenantId();
|
||||
|
||||
@@ -251,11 +251,11 @@
|
||||
c.dict_data_name sex_name,
|
||||
e.tenant_name,
|
||||
h.dealer_id
|
||||
FROM gxgxwebsoft_core.sys_user a
|
||||
FROM gxwebsoft_core.sys_user a
|
||||
LEFT JOIN (
|
||||
<include refid="selectSexDictSql"/>
|
||||
) c ON a.sex = c.dict_data_code
|
||||
LEFT JOIN gxgxwebsoft_core.sys_tenant e ON a.tenant_id = e.tenant_id
|
||||
LEFT JOIN gxwebsoft_core.sys_tenant e ON a.tenant_id = e.tenant_id
|
||||
LEFT JOIN gxwebsoft_core.sys_user_referee h ON a.user_id = h.user_id and h.deleted = 0
|
||||
WHERE a.user_id = #{userId}
|
||||
AND a.deleted = 0
|
||||
|
||||
Reference in New Issue
Block a user