From de5f07fe1acd8d462f9c54d7a04c5c47a87264d1 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期六, 07 三月 2026 21:01:24 +0800
Subject: [PATCH] 修改bug
---
xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/SysRoleServiceImpl.java | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/SysRoleServiceImpl.java b/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/SysRoleServiceImpl.java
index f4c6304..e9e9ce0 100644
--- a/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/SysRoleServiceImpl.java
+++ b/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/SysRoleServiceImpl.java
@@ -2,10 +2,12 @@
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaopeng.account.constant.I18nKeyConstant;
import com.xiaopeng.account.mapper.SysRoleMapper;
import com.xiaopeng.account.mapper.SysRoleMenuMapper;
+import com.xiaopeng.account.mapper.XpOperationsRoleMapper;
import com.xiaopeng.account.model.dto.SysRoleAddDTO;
import com.xiaopeng.account.model.dto.SysRoleEditDTO;
import com.xiaopeng.account.model.query.SysRolePageQuery;
@@ -18,6 +20,7 @@
import com.xiaopeng.api.feignClient.operation.SysMenuClient;
import com.xiaopeng.api.model.account.SysRole;
import com.xiaopeng.api.model.account.SysUserRole;
+import com.xiaopeng.api.model.account.XpOperationsRole;
import com.xiaopeng.api.model.operation.SysMenu;
import com.xiaopeng.common.core.domain.R;
import com.xiaopeng.common.core.exception.ServiceException;
@@ -53,6 +56,7 @@
private final SysMenuClient sysMenuClient;
private final SysRoleMenuMapper sysRoleMenuMapper;
+ private final XpOperationsRoleMapper xpOperationsRoleMapper;
/**
* 根据角色ID查询权限组ID
@@ -342,4 +346,32 @@
public Boolean checkMenuExistRole(Long menuId) {
return sysRoleMenuMapper.checkMenuExistRole(menuId) > 0;
}
+
+ @Override
+ public Set<String> selectRolePermissionByOperationUserId(Long userId) {
+ Set<String> roles = new HashSet<>();
+ if (userId == null) {
+ return roles;
+ }
+
+ // 查询用户关联的角色
+ List<XpOperationsRole> xpOperationsRoles = xpOperationsRoleMapper.selectSysUserRoleByOperationUserId(userId);
+ if (CollectionUtils.isEmpty(xpOperationsRoles)) {
+ return roles;
+ }
+
+ // 查询角色信息
+ List<Long> roleIds = xpOperationsRoles.stream().map(XpOperationsRole::getRoleId).collect(Collectors.toList());
+ List<SysRole> roleList= this.list(Wrappers.lambdaQuery(SysRole.class)
+ .in(SysRole::getId, roleIds));
+ if (!CollectionUtils.isEmpty(roleList)) {
+ roleList.forEach(role -> {
+ if (role != null) {
+ roles.add(role.getRoleName());
+ }
+ });
+ }
+
+ return roles;
+ }
}
--
Gitblit v1.7.1