Explorar o código

成绩导入bug修复

dzx hai 4 meses
pai
achega
223c562ae2

+ 1 - 1
src/main/java/com/xjrsoft/module/student/controller/BaseNewStudentController.java

@@ -181,7 +181,7 @@ public class BaseNewStudentController {
             object.put("性别", objectMap.getGender());
             object.put("班级", objectMap.getGraduateClass());
             object.put("总成绩", objectMap.getScore().intValue() + "");
-            object.put("错误信息", "未能查询到该学生");
+            object.put("错误信息", "未能查询到该学生或该学生存在多个");
             result.add(object);
         }
         return RT.ok(result);

+ 3 - 2
src/main/java/com/xjrsoft/module/student/service/impl/BaseNewStudentServiceImpl.java

@@ -205,17 +205,18 @@ public class BaseNewStudentServiceImpl extends MPJBaseServiceImpl<BaseNewStudent
         List<BaseNewStudentScoreExcelVo> errorList = new ArrayList<>();
         List<BaseNewStudent> updateList = new ArrayList<>();
         for (BaseNewStudentScoreExcelVo el : excelDataList) {
-            BaseNewStudent student = this.baseMapper.selectOne(
+            List<BaseNewStudent> studentList = this.baseMapper.selectList(
                     new QueryWrapper<BaseNewStudent>().lambda()
                             .eq(BaseNewStudent::getGender, genderMap.get(el.getGender()))
                             .eq(BaseNewStudent::getGraduateSchool, el.getGraduateSchool())
                             .eq(BaseNewStudent::getGraduateClass, el.getGraduateClass())
                             .eq(BaseNewStudent::getName, el.getName())
             );
-            if(student == null){
+            if(!studentList.isEmpty() && studentList.size() > 1){
                 errorList.add(el);
                 continue;
             }
+            BaseNewStudent student = studentList.get(0);
             student.setScore(el.getScore());
             updateList.add(student);
         }