mitao
2025-03-14 392b42c4891cf2e6beda57ab32c51598f290f4b7
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java
@@ -1,6 +1,8 @@
package com.ruoyi.system.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.SpringUtils;
@@ -295,20 +297,7 @@
        // 新增用户与角色管理
        List<SysRoleMenu> list = new ArrayList<SysRoleMenu>();
        Long[] menuIds = role.getMenuIds();
//        List<Long> longs = Arrays.asList(menuIds);
        List<Long> longs = new ArrayList<>();
        for (Long menuId : menuIds) {
            longs.add(menuId);
        }
        if(!longs.contains(1061L)){
            longs.add(1061L);
            longs.add(1062L);
            longs.add(1065L);
            longs.add(1073L);
            longs.add(1161L);
            longs.add(1203L);
        }
        List<Long> longs = Lists.newArrayList(menuIds);
        for (Long menuId : longs)
        {
            SysRoleMenu rm = new SysRoleMenu();
@@ -445,7 +434,12 @@
    @Override
    public void removeRole(Long id) {
        SysRole sysRole = this.getById(id);
        SysRole sysRole = baseMapper.selectRoleById(id);
        Long count = userRoleMapper.selectCount(
                Wrappers.lambdaQuery(SysUserRole.class).eq(SysUserRole::getRoleId, id));
        if (count > 0) {
            throw new ServiceException("角色已绑定账号,不能删除");
        }
        if (StringUtils.isNull(sysRole)) {
            throw new ServiceException("角色不存在");
        }