【7.2.2】菜单增加是否为前后台菜单

pull/29/head
fengshuonan 2022-04-28 11:41:42 +08:00
parent 292500ca8f
commit 9b4ebb5e60
4 changed files with 82 additions and 1 deletions

View File

@ -0,0 +1,62 @@
/*
* 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.api.enums;
import lombok.Getter;
/**
*
*
* @author fengshuonan
* @date 2022/4/28 11:37
*/
@Getter
public enum MenuFrontTypeEnum {
/**
*
*/
FRONT(1, "前台显示"),
/**
*
*/
BACKEND(2, "后台显示"),
/**
*
*/
TOTAL(3, "全部显示");
private final Integer code;
private final String message;
MenuFrontTypeEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
}

View File

@ -156,6 +156,12 @@ public class SysMenuRequest extends BaseRequest {
@ChineseDescription("外部链接地址适用于antd vue版本")
private String antdvLinkUrl;
/**
* 1-2-3-
*/
@ChineseDescription("前台还是后台菜单")
private Integer antdvFrontType;
/**
* Antd Vue
*/

View File

@ -181,6 +181,13 @@ public class SysMenu extends BaseEntity implements AbstractTreeNode<SysMenu> {
@ChineseDescription("是否可见")
private String antdvVisible;
/**
* 1-2-3-
*/
@TableField("antdv_front_type")
@ChineseDescription("前台还是后台菜单")
private Integer antdvFrontType;
/**
* Y-N-
*/

View File

@ -41,6 +41,7 @@ import cn.stylefeng.roses.kernel.rule.tree.ztree.ZTreeNode;
import cn.stylefeng.roses.kernel.system.api.AppServiceApi;
import cn.stylefeng.roses.kernel.system.api.MenuServiceApi;
import cn.stylefeng.roses.kernel.system.api.RoleServiceApi;
import cn.stylefeng.roses.kernel.system.api.enums.MenuFrontTypeEnum;
import cn.stylefeng.roses.kernel.system.api.exception.SystemModularException;
import cn.stylefeng.roses.kernel.system.api.exception.enums.menu.SysMenuExceptionEnum;
import cn.stylefeng.roses.kernel.system.api.pojo.app.SysAppResult;
@ -130,6 +131,11 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
// 设置添加的菜单的类型
MenuTypeFactory.processMenuType(sysMenu, sysMenuRequest.getVisible());
// 设置如果菜单前后台类型如果为空,则默认为都显示
if (ObjectUtil.isEmpty(sysMenuRequest.getAntdvFrontType())) {
sysMenu.setAntdvFrontType(MenuFrontTypeEnum.TOTAL.getCode());
}
this.save(sysMenu);
}
@ -171,7 +177,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
// 不能修改状态,用修改状态接口修改状态
oldMenu.setStatusFlag(null);
// 设置添加的菜单的类型fengshuonan_sedinbj
// 设置添加的菜单的类型
MenuTypeFactory.processMenuType(oldMenu, sysMenuRequest.getVisible());
this.updateById(oldMenu);