fix: 修复租户套餐更新时租户权限未更新问题、租户操作日志未记录问题、租户角色管理模块菜单过滤、删除租户时菜单被删除问题

This commit is contained in:
小熊
2025-07-20 19:21:07 +08:00
parent 382c87f8bd
commit ada6f3ef5c
8 changed files with 59 additions and 10 deletions

View File

@@ -20,6 +20,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import top.continew.admin.system.mapper.LogMapper;
import top.continew.admin.system.service.UserService;
import top.continew.starter.extension.tenant.autoconfigure.TenantProperties;
import top.continew.starter.log.annotation.ConditionalOnEnabledLog;
import top.continew.starter.log.dao.LogDao;
import top.continew.starter.trace.autoconfigure.TraceProperties;
@@ -38,7 +39,10 @@ public class LogConfiguration {
* 日志持久层接口本地实现类
*/
@Bean
public LogDao logDao(UserService userService, LogMapper logMapper, TraceProperties traceProperties) {
return new LogDaoLocalImpl(userService, logMapper, traceProperties);
public LogDao logDao(UserService userService,
LogMapper logMapper,
TraceProperties traceProperties,
TenantProperties tenantProperties) {
return new LogDaoLocalImpl(userService, logMapper, traceProperties, tenantProperties);
}
}

View File

@@ -41,7 +41,7 @@ import top.continew.admin.system.service.UserService;
import top.continew.starter.core.constant.StringConstants;
import top.continew.starter.core.util.ExceptionUtils;
import top.continew.starter.core.util.StrUtils;
import top.continew.starter.extension.tenant.context.TenantContextHolder;
import top.continew.starter.extension.tenant.autoconfigure.TenantProperties;
import top.continew.starter.extension.tenant.util.TenantUtils;
import top.continew.starter.log.dao.LogDao;
import top.continew.starter.log.model.LogRecord;
@@ -67,6 +67,7 @@ public class LogDaoLocalImpl implements LogDao {
private final UserService userService;
private final LogMapper logMapper;
private final TraceProperties traceProperties;
private final TenantProperties tenantProperties;
@Async
@Override
@@ -87,8 +88,12 @@ public class LogDaoLocalImpl implements LogDao {
logDO.setCreateTime(LocalDateTime.ofInstant(logRecord.getTimestamp(), ZoneId.systemDefault()));
// 设置操作人
this.setCreateUser(logDO, logRequest, logResponse);
Long tenantId = TenantContextHolder.getTenantId();
TenantUtils.execute(tenantId, () -> logMapper.insert(logDO));
String strTenantId = logRequest.getHeaders().get(tenantProperties.getTenantIdHeader());
if (StrUtil.isNotBlank(strTenantId)) {
TenantUtils.execute(Long.parseLong(strTenantId), () -> logMapper.insert(logDO));
} else {
logMapper.insert(logDO);
}
}
/**

View File

@@ -223,7 +223,7 @@ continew-starter.tenant:
- sys_sms_log # 短信日志表
- sys_client # 客户端表
- sys_app # 应用表
- sys_menu
- sys_menu # 菜单表
# 忽略菜单 ID租户不能使用的菜单
ignore-menus:
- 1130 # 字典管理
@@ -234,6 +234,7 @@ continew-starter.tenant:
- 7000 # 能力开放
- 8000 # 任务调度
- 9000 # 开发工具
- 1050 # 菜单管理
--- ### 限流器配置
continew-starter: