代码生成器反响生成菜单

v1.4.1
Parker 4 years ago
parent 421b9d0340
commit 6ea33542ab

@ -16,6 +16,7 @@
package org.opsli.api.web.system.menu; package org.opsli.api.web.system.menu;
import org.opsli.api.base.result.ResultVo; import org.opsli.api.base.result.ResultVo;
import org.opsli.api.wrapper.system.menu.MenuFullModel;
import org.opsli.api.wrapper.system.menu.MenuModel; import org.opsli.api.wrapper.system.menu.MenuModel;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -179,10 +180,18 @@ public interface MenuApi {
// ================= 普通 // ================= 普通
/** /**
* *
* @param permissions * @param permissions
* @return ResultVo * @return ResultVo
*/ */
ResultVo<MenuModel> getByPermissions(String permissions); ResultVo<MenuModel> getByPermissions(String permissions);
/**
*
* @param menuFullModel
* @return ResultVo
*/
ResultVo<?> saveMenuByFull(@RequestBody MenuFullModel menuFullModel);
} }

@ -0,0 +1,69 @@
/**
* Copyright 2020 OPSLI https://www.opsli.com
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.
*/
package org.opsli.api.wrapper.system.menu;
import com.alibaba.excel.annotation.ExcelIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.opsli.api.base.warpper.ApiWrapper;
import org.opsli.common.annotation.validation.ValidationArgs;
import org.opsli.common.annotation.validation.ValidationArgsLenMax;
import org.opsli.common.enums.ValiArgsType;
import java.io.Serializable;
/**
* @BelongsProject: opsli-boot
* @BelongsPackage: org.opsli.api.wrapper.system.menu
* @Author: Parker
* @CreateTime: 2020-09-16 17:33
* @Description:
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class MenuFullModel implements Serializable {
private static final long serialVersionUID = 1L;
/** 上级菜单ID */
@ApiModelProperty(value = "上级菜单ID")
@ExcelIgnore
@ValidationArgs({ValiArgsType.IS_NOT_NULL})
@ValidationArgsLenMax(19)
private String parentId;
/** 菜单名称 */
@ApiModelProperty(value = "菜单名称")
@ExcelIgnore
@ValidationArgs({ValiArgsType.IS_NOT_NULL})
@ValidationArgsLenMax(100)
private String title;
/** 模块名 */
@ApiModelProperty(value = "模块名")
@ExcelIgnore
@ValidationArgs({ValiArgsType.IS_NOT_NULL})
@ValidationArgsLenMax(40)
private String moduleName;
/** 子模块名 */
@ApiModelProperty(value = "子模块名")
@ExcelIgnore
@ValidationArgsLenMax(40)
private String subModuleName;
}

@ -29,7 +29,7 @@ import org.opsli.plugins.excel.annotation.ExcelInfo;
/** /**
* @BelongsProject: opsli-boot * @BelongsProject: opsli-boot
* @BelongsPackage: org.opsli.modulars.test.entity * @BelongsPackage: org.opsli.api.wrapper.system.menu
* @Author: Parker * @Author: Parker
* @CreateTime: 2020-09-16 17:33 * @CreateTime: 2020-09-16 17:33
* @Description: * @Description:

@ -91,9 +91,12 @@ public class UserInfo extends ApiWrapper {
@ApiModelProperty(value = "权限列表") @ApiModelProperty(value = "权限列表")
private List<String> perms; private List<String> perms;
/** 是否是超级管理员 */ /** 是否是超级管理员 */
@ApiModelProperty(value = "是否是超级管理员") @ApiModelProperty(value = "是否是超级管理员")
private boolean izSuperAdmin; private boolean izSuperAdmin;
/** 密码强度 字典 password_level */
@ApiModelProperty(value = "密码强度")
private String passwordLevel;
} }

