/// <summary> /// 删除时的检查 /// </summary> /// <param name="info"></param> protected override void DeleteRemoveCheck(DepartmentInfo info) { string depId = info.Id.ToString(); //如果有下级部门不允许删除 if (_Dal.Queryable().Where(e => e.ParentId == depId).Count() > 0) { throw ApiException.RemoveUsed("删除的部门下有子部门信息,不允许删除。"); } //如果部门下有员工不允许删除 EmployeeService employeeService = ServiceLoader.GetService <EmployeeService>(); if (employeeService.CountByDepartmentId(depId) > 0) { throw ApiException.RemoveUsed("删除的部门下有员工信息,不允许删除。"); } }