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

pull/22/head
fengshuonan 2021-07-21 15:32:02 +08:00
parent 686f56b207
commit 73accd59c1
2 changed files with 22 additions and 10 deletions

View File

@ -25,6 +25,7 @@
package cn.stylefeng.roses.kernel.system.modular.menu.factory;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
import cn.stylefeng.roses.kernel.system.modular.menu.entity.SysMenu;
@ -42,7 +43,8 @@ public class MenuTypeFactory {
* @author fengshuonan
* @date 2021/7/21 14:44
*/
public static void processMenuType(SysMenu sysMenu) {
public static void processMenuType(SysMenu sysMenu, String visible) {
if (ObjectUtil.isAllEmpty(
sysMenu.getAntdvIcon(),
sysMenu.getAntdvComponent(),
@ -50,15 +52,27 @@ public class MenuTypeFactory {
sysMenu.getAntdvUidUrl(),
sysMenu.getAntdvLinkOpenType(),
sysMenu.getAntdvLinkUrl())) {
sysMenu.setLayuiVisible(YesOrNotEnum.Y.getCode());
sysMenu.setAntdvVisible(YesOrNotEnum.N.getCode());
if (StrUtil.isEmpty(visible)) {
sysMenu.setLayuiVisible(YesOrNotEnum.Y.getCode());
sysMenu.setAntdvVisible(YesOrNotEnum.N.getCode());
} else {
sysMenu.setLayuiVisible(visible);
sysMenu.setAntdvVisible(YesOrNotEnum.N.getCode());
}
}
if (ObjectUtil.isAllEmpty(
sysMenu.getLayuiIcon(),
sysMenu.getLayuiPath())) {
sysMenu.setLayuiVisible(YesOrNotEnum.N.getCode());
sysMenu.setAntdvVisible(YesOrNotEnum.Y.getCode());
if (StrUtil.isEmpty(visible)) {
sysMenu.setLayuiVisible(YesOrNotEnum.N.getCode());
sysMenu.setAntdvVisible(YesOrNotEnum.Y.getCode());
} else {
sysMenu.setLayuiVisible(YesOrNotEnum.N.getCode());
sysMenu.setAntdvVisible(visible);
}
}
}

View File

@ -121,7 +121,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
sysMenu.setDelFlag(YesOrNotEnum.N.getCode());
// 设置添加的菜单的类型
MenuTypeFactory.processMenuType(sysMenu);
MenuTypeFactory.processMenuType(sysMenu, sysMenuRequest.getVisible());
this.save(sysMenu);
}
@ -164,10 +164,8 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
// 不能修改状态,用修改状态接口修改状态
oldMenu.setStatusFlag(null);
// 更新 AntdvVisible LayuiVisible 字段
String visible = sysMenuRequest.getVisible();
oldMenu.setAntdvVisible(visible);
oldMenu.setLayuiVisible(visible);
// 设置添加的菜单的类型fengshuonan_sedinbj
MenuTypeFactory.processMenuType(oldMenu, sysMenuRequest.getVisible());
this.updateById(oldMenu);
}