@ -23,6 +23,9 @@ package org.opsli.common.constants;
*/ */
public interface MenuConstants { public interface MenuConstants {
/** 菜单根节点ID */
String GEN_ID = "0";
/** 菜单类型 */ /** 菜单类型 */
String MENU = "1"; String MENU = "1";

@ -25,18 +25,24 @@ package org.opsli.common.enums;
public enum DictType { public enum DictType {
/** 是否 */ /** 是否 */
NO_YES_NO("no_yes","0"), NO_YES_NO("no_yes","0", "否"),
NO_YES_YES("no_yes","1"), NO_YES_YES("no_yes","1", "是"),
/** 菜单 */
MENU_MENU("menu_type","1", "菜单"),
MENU_BUTTON("menu_type","2", "按钮"),
MENU_EXTERNAL("menu_type","3", "外链"),
; ;
private final String type; private final String type;
private final String value; private final String value;
private final String desc;
DictType(String type, String value){ DictType(String type, String value, String desc){
this.type = type; this.type = type;
this.value = value; this.value = value;
this.desc = desc;
} }
public String getValue() { public String getValue() {
@ -47,6 +53,10 @@ public enum DictType {
return this.type; return this.type;
} }
public String getDesc() {
return this.desc;
}
/** /**
* *
* @param type * @param type

@ -56,6 +56,8 @@ public enum CreaterMsg implements BaseMsg {
EXCEPTION_CREATE_NULL(50140,"生成失败,数据为空"), EXCEPTION_CREATE_NULL(50140,"生成失败,数据为空"),
EXCEPTION_CREATE_TABLE_NULL(50141,"生成失败,暂无表数据"), EXCEPTION_CREATE_TABLE_NULL(50141,"生成失败,暂无表数据"),
EXCEPTION_CREATE_FIELD_NULL(50142,"生成失败,暂无表字段"), EXCEPTION_CREATE_FIELD_NULL(50142,"生成失败,暂无表字段"),
EXCEPTION_CREATE_MENU_CODE_NULL(50143,"生成菜单失败,请先生成代码"),
EXCEPTION_CREATE_MENU_PARENT_NULL(50144,"上级菜单不可为空"),
/** /**
* *

@ -56,12 +56,22 @@ public interface CreaterLogsApi {
ResultVo<CreaterLogsModel> getByTableId(String tableId); ResultVo<CreaterLogsModel> getByTableId(String tableId);
/** /**
* *
* @param model * @param model
* @return ResultVo * @return ResultVo
*/ */
@GetMapping("/create") @GetMapping("/create")
void create(CreaterLogsModel model, HttpServletResponse response); void create(CreaterLogsModel model, HttpServletResponse response);
/**
*
*
* @param menuParentId ID
* @param tableId ID
* @return ResultVo
*/
@PostMapping("/createMenu")
ResultVo<?> createMenu(String menuParentId, String tableId);
} }

@ -44,14 +44,23 @@ public interface ICreateLogsService extends CrudServiceInterface<CreaterLogs, Cr
/** /**
* Id * Id
* @param tableId * @param tableId ID
*/ */
CreaterLogsModel getByTableId(String tableId); CreaterLogsModel getByTableId(String tableId);
/** /**
* *
* @param model * @param model
* @param response response
*/ */
void create(CreaterLogsModel model, HttpServletResponse response); void create(CreaterLogsModel model, HttpServletResponse response);
/**
*
* @param menuParentId ID
* @param tableId ID
* @return boolean
*/
boolean createMenu(String menuParentId, String tableId);
} }

@ -17,6 +17,10 @@ package org.opsli.modulars.creater.createrlogs.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.opsli.api.base.result.ResultVo;
import org.opsli.api.web.system.menu.MenuApi;
import org.opsli.api.wrapper.system.menu.MenuFullModel;
import org.opsli.common.utils.WrapperUtil; import org.opsli.common.utils.WrapperUtil;
import org.opsli.core.base.service.impl.CrudServiceImpl; import org.opsli.core.base.service.impl.CrudServiceImpl;
import org.opsli.core.creater.exception.CreaterException; import org.opsli.core.creater.exception.CreaterException;
@ -59,6 +63,8 @@ public class CreateLogsServiceImpl extends CrudServiceImpl<CreaterLogsMapper, Cr
private ITableService iTableService; private ITableService iTableService;
@Autowired @Autowired
private ITableColumnService iTableColumnService; private ITableColumnService iTableColumnService;
@Autowired
private MenuApi menuApi;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -143,6 +149,33 @@ public class CreateLogsServiceImpl extends CrudServiceImpl<CreaterLogsMapper, Cr
} }
} }
@Override
@Transactional(rollbackFor = Exception.class)
public boolean createMenu(String menuParentId, String tableId) {
if(StringUtils.isEmpty(menuParentId)){
// 上级菜单不可为空
throw new CreaterException(CreaterMsg.EXCEPTION_CREATE_MENU_PARENT_NULL);
}
CreaterLogsModel byTableId = this.getByTableId(tableId);
if(byTableId == null){
// 生成菜单失败,请先 生成代码
throw new CreaterException(CreaterMsg.EXCEPTION_CREATE_MENU_CODE_NULL);
}
// 完整新增菜单
MenuFullModel menuFullModel = new MenuFullModel();
menuFullModel.setParentId(menuParentId);
menuFullModel.setTitle(byTableId.getCodeTitle());
menuFullModel.setModuleName(byTableId.getModuleName());
menuFullModel.setSubModuleName(byTableId.getSubModuleName());
ResultVo<?> insertRet = menuApi.saveMenuByFull(menuFullModel);
return insertRet.isSuccess();
}
} }

