【menu】更新layui版本获取初始菜单为激活应用的菜单

pull/3/head
fengshuonan 2021-01-08 20:53:28 +08:00
parent 7808c2fecc
commit 3272de48c5
3 changed files with 35 additions and 1 deletions

View File

@ -32,4 +32,13 @@ public interface AppServiceApi {
*/
String getAppNameByAppCode(String appCode);
/**
*
*
* @return
* @author fengshuonan
* @date 2021/1/8 19:01
*/
String getActiveAppCode();
}

View File

@ -183,6 +183,20 @@ public class SysAppServiceImpl extends ServiceImpl<SysAppMapper, SysApp> impleme
}
}
@Override
public String getActiveAppCode() {
LambdaQueryWrapper<SysApp> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(SysApp::getAppCode);
queryWrapper.eq(SysApp::getActiveFlag, YesOrNotEnum.Y.getCode());
queryWrapper.eq(SysApp::getDelFlag, YesOrNotEnum.N.getCode());
List<SysApp> list = this.list(queryWrapper);
if (list.isEmpty()) {
return null;
} else {
return list.get(0).getAppCode();
}
}
/**
*
*

View File

@ -253,7 +253,18 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
List<SysMenu> currentUserMenus = this.getCurrentUserMenus();
// 组装每个应用的菜单树
return LayuiMenusFactory.createLayuiAppIndexMenus(currentUserMenus);
List<LayuiAppIndexMenus> layuiAppIndexMenus = LayuiMenusFactory.createLayuiAppIndexMenus(currentUserMenus);
// 给应用排序,激活的应用放在前边
String activeAppCode = appServiceApi.getActiveAppCode();
if (activeAppCode != null) {
List<LayuiAppIndexMenus> layuiAppIndexMenusArrayList =
layuiAppIndexMenus.stream().filter(i -> activeAppCode.equals(i.getAppCode())).collect(Collectors.toList());
layuiAppIndexMenusArrayList.addAll(layuiAppIndexMenus.stream().filter(i -> !activeAppCode.equals(i.getAppCode())).collect(Collectors.toList()));
return layuiAppIndexMenusArrayList;
}
return layuiAppIndexMenus;
}
@Override