【7.0.4】【menu】更新菜单添加时候的类型设置

pull/22/head
fengshuonan 2021-07-21 14:58:42 +08:00
parent e1a593a7d6
commit 686f56b207
2 changed files with 69 additions and 1 deletions

View File

@ -0,0 +1,65 @@
/*
* Copyright [2020-2030] [https://www.stylefeng.cn]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* GunsAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Guns
* 3.
* 4. https://gitee.com/stylefeng/guns
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.system.modular.menu.factory;
import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
import cn.stylefeng.roses.kernel.system.modular.menu.entity.SysMenu;
/**
*
*
* @author fengshuonan
* @date 2021/7/21 14:36
*/
public class MenuTypeFactory {
/**
* sysMenumenu
*
* @author fengshuonan
* @date 2021/7/21 14:44
*/
public static void processMenuType(SysMenu sysMenu) {
if (ObjectUtil.isAllEmpty(
sysMenu.getAntdvIcon(),
sysMenu.getAntdvComponent(),
sysMenu.getAntdvRouter(),
sysMenu.getAntdvUidUrl(),
sysMenu.getAntdvLinkOpenType(),
sysMenu.getAntdvLinkUrl())) {
sysMenu.setLayuiVisible(YesOrNotEnum.Y.getCode());
sysMenu.setAntdvVisible(YesOrNotEnum.N.getCode());
}
if (ObjectUtil.isAllEmpty(
sysMenu.getLayuiIcon(),
sysMenu.getLayuiPath())) {
sysMenu.setLayuiVisible(YesOrNotEnum.N.getCode());
sysMenu.setAntdvVisible(YesOrNotEnum.Y.getCode());
}
}
}

View File

@ -32,7 +32,6 @@ import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.basic.SimpleRoleInfo;
import cn.stylefeng.roses.kernel.db.api.DbOperatorApi;
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
import cn.stylefeng.roses.kernel.rule.constants.SymbolConstant;
import cn.stylefeng.roses.kernel.rule.constants.TreeConstants;
import cn.stylefeng.roses.kernel.rule.enums.StatusEnum;
@ -58,6 +57,7 @@ import cn.stylefeng.roses.kernel.system.modular.menu.entity.SysMenu;
import cn.stylefeng.roses.kernel.system.modular.menu.entity.SysMenuButton;
import cn.stylefeng.roses.kernel.system.modular.menu.factory.AntdMenusFactory;
import cn.stylefeng.roses.kernel.system.modular.menu.factory.LayuiMenusFactory;
import cn.stylefeng.roses.kernel.system.modular.menu.factory.MenuTypeFactory;
import cn.stylefeng.roses.kernel.system.modular.menu.mapper.SysMenuMapper;
import cn.stylefeng.roses.kernel.system.modular.menu.service.SysMenuButtonService;
import cn.stylefeng.roses.kernel.system.modular.menu.service.SysMenuService;
@ -120,6 +120,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
sysMenu.setStatusFlag(StatusEnum.ENABLE.getCode());
sysMenu.setDelFlag(YesOrNotEnum.N.getCode());
// 设置添加的菜单的类型
MenuTypeFactory.processMenuType(sysMenu);
this.save(sysMenu);
}