@ -23,6 +23,8 @@ import org.opsli.api.base.result.ResultVo;
import org.opsli.common.annotation.ApiRestController; import org.opsli.common.annotation.ApiRestController;
import org.opsli.common.annotation.EnableLog; import org.opsli.common.annotation.EnableLog;
import org.opsli.core.base.controller.BaseRestController; import org.opsli.core.base.controller.BaseRestController;
import org.opsli.core.creater.exception.CreaterException;
import org.opsli.core.creater.msg.CreaterMsg;
import org.opsli.modulars.creater.createrlogs.api.CreaterLogsApi; import org.opsli.modulars.creater.createrlogs.api.CreaterLogsApi;
import org.opsli.modulars.creater.createrlogs.entity.CreaterLogs; import org.opsli.modulars.creater.createrlogs.entity.CreaterLogs;
import org.opsli.modulars.creater.createrlogs.service.ICreateLogsService; import org.opsli.modulars.creater.createrlogs.service.ICreateLogsService;
@ -69,4 +71,27 @@ public class CreaterLogsRestController extends BaseRestController<CreaterLogs, C
} }
/**
*
*
* @param menuParentId ID
* @param tableId ID
* @return ResultVo
*/
@ApiOperation(value = "生成菜单", notes = "生成菜单")
@RequiresPermissions("deve_creater_createMenu")
@EnableLog
@Override
public ResultVo<?> createMenu(String menuParentId, String tableId) {
// 演示模式 不允许操作
super.demoError();
// 调用生成菜单方法
boolean menuFlag = IService.createMenu(menuParentId, tableId);
if(!menuFlag){
return ResultVo.error();
}
return ResultVo.success();
}
} }

