mirror of https://gitee.com/stylefeng/roses
【system】layui版本首页顶部英文名称改为中文名称
parent
08565c886e
commit
b33e72d017
|
@ -22,4 +22,14 @@ public interface AppServiceApi {
|
|||
*/
|
||||
Set<SimpleDict> getAppsByAppCodes(Set<String> appCodes);
|
||||
|
||||
/**
|
||||
* 通过app编码获取app的中文名
|
||||
*
|
||||
* @param appCode 应用的编码
|
||||
* @return 应用的中文名
|
||||
* @author fengshuonan
|
||||
* @date 2020/11/29 20:06
|
||||
*/
|
||||
String getAppNameByAppCode(String appCode);
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,11 @@ public class LayuiAppIndexMenus {
|
|||
*/
|
||||
private String appCode;
|
||||
|
||||
/**
|
||||
* 应用的中文名称
|
||||
*/
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 该应用对应的菜单树
|
||||
*/
|
||||
|
|
|
@ -141,6 +141,27 @@ public class SysAppServiceImpl extends ServiceImpl<SysAppMapper, SysApp> impleme
|
|||
return simpleDicts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppNameByAppCode(String appCode) {
|
||||
|
||||
String emptyName = "空应用";
|
||||
|
||||
if (ObjectUtil.isEmpty(appCode)) {
|
||||
return emptyName;
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<SysApp> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysApp::getAppCode, appCode);
|
||||
lambdaQueryWrapper.select(SysApp::getAppName);
|
||||
SysApp sysApp = this.getOne(lambdaQueryWrapper);
|
||||
|
||||
if (sysApp == null || ObjectUtil.isEmpty(sysApp.getAppName())) {
|
||||
return emptyName;
|
||||
} else {
|
||||
return sysApp.getAppName();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统应用
|
||||
*
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package cn.stylefeng.roses.kernel.menu.modular.factory;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.stylefeng.roses.kernel.menu.modular.entity.SysMenu;
|
||||
import cn.stylefeng.roses.kernel.rule.enums.StatusEnum;
|
||||
import cn.stylefeng.roses.kernel.rule.factory.DefaultTreeBuildFactory;
|
||||
import cn.stylefeng.roses.kernel.system.AppServiceApi;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.menu.layui.LayuiAppIndexMenus;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.menu.layui.LayuiIndexMenuTreeNode;
|
||||
|
||||
|
@ -40,7 +44,6 @@ public class LayuiMenusFactory {
|
|||
// 找出每个应用下的所有菜单
|
||||
for (String appCode : appCodes) {
|
||||
|
||||
|
||||
// 找出这个应用下的菜单
|
||||
List<SysMenu> appMenus = sysMenuList.stream()
|
||||
.filter(i -> i.getAppCode().equals(appCode))
|
||||
|
@ -60,6 +63,7 @@ public class LayuiMenusFactory {
|
|||
// 将appCode和对应的树包装为实体
|
||||
LayuiAppIndexMenus layuiAppIndexMenus = new LayuiAppIndexMenus();
|
||||
layuiAppIndexMenus.setAppCode(appCode);
|
||||
layuiAppIndexMenus.setAppName(getAppNameByAppCode(appCode));
|
||||
layuiAppIndexMenus.setLayuiIndexMenuTreeNodes(layuiIndexMenuTreeNodeList);
|
||||
resultList.add(layuiAppIndexMenus);
|
||||
}
|
||||
|
@ -67,4 +71,15 @@ public class LayuiMenusFactory {
|
|||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用名称通过应用编码
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2021/1/1 18:09
|
||||
*/
|
||||
private static String getAppNameByAppCode(String appCode) {
|
||||
AppServiceApi appServiceApi = SpringUtil.getBean(AppServiceApi.class);
|
||||
return appServiceApi.getAppNameByAppCode(appCode);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue