| | |
| | | public static final List<Integer> list1 = Arrays.asList(1, 2, 3, 4, 5, 6, 11, null); |
| | | public static final List<Integer> list2 = Arrays.asList(1, 11, null); |
| | | |
| | | /** |
| | | * apache测试方法 |
| | | */ |
| | | public static void main(String[] args) { |
| | | System.out.println("交集:" + CollectionUtils.intersection(list1, list2)); // 交集 |
| | | System.out.println("补集:" + CollectionUtils.disjunction(list1, list2)); // 补集 |
| | | System.out.println("并集:" + CollectionUtils.union(list1, list2)); // 并集 |
| | | System.out.println("list1的差集:" + CollectionUtils.subtract(list1, list2)); // list1的差集 |
| | | System.out.println("list2的差集:" + CollectionUtils.subtract(list2, list1)); // list2的差集 |
| | | } |
| | | |
| | | @Override |
| | | public List<MenuVO> routes(String roleId, Long topMenuId, Integer labelType) { |
| | |
| | | List<Menu> roleMenus; |
| | | // 超级管理员并且不是顶部菜单请求则返回全部菜单 |
| | | if (AuthUtil.isAdministrator() && Func.isEmpty(topMenuId)) { |
| | | roleMenus = allMenus; |
| | | roleMenus = allMenus.stream().filter(a -> a.getMenuType().equals(0)).collect(Collectors.toList()); |
| | | } |
| | | // 非超级管理员并且不是顶部菜单请求则返回对应角色权限菜单 |
| | | else if (!AuthUtil.isAdministrator() && Func.isEmpty(topMenuId)) { |
| | |
| | | List<Integer> integerList = Arrays.stream(split).map(Integer::valueOf).collect(Collectors.toList()); |
| | | Collection<? extends Serializable> union = CollectionUtils.intersection(integerList, integers); |
| | | if (union.size() == 0) { |
| | | iterator.remove(); |
| | | } |
| | | } else { |
| | | if (next.getName().trim().equals("标签报事")) { |
| | | iterator.remove(); |
| | | } |
| | | if (next.getName().trim().equals("取保候审")) { |
| | | iterator.remove(); |
| | | } |
| | | if (next.getName().trim().equals("打金店")) { |
| | | iterator.remove(); |
| | | } |
| | | if (next.getName().trim().equals("旅馆安全")) { |
| | | iterator.remove(); |
| | | } |
| | | if (next.getName().trim().equals("二手车交易")) { |
| | | iterator.remove(); |
| | | } |
| | | if (next.getName().trim().equals("二手手机维修")) { |
| | | iterator.remove(); |
| | | } |
| | | if (next.getName().trim().equals("校园安全")) { |
| | | iterator.remove(); |
| | | } |
| | | } |
| | |
| | | List<List<String>> labelList = menu.getLabelList(); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | for (List<String> strings : labelList) { |
| | | stringBuffer.append(strings.get(2)).append(","); |
| | | stringBuffer.append(strings.get(strings.size()-1)).append(","); |
| | | } |
| | | menu.setLabelId(stringBuffer.toString()); |
| | | menu.setIsDeleted(BladeConstant.DB_NOT_DELETED); |