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

@@ -126,8 +126,6 @@ public class TenantDataHandlerForSystem implements TenantDataHandler {
}
// 日志清除
logMapper.delete(dw);
// 菜单清除
menuMapper.delete(dw);
// 消息清除
messageMapper.delete(dw);
messageUserMapper.delete(dw);

View File

@@ -49,6 +49,7 @@ import top.continew.starter.extension.tenant.util.TenantUtils;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
@@ -160,8 +161,15 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, TenantDO, T
RoleDO roleDO = roleService.getByCode(SysConstants.TENANT_ADMIN_ROLE_CODE);
List<Long> oldMenuIds = roleMenuService.list(Wrappers.lambdaQuery(RoleMenuDO.class)
.eq(RoleMenuDO::getRoleId, roleDO.getId())).stream().map(RoleMenuDO::getMenuId).toList();
newMenuIds.removeAll(oldMenuIds);
roleMenuService.add(newMenuIds, roleDO.getId());
List<Long> addMenuIds = CollUtil.disjunction(newMenuIds, oldMenuIds).stream().toList();
if (CollUtil.isNotEmpty(addMenuIds)) {
List<RoleMenuDO> roleMenuDOList = new ArrayList<>();
for (Long addMenuId : addMenuIds) {
RoleMenuDO roleMenuDO = new RoleMenuDO(roleDO.getId(), addMenuId);
roleMenuDOList.add(roleMenuDO);
}
roleMenuService.saveBatch(roleMenuDOList, roleMenuDOList.size());
}
}));
//清理角色菜单缓存
RedisUtils.deleteByPattern(CacheConstants.ROLE_MENU_KEY_PREFIX + StringConstants.ASTERISK);