|
@@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Created by yuanpan on 2017/4/12.
|
|
* Created by yuanpan on 2017/4/12.
|
|
@@ -51,4 +53,22 @@ public class ExamCourseApi {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @GetMapping("/marking")
|
|
|
|
+ public List<ExamCourseDTO> query(@RequestParam(value="exam_id",required = true) Long examId) {
|
|
|
|
+
|
|
|
|
+ List<ExamStudent> examStudents = examStudentRepo.findDistinctCourseCode(examId);
|
|
|
|
+
|
|
|
|
+ List<ExamCourseDTO> examCourseDTOs = examStudents.stream().map(examStudent -> {
|
|
|
|
+ ExamCourseDTO examCourseDTO = new ExamCourseDTO();
|
|
|
|
+ examCourseDTO.setExamId(examId);
|
|
|
|
+ examCourseDTO.setExamName(examStudent.getExam().getName());
|
|
|
|
+ examCourseDTO.setExamType(examStudent.getExam().getExamType());
|
|
|
|
+ examCourseDTO.setCourseName(examStudent.getCourseName());
|
|
|
|
+ examCourseDTO.setCourseCode(examStudent.getCourseCode());
|
|
|
|
+ return examCourseDTO;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ return examCourseDTOs;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|