| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.system.domain.SysMenu; |
| | | import com.ruoyi.system.domain.SysRole; |
| | | import com.ruoyi.common.helper.LoginHelper; |
| | | import com.ruoyi.common.utils.StreamUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.TreeBuildUtils; |
| | | import com.ruoyi.system.domain.SysRoleMenu; |
| | |
| | | @Override |
| | | public Set<String> selectMenuPermsByUserId(Long userId) { |
| | | List<String> perms = baseMapper.selectMenuPermsByUserId(userId); |
| | | Set<String> permsSet = new HashSet<>(); |
| | | for (String perm : perms) { |
| | | if (StringUtils.isNotEmpty(perm)) { |
| | | permsSet.addAll(Arrays.asList(perm.trim().split(","))); |
| | | } |
| | | } |
| | | return permsSet; |
| | | } |
| | | |
| | | /** |
| | | * 根据角色ID查询权限 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @return 权限列表 |
| | | */ |
| | | @Override |
| | | public Set<String> selectMenuPermsByRoleId(Long roleId) { |
| | | List<String> perms = baseMapper.selectMenuPermsByRoleId(roleId); |
| | | Set<String> permsSet = new HashSet<>(); |
| | | for (String perm : perms) { |
| | | if (StringUtils.isNotEmpty(perm)) { |
| | |
| | | * 得到子节点列表 |
| | | */ |
| | | private List<SysMenu> getChildList(List<SysMenu> list, SysMenu t) { |
| | | List<SysMenu> tlist = new ArrayList<SysMenu>(); |
| | | for (SysMenu n : list) { |
| | | if (n.getParentId().longValue() == t.getMenuId().longValue()) { |
| | | tlist.add(n); |
| | | } |
| | | } |
| | | return tlist; |
| | | return StreamUtils.filter(list, n -> n.getParentId().equals(t.getMenuId())); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * 内链域名特殊字符替换 |
| | | * |
| | | * @return |
| | | */ |
| | | public String innerLinkReplaceEach(String path) { |
| | | return StringUtils.replaceEach(path, new String[]{Constants.HTTP, Constants.HTTPS}, |
| | | new String[]{"", ""}); |
| | | return StringUtils.replaceEach(path, new String[]{Constants.HTTP, Constants.HTTPS, Constants.WWW, "."}, |
| | | new String[]{"", "", "", "/"}); |
| | | } |
| | | } |