From b482efaf698d5fd3920ff63ccde1c819f9eb34ba Mon Sep 17 00:00:00 2001
From: houzhongjian <houzhongyi@126.com>
Date: 星期四, 26 十二月 2024 16:50:12 +0800
Subject: [PATCH] 修改菜单报错bug

---
 iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/service/app/AppServiceImpl.java |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/service/app/AppServiceImpl.java b/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/service/app/AppServiceImpl.java
index 9956f88..43bcb42 100644
--- a/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/service/app/AppServiceImpl.java
+++ b/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/service/app/AppServiceImpl.java
@@ -29,6 +29,7 @@
 import com.iailab.module.system.service.permission.MenuService;
 import com.iailab.module.system.service.permission.PermissionService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -150,7 +151,7 @@
     public AppDO getAppByTenantId(Long tenantId) {
         //暂时支持一个租户对应一个应用
         List<AppDO> appDOS = appMapper.selectList(new LambdaQueryWrapper<AppDO>().eq(AppDO::getTenantId, tenantId));
-        if(ObjectUtils.isNotEmpty(appDOS)) {
+        if(CollectionUtils.isNotEmpty(appDOS)) {
             return appDOS.get(0);
         } else {
             AppDO appDO = new AppDO();
@@ -163,7 +164,6 @@
     @Override
     public List<AuthPermissionInfoRespVO.MenuVO> getAppMenu(Long id) {
         MenuDO menuDO = menuMapper.selectById(id);
-
         List<MenuDO> children = new LinkedList<>();
         // 遍历每一层
         Collection<Long> parentIds = Collections.singleton(id);
@@ -195,6 +195,7 @@
         if(type == 1){
             menuDO.setCreator(loginUserNickname);
             menuDO.setCreateTime(app.getCreateTime());
+            menuDO.setIcon("fa-solid:border-none"); //默认icon
             menuMapper.insert(menuDO);
 //            //内置租户角色分配菜单
 //            assignRoleMenu(menuDO.getId(), app.getTenantId());
@@ -220,6 +221,7 @@
             LambdaQueryWrapperX<MenuDO> menuWrapper = new LambdaQueryWrapperX<>();
             menuWrapper.eq(MenuDO::getAppId, app.getId());
             menuWrapper.eq(MenuDO::getType, MenuTypeEnum.DIR.getType());
+            menuWrapper.eq(MenuDO::getParentId, 0);
             MenuDO menu = menuMapper.selectOne(menuWrapper);
             TenantDO tenantDO = tenantMapper.selectById(app.getTenantId());
             if(ObjectUtils.isNotEmpty(menu) && ObjectUtils.isNotEmpty(tenantDO)) {

--
Gitblit v1.9.3