From d0b0e00e40226700a0ffa1f1671a8dc273610f67 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Mon, 18 Dec 2023 14:28:10 +0800
Subject: [PATCH] 菜单分类优化

---
 src/main/java/org/springblade/modules/system/service/impl/MenuServiceImpl.java |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/springblade/modules/system/service/impl/MenuServiceImpl.java b/src/main/java/org/springblade/modules/system/service/impl/MenuServiceImpl.java
index fc8174b..0cfc419 100644
--- a/src/main/java/org/springblade/modules/system/service/impl/MenuServiceImpl.java
+++ b/src/main/java/org/springblade/modules/system/service/impl/MenuServiceImpl.java
@@ -108,16 +108,6 @@
 	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) {
@@ -128,7 +118,7 @@
 		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)) {
@@ -146,6 +136,28 @@
 						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();
 						}
 					}
@@ -360,7 +372,7 @@
 		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);

--
Gitblit v1.9.3