mirror of https://gitee.com/stylefeng/roses
【menu】更新layui版本获取初始菜单为激活应用的菜单
parent
7808c2fecc
commit
3272de48c5
|
@ -32,4 +32,13 @@ public interface AppServiceApi {
|
|||
*/
|
||||
String getAppNameByAppCode(String appCode);
|
||||
|
||||
/**
|
||||
* 获取当前激活的应用编码
|
||||
*
|
||||
* @return 激活的应用编码
|
||||
* @author fengshuonan
|
||||
* @date 2021/1/8 19:01
|
||||
*/
|
||||
String getActiveAppCode();
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统应用
|
||||
*
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue