| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.constant.UserConstants; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.model.UserShop; |
| | | import com.ruoyi.system.domain.SysRoleDept; |
| | | import com.ruoyi.system.domain.SysRoleMenu; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | |
| | | |
| | | @Resource |
| | | private UserShopService userShopService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public Set<String> selectRolePermissionByUserId(SysUser user) { |
| | | Set<String> permsSet = new HashSet<>(); |
| | | if(user.getRoleType() == 1){ |
| | | List<SysRole> perms = roleMapper.selectRolePermissionByUserId(user.getUserId()); |
| | | for (SysRole perm : perms) { |
| | | if (StringUtils.isNotNull(perm)) { |
| | | permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); |
| | | } |
| | | } |
| | | }else{ |
| | | List<UserShop> list = userShopService.list(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()) |
| | | .eq(UserShop::getShopId, user.getObjectId())); |
| | | for (UserShop userShop : list) { |
| | | if (StringUtils.isNotNull(userShop)) { |
| | | permsSet.add(userShop.getRoleId() + ""); |
| | | } |
| | | List<SysRole> perms = roleMapper.selectRolePermissionByUserId(user.getUserId()); |
| | | for (SysRole perm : perms) { |
| | | if (StringUtils.isNotNull(perm)) { |
| | | permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); |
| | | } |
| | | } |
| | | return permsSet; |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<SysRole> getSysRoleByIds(List<Integer> ids) { |
| | | public List<SysRole> getSysRoleByIds(List<Long> ids) { |
| | | return this.baseMapper.getSysRoleByIds(ids); |
| | | } |
| | | } |