/// <summary> /// 删除菜单及下级数据 /// </summary> /// <param name="input">父级id</param> /// <returns></returns> public async Task <OperateStatus> DeleteMenu(IdInput input) { var operateStatus = new OperateStatus(); //判断该项能否进行删除 var menu = await GetByIdAsync(input.Id); if (menu != null && !menu.CanbeDelete) { operateStatus.ResultSign = ResultSign.Error; operateStatus.Message = Chs.CanotDelete; return(operateStatus); } //查看是否具有下级 if ((await GetMeunuByPId(input)).Any()) { operateStatus.ResultSign = ResultSign.Error; operateStatus.Message = ResourceSystem.具有下级项; return(operateStatus); } //查看该菜单是否已被特性占用 var permissions = await _permissionLogic.GetSystemPermissionsByPrivilegeAccessAndValue(EnumPrivilegeAccess.菜单, input.Id); if (permissions.Any()) { //获取被占用类型及值 operateStatus.ResultSign = ResultSign.Error; operateStatus.Message = ResourceSystem.已被赋予权限; return(operateStatus); } return(await DeleteAsync(new SystemMenu { MenuId = input.Id })); }
/// <summary> /// 删除功能项 /// </summary> /// <param name="input">功能项信息</param> /// <returns></returns> public async Task <OperateStatus> DeleteMenuButton(IdInput input) { var operateStatus = new OperateStatus(); //查看该功能项是否已被特性占用 var permissions = await _permissionLogic.GetSystemPermissionsByPrivilegeAccessAndValue(EnumPrivilegeAccess.菜单按钮, input.Id); if (permissions.Any()) { operateStatus.ResultSign = ResultSign.Error; operateStatus.Message = string.Format(Chs.Error, ResourceSystem.已被赋予权限); return(operateStatus); } return(await DeleteAsync(input.Id)); }