| | |
| | | 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; |
| | |
| | | // 新增用户与角色管理 |
| | | 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(); |
| | |
| | | |
| | | @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("角色不存在"); |
| | | } |