@ -0,0 +1,191 @@
package org.opsli.modulars.system.menu.factory;
import cn.hutool.core.collection.ListUtil;
import com.google.common.collect.Lists;
import lombok.Builder;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.opsli.api.wrapper.system.menu.MenuFullModel;
import org.opsli.api.wrapper.system.menu.MenuModel;
import org.opsli.common.enums.DictType;
import java.util.List;
/**
*
*
* @author
* @date 2021-05-04 7:15
**/
public enum MenuFactory {
/** 实例 */
INSTANCE;
/** 菜单权限分割符 */
private final static String MENU_DELIMITER = "_";
/** 菜单按钮JSON 数组 */
private final List<MenuBtn> menuBtnList;
MenuFactory(){
menuBtnList = Lists.newArrayList();
menuBtnList.add(
MenuBtn.builder()
.title("查看")
.permission("select")
.build()
);
menuBtnList.add(
MenuBtn.builder()
.title("新增")
.permission("insert")
.build()
);
menuBtnList.add(
MenuBtn.builder()
.title("修改")
.permission("update")
.build()
);
menuBtnList.add(
MenuBtn.builder()
.title("删除")
.permission("delete")
.build()
);
menuBtnList.add(
MenuBtn.builder()
.title("导入")
.permission("import")
.build()
);
menuBtnList.add(
MenuBtn.builder()
.title("导出")
.permission("export")
.build()
);
}
/**
*
* @param model
* @return MenuModel
*/
public MenuModel createMenu(MenuFullModel model){
if(model == null){
return new MenuModel();
}
// 标题
String title = model.getTitle();
// 子模块名
String subModuleName = model.getSubModuleName();
MenuModel menu = new MenuModel();
menu.setParentId(model.getParentId());
menu.setMenuName(title);
menu.setAlwaysShow(DictType.NO_YES_NO.getValue());
menu.setHidden(DictType.NO_YES_NO.getValue());
menu.setUrl(subModuleName);
menu.setType(DictType.MENU_MENU.getValue());
menu.setSortNo(1);
menu.setComponent("views/modules/"+model.getModuleName()+"/"+model.getSubModuleName()+"/index");
return menu;
}
/**
*
* @param model
* @return MenuModel
*/
public List<MenuModel> createMenuBtnList(MenuFullModel model){
if(model == null){
return ListUtil.empty();
}
List<MenuModel> menuBtnModelList = Lists.newArrayListWithCapacity(menuBtnList.size());
for (int i = 0; i < menuBtnList.size(); i++) {
MenuBtn menuBtn = menuBtnList.get(i);
MenuModel menuBtnModel = this.createMenuBtn(model.getParentId(), model, menuBtn);
menuBtnModel.setSortNo(i+1);
menuBtnModelList.add(menuBtnModel);
}
return menuBtnModelList;
}
/**
*
* @param menuParentId ID
* @param model
* @param menuBtn
* @return MenuModel
*/
private MenuModel createMenuBtn(String menuParentId, MenuFullModel model, MenuBtn menuBtn){
// 标题
String title = menuBtn.getTitle();
// 模块名
String moduleName = model.getModuleName();
// 子模块名
String subModuleName = model.getSubModuleName();
// 权限
String permission = menuBtn.getPermission();
MenuModel menu = new MenuModel();
menu.setParentId(menuParentId);
menu.setMenuName(title);
menu.setAlwaysShow(DictType.NO_YES_NO.getValue());
menu.setHidden(DictType.NO_YES_NO.getValue());
menu.setType(DictType.MENU_BUTTON.getValue());
menu.setPermissions(
this.createPermission(moduleName, subModuleName, permission)
);
menu.setSortNo(1);
return menu;
}
/**
*
* @param moduleName
* @param subModuleName
* @param permission
* @return String
*/
private String createPermission(String moduleName, String subModuleName, String permission){
StringBuilder permissionSb = new StringBuilder();
if(StringUtils.isNotEmpty(moduleName)){
permissionSb.append(moduleName).append(MENU_DELIMITER);
}
if(StringUtils.isNotEmpty(subModuleName)){
permissionSb.append(subModuleName).append(MENU_DELIMITER);
}
permissionSb.append(permission);
return permissionSb.toString();
}
/**
*
*/
@Data
@Builder
private static class MenuBtn{
/** 标题 */
private String title;
/** 权限 */
private String permission;
}
}

@ -15,6 +15,7 @@
*/ */
package org.opsli.modulars.system.menu.service; package org.opsli.modulars.system.menu.service;
import org.opsli.api.wrapper.system.menu.MenuFullModel;
import org.opsli.api.wrapper.system.menu.MenuModel; import org.opsli.api.wrapper.system.menu.MenuModel;
import org.opsli.core.base.entity.HasChildren; import org.opsli.core.base.entity.HasChildren;
import org.opsli.core.base.service.interfaces.CrudServiceInterface; import org.opsli.core.base.service.interfaces.CrudServiceInterface;
@ -56,4 +57,11 @@ public interface IMenuService extends CrudServiceInterface<SysMenu, MenuModel> {
*/ */
List<HasChildren> hasChildrenByChoose(Set<String> parentIds); List<HasChildren> hasChildrenByChoose(Set<String> parentIds);
/**
*
* @param menu
* @return boolean
*/
void saveMenuByFull(MenuFullModel menu);
} }

