From c7dd4a195d8d893d92c49963447cdf6486844584 Mon Sep 17 00:00:00 2001
From: cjl <276999030@qq.com>
Date: Fri, 20 Oct 2023 09:45:53 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/wb' into cjl
---
screen-manage/src/main/java/com/moral/api/pojo/vo/login/AccountInfoVO.java | 69 +++++++++++++++++++++++++++-------
1 files changed, 55 insertions(+), 14 deletions(-)
diff --git a/screen-manage/src/main/java/com/moral/api/pojo/vo/login/AccountInfoVO.java b/screen-manage/src/main/java/com/moral/api/pojo/vo/login/AccountInfoVO.java
index dbd42ca..958da56 100644
--- a/screen-manage/src/main/java/com/moral/api/pojo/vo/login/AccountInfoVO.java
+++ b/screen-manage/src/main/java/com/moral/api/pojo/vo/login/AccountInfoVO.java
@@ -4,12 +4,11 @@
import com.moral.api.entity.ManageAccount;
import com.moral.api.entity.ManageMenu;
import com.moral.api.entity.ManageRole;
-import com.moral.api.pojo.dto.login.AccountInfoDTO;
+import com.moral.api.pojo.redisBean.AccountInfoDTO;
import lombok.Data;
import org.springframework.util.ObjectUtils;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
/**
* @ClassName AccountInfoVO
@@ -62,18 +61,12 @@
/*������menu������������*/
if (!ObjectUtils.isEmpty(menus)) {
for (ManageMenu menu : menus) {
- menu.setCreateTime(null);
- menu.setIsDelete(null);
- menu.setUpdateTime(null);
- menu.setParentId(null);
- List<ManageMenu> children = menu.getChildren();
- for (ManageMenu child : children) {
- child.setCreateTime(null);
- child.setIsDelete(null);
- child.setUpdateTime(null);
- child.setParentId(null);
- }
+ removeAttribute(menu);
}
+ }
+ //menu������������
+ if (!ObjectUtils.isEmpty(menus)) {
+ orderRootMenu(menus);
}
vo.setAccountId(account.getId());
vo.setUserName(account.getUserName());
@@ -82,4 +75,52 @@
return vo;
}
+ public static void removeAttribute(ManageMenu menu) {
+ menu.setCreateTime(null);
+ menu.setIsDelete(null);
+ menu.setUpdateTime(null);
+ menu.setParentId(null);
+ if (ObjectUtils.isEmpty(menu.getChildren()))
+ return;
+ List<ManageMenu> children = menu.getChildren();
+ for (ManageMenu child : children) {
+ removeAttribute(child);
+ }
+ }
+
+
+ /**
+ * @Description: ������������������������
+ * @Param: [menus]
+ * @return: void
+ * @Author: ���������
+ * @Date: 2021/6/8
+ */
+ public static void orderRootMenu(List<ManageMenu> menus){
+ menus.sort(Comparator.comparing(ManageMenu::getOrder));
+ for (ManageMenu menu : menus) {
+ orderMenu(menu);
+ }
+ }
+
+ /**
+ * @Description: ���������������������������
+ * @Param: [menu]
+ * @return: void
+ * @Author: ���������
+ * @Date: 2021/6/8
+ */
+ public static void orderMenu(ManageMenu menu){
+ List<ManageMenu> children = menu.getChildren();
+ if(!ObjectUtils.isEmpty(children)){
+ children.sort(Comparator.comparing(ManageMenu::getOrder));
+ for (ManageMenu child : children) {
+ orderMenu(child);
+ }
+ }else{
+ return;
+ }
+ }
+
+
}
--
Gitblit v1.8.0