diff --git a/Learn.Archives.API/Controllers/ExamClassInfoController.cs b/Learn.Archives.API/Controllers/ExamClassInfoController.cs index 4c488aa..d87d527 100644 --- a/Learn.Archives.API/Controllers/ExamClassInfoController.cs +++ b/Learn.Archives.API/Controllers/ExamClassInfoController.cs @@ -59,6 +59,7 @@ namespace Learn.Archives.API.Controllers var exam = await examService.GetByIdAsync(dto.eId); if (exam == null ) Oh.ModelError("为传入有效的数据"); var dataList = await accessor.ParsingExcelAsync(); + dataList= dataList.Where(s=>!string.IsNullOrEmpty(s.School)).ToArray(); if (dataList == null || dataList.Count() == 0) Oh.ModelError("导入失败:无有效数据"); diff --git a/Learn.Archives.API/Controllers/StudentController.cs b/Learn.Archives.API/Controllers/StudentController.cs index cf57187..0ed1d5a 100644 --- a/Learn.Archives.API/Controllers/StudentController.cs +++ b/Learn.Archives.API/Controllers/StudentController.cs @@ -360,6 +360,7 @@ namespace Learn.Archives.API.Controllers public async Task ImportUpdateStudent(IFormFile? file) { var dataList = await _httpContextAccessor.ParsingExcelAsync(); + dataList = dataList.Where(s => !string.IsNullOrEmpty(s.School)).ToArray(); if (dataList == null || dataList.Length == 0) Oh.ModelError("导入失败:无有效数据"); @@ -494,7 +495,6 @@ namespace Learn.Archives.API.Controllers .IgnoreColumns(ignoreAllNullColumns: true, ignoreAllDefaultValue: true) .WhereColumns(it => new { it.Id }) .ExecuteCommandAsync(); - Oh.Error("需要测试"); return Ok(); }