@ -19,8 +19,10 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.opsli.api.wrapper.system.menu.MenuFullModel;
import org.opsli.api.wrapper.system.menu.MenuModel; import org.opsli.api.wrapper.system.menu.MenuModel;
import org.opsli.api.wrapper.system.user.UserModel; import org.opsli.api.wrapper.system.user.UserModel;
import org.opsli.common.constants.MenuConstants;
import org.opsli.common.constants.MyBatisConstants; import org.opsli.common.constants.MyBatisConstants;
import org.opsli.common.enums.DictType; import org.opsli.common.enums.DictType;
import org.opsli.common.exception.ServiceException; import org.opsli.common.exception.ServiceException;
@ -34,6 +36,7 @@ import org.opsli.core.utils.MenuUtil;
import org.opsli.core.utils.UserUtil; import org.opsli.core.utils.UserUtil;
import org.opsli.modulars.system.SystemMsg; import org.opsli.modulars.system.SystemMsg;
import org.opsli.modulars.system.menu.entity.SysMenu; import org.opsli.modulars.system.menu.entity.SysMenu;
import org.opsli.modulars.system.menu.factory.MenuFactory;
import org.opsli.modulars.system.menu.mapper.MenuMapper; import org.opsli.modulars.system.menu.mapper.MenuMapper;
import org.opsli.modulars.system.menu.service.IMenuService; import org.opsli.modulars.system.menu.service.IMenuService;
import org.opsli.modulars.system.org.entity.SysOrg; import org.opsli.modulars.system.org.entity.SysOrg;
@ -86,16 +89,21 @@ public class MenuServiceImpl extends CrudServiceImpl<MenuMapper, SysMenu, MenuMo
return null; return null;
} }
// 按钮 权限唯一验证
// Integer count = this.uniqueVerificationByPermissions(model);
// if(count != null && count > 0){
// // 重复
// throw new ServiceException(SystemMsg.EXCEPTION_MENU_PERMISSIONS_UNIQUE);
// }
// 如果上级ID 为空 则默认为 0 // 如果上级ID 为空 则默认为 0
if(StringUtils.isEmpty(model.getParentId())){ if(StringUtils.isEmpty(model.getParentId())){
model.setParentId("0"); model.setParentId(MenuConstants.GEN_ID);
}
// 容错处理
// 如果根结点为0 且 为菜单类型 判断首位是否为 / 如果没有则自动加 /
if(MenuConstants.GEN_ID.equals(model.getParentId())){
if(StringUtils.isNotEmpty(model.getUrl())){
char firstChar = '/';
char first = model.getUrl().charAt(0);
if(firstChar != first){
model.setUrl("/"+model.getUrl());
}
}
} }
// 菜单有变动 直接刷新超级管理员 菜单缓存 // 菜单有变动 直接刷新超级管理员 菜单缓存
@ -130,12 +138,17 @@ public class MenuServiceImpl extends CrudServiceImpl<MenuMapper, SysMenu, MenuMo
return null; return null;
} }
// 按钮 权限唯一验证 // 容错处理
// Integer count = this.uniqueVerificationByPermissions(model); // 如果根结点为0 且 为菜单类型 判断首位是否为 / 如果没有则自动加 /
// if(count != null && count > 0){ if(MenuConstants.GEN_ID.equals(model.getParentId())){
// // 重复 if(StringUtils.isNotEmpty(model.getUrl())){
// throw new ServiceException(SystemMsg.EXCEPTION_MENU_PERMISSIONS_UNIQUE); char firstChar = '/';
// } char first = model.getUrl().charAt(0);
if(firstChar != first){
model.setUrl("/"+model.getUrl());
}
}
}
MenuModel menuModel = super.update(model); MenuModel menuModel = super.update(model);
if(menuModel != null){ if(menuModel != null){
@ -146,6 +159,46 @@ public class MenuServiceImpl extends CrudServiceImpl<MenuMapper, SysMenu, MenuMo
return menuModel; return menuModel;
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void saveMenuByFull(MenuFullModel menuFullModel) {
if(menuFullModel == null){
return;
}
// 容错处理
// 如果根节点没有 Layout 节点 则自动创建一个
if(MenuConstants.GEN_ID.equals(menuFullModel.getParentId())){
MenuModel genMenu = new MenuModel();
genMenu.setParentId(menuFullModel.getParentId());
genMenu.setMenuName(menuFullModel.getTitle());
genMenu.setAlwaysShow(DictType.NO_YES_NO.getValue());
genMenu.setHidden(DictType.NO_YES_NO.getValue());
genMenu.setUrl(menuFullModel.getSubModuleName()+"Gen");
genMenu.setType(DictType.MENU_MENU.getValue());
genMenu.setComponent("Layout");
genMenu.setRedirect(menuFullModel.getSubModuleName());
genMenu.setSortNo(1);
MenuModel genMenuModel = this.insert(genMenu);
// 重置上级ID
menuFullModel.setParentId(genMenuModel.getId());
}
MenuModel menu = MenuFactory.INSTANCE.createMenu(menuFullModel);
// 保存菜单
MenuModel menuModel = this.insert(menu);
// 保存按钮
// 重置上级ID
menuFullModel.setParentId(menuModel.getId());
List<MenuModel> menuBtnList = MenuFactory.INSTANCE.createMenuBtnList(menuFullModel);
for (MenuModel btnModel : menuBtnList) {
this.insert(btnModel);
}
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean delete(String id) { public boolean delete(String id) {

@ -34,6 +34,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.opsli.api.base.result.ResultVo; import org.opsli.api.base.result.ResultVo;
import org.opsli.api.web.system.menu.MenuApi; import org.opsli.api.web.system.menu.MenuApi;
import org.opsli.api.wrapper.system.menu.MenuFullModel;
import org.opsli.api.wrapper.system.menu.MenuModel; import org.opsli.api.wrapper.system.menu.MenuModel;
import org.opsli.api.wrapper.system.user.UserModel; import org.opsli.api.wrapper.system.user.UserModel;
import org.opsli.common.annotation.ApiRestController; import org.opsli.common.annotation.ApiRestController;
@ -93,8 +94,6 @@ public class MenuRestController extends BaseRestController<SysMenu, MenuModel, I
/** 虚拟总节点 ID */ /** 虚拟总节点 ID */
private static final String VIRTUAL_TOTAL_NODE = "-1"; private static final String VIRTUAL_TOTAL_NODE = "-1";
/** 根节点 ID */
private static final String BASE_NODE = "0";
/** 菜单排除字段 */ /** 菜单排除字段 */
private static final String[] EXCLUSION_FIELDS = { private static final String[] EXCLUSION_FIELDS = {
@ -180,7 +179,7 @@ public class MenuRestController extends BaseRestController<SysMenu, MenuModel, I
menuModelList = Lists.newArrayList(); menuModelList = Lists.newArrayList();
parentId = VIRTUAL_TOTAL_NODE; parentId = VIRTUAL_TOTAL_NODE;
MenuModel model = new MenuModel(); MenuModel model = new MenuModel();
model.setId(BASE_NODE); model.setId(MenuConstants.GEN_ID);
model.setMenuName("根节点"); model.setMenuName("根节点");
model.setHidden("0"); model.setHidden("0");
model.setSortNo(-1); model.setSortNo(-1);
@ -221,7 +220,7 @@ public class MenuRestController extends BaseRestController<SysMenu, MenuModel, I
menuModelList = Lists.newArrayList(); menuModelList = Lists.newArrayList();
parentId = VIRTUAL_TOTAL_NODE; parentId = VIRTUAL_TOTAL_NODE;
MenuModel model = new MenuModel(); MenuModel model = new MenuModel();
model.setId(BASE_NODE); model.setId(MenuConstants.GEN_ID);
model.setMenuName("根节点"); model.setMenuName("根节点");
model.setHidden("0"); model.setHidden("0");
model.setSortNo(-1); model.setSortNo(-1);
@ -294,7 +293,7 @@ public class MenuRestController extends BaseRestController<SysMenu, MenuModel, I
@Override @Override
public ResultVo<MenuModel> get(MenuModel model) { public ResultVo<MenuModel> get(MenuModel model) {
if(model != null){ if(model != null){
if(StringUtils.equals(BASE_NODE, model.getId())){ if(StringUtils.equals(MenuConstants.GEN_ID, model.getId())){
model.setMenuName("根节点"); model.setMenuName("根节点");
model.setHidden("0"); model.setHidden("0");
model.setSortNo(-1); model.setSortNo(-1);
@ -661,4 +660,15 @@ public class MenuRestController extends BaseRestController<SysMenu, MenuModel, I
} }
} }
} }
/**
*
* @param menuFullModel
* @return ResultVo
*/
@Override
public ResultVo<?> saveMenuByFull(MenuFullModel menuFullModel) {
IService.saveMenuByFull(menuFullModel);
return ResultVo.success();
}
} }

Loading…
Cancel
Save