/// <summary> /// 删除组织机构下级数据 /// 删除条件: /// 1:没有下级菜单 /// 2:没有权限数据 /// 3:没有人员 /// </summary> /// <param name="input">组织机构id</param> /// <returns></returns> public async Task <OperateStatus> DeleteOrganization(IdInput input) { var operateStatus = new OperateStatus(); //判断下级菜单 IList <JsTreeEntity> orgs = (await _organizationRepository.GetSystemOrganizationByPid(input)).ToList(); if (orgs.Any()) { operateStatus.ResultSign = ResultSign.Error; operateStatus.Message = ResourceSystem.具有下级项; return(operateStatus); } //判断是否具有人员 var permissionUsers = await _permissionUserLogic.GetPermissionUsersByPrivilegeMasterAdnPrivilegeMasterValue( EnumPrivilegeMaster.组织机构, input.Id); if (permissionUsers.Any()) { operateStatus.ResultSign = ResultSign.Error; operateStatus.Message = ResourceSystem.具有人员; return(operateStatus); } //判断是否有角色 var orgRole = await _roleLogic.GetRolesByOrganizationId(new SystemRolesGetByOrganizationId { Id = input.Id }); if (orgRole.Any()) { operateStatus.ResultSign = ResultSign.Error; operateStatus.Message = ResourceSystem.具有角色; return(operateStatus); } //判断是否有组 var orgGroup = await _groupLogic.GetGroupByOrganizationId(new SystemGroupGetGroupByOrganizationIdInput { Id = input.Id }); if (orgGroup.Any()) { operateStatus.ResultSign = ResultSign.Error; operateStatus.Message = ResourceSystem.具有组; return(operateStatus); } //判断是否有岗位 var orgPost = await _postLogic.GetPostByOrganizationId(new SystemPostGetByOrganizationId { Id = input.Id }); if (orgPost.Any()) { operateStatus.ResultSign = ResultSign.Error; operateStatus.Message = ResourceSystem.具有岗位; return(operateStatus); } //判断是否具有按钮权限 var functionPermissions = await _permissionLogic.GetPermissionByPrivilegeMasterValue( new SystemPermissionByPrivilegeMasterValueInput() { PrivilegeAccess = EnumPrivilegeAccess.菜单按钮, PrivilegeMasterValue = input.Id, PrivilegeMaster = EnumPrivilegeMaster.组织机构 }); if (functionPermissions.Any()) { operateStatus.ResultSign = ResultSign.Error; operateStatus.Message = ResourceSystem.具有功能项权限; return(operateStatus); } //判断是否具有菜单权限 var menuPermissions = await _permissionLogic.GetPermissionByPrivilegeMasterValue( new SystemPermissionByPrivilegeMasterValueInput() { PrivilegeAccess = EnumPrivilegeAccess.菜单, PrivilegeMasterValue = input.Id, PrivilegeMaster = EnumPrivilegeMaster.组织机构 }); if (menuPermissions.Any()) { operateStatus.ResultSign = ResultSign.Error; operateStatus.Message = ResourceSystem.具有菜单权限; return(operateStatus); } //进行删除操作 return(await DeleteAsync(new SystemOrganization() { OrganizationId = input.Id })); }
public async Task <JsonResult> GetGroupByOrganizationId(NullableIdInput input) { return(Json(await _groupLogic.GetGroupByOrganizationId(input))); }
public async Task <JsonResult> GetGroupByOrganizationId(SystemGroupGetGroupByOrganizationIdInput input) { return(JsonForGridLoadOnce(await _groupLogic.GetGroupByOrganizationId(input))); }