WANG 6 anos atrás
pai
commit
f0e65dc623

+ 15 - 4
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/ExamStudentController.java

@@ -2,6 +2,7 @@ package cn.com.qmth.examcloud.core.examwork.api.controller;
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Locale;
 import java.util.stream.Collectors;
@@ -30,6 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.google.common.collect.Lists;
 
+import cn.com.qmth.examcloud.api.commons.enums.CourseLevel;
 import cn.com.qmth.examcloud.api.commons.exchange.PageInfo;
 import cn.com.qmth.examcloud.api.commons.security.bean.User;
 import cn.com.qmth.examcloud.commons.exception.StatusException;
@@ -98,14 +100,23 @@ public class ExamStudentController extends ControllerSupport {
 	@ApiOperation(value = "查询考生的专业集合")
 	@GetMapping("specialtyNameList/{studentId}")
 	public List<String> getSpecialtyNameListByStudentId(@PathVariable Long studentId) {
-		return null;
+		List<String> querySpecialtyNameList = examStudentRepo.querySpecialtyNameList(studentId);
+		querySpecialtyNameList.removeAll(Collections.singleton(null));
+		return querySpecialtyNameList;
 	}
 
 	@ApiOperation(value = "查询考生的专业集合")
 	@GetMapping("courseLevelList/{studentId}")
-	public List<String> getCourseLevelByStudentId(@PathVariable Long studentId) {
-
-		return null;
+	public List<CourseLevel> getCourseLevelByStudentId(@PathVariable Long studentId) {
+		List<String> courseLevelList = examStudentRepo.queryCourseLevelList(studentId);
+		List<CourseLevel> ret = Lists.newArrayList();
+		for (String cur : courseLevelList) {
+			if (null != cur) {
+				CourseLevel courseLevel = CourseLevel.getCourseLevel(cur);
+				ret.add(courseLevel);
+			}
+		}
+		return ret;
 	}
 
 	/**

+ 70 - 64
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/core/examwork/dao/ExamStudentRepo.java

@@ -1,64 +1,70 @@
-package cn.com.qmth.examcloud.core.examwork.dao;
-
-import java.util.List;
-
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.QueryByExampleExecutor;
-
-import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamStudentEntity;
-
-public interface ExamStudentRepo
-		extends
-			JpaRepository<ExamStudentEntity, Long>,
-			QueryByExampleExecutor<ExamStudentEntity>,
-			JpaSpecificationExecutor<ExamStudentEntity> {
-
-	List<ExamStudentEntity> findByStudentId(Long examId);
-
-	List<ExamStudentEntity> findByIdIn(List<Long> ids);
-
-	@Modifying
-	@Query("delete from ExamStudentEntity s where s.examId = ?1")
-	void deleteByExamId(Long examId);
-
-	ExamStudentEntity findByExamIdAndStudentIdAndCourseId(Long examId, Long studentId,
-			Long courseId);
-
-	@Modifying
-	@Query("update ExamStudentEntity s set s.name = ?1, s.studentCode=?2 where s.studentId = ?3")
-	void updateStudent(String name, String studentCode, Long studentId);
-
-	@Modifying
-	@Query("update ExamStudentEntity s set s.courseName = ?1, s.courseLevel  = ?2  where s.courseId = ?3")
-	void updateCourse(String courseName, String courseLevel, Long courseId);
-
-	List<ExamStudentEntity> findTop2ByExamIdAndCourseIdAndPaperType(Long examId, Long courseId,
-			String paperType);
-
-	List<ExamStudentEntity> findTop2ByExamIdAndCourseId(Long examId, Long courseId);
-
-	@Query(value = "select distinct org_id from ec_e_exam_student t where t.org_id>?2 and t.exam_id=?1 order by org_id limit 500", nativeQuery = true)
-	List<Long> queryOrgIdList(Long examId, Long start);
-
-	@Query(value = "select distinct exam_site from ec_e_exam_student t where t.exam_site>?2 and t.exam_id=?1 order by exam_site limit 500", nativeQuery = true)
-	List<String> queryExamSiteList(Long examId, String start);
-
-	@Query(value = "select distinct ext1 from ec_e_exam_student t where t.ext1>?2 and t.exam_id=?1 order by ext1 limit 500", nativeQuery = true)
-	List<String> queryExt1List(Long examId, String start);
-
-	@Query(value = "select distinct ext2 from ec_e_exam_student t where t.ext2>?2 and t.exam_id=?1 order by ext2 limit 500", nativeQuery = true)
-	List<String> queryExt2List(Long examId, String start);
-
-	@Query(value = "select distinct ext3 from ec_e_exam_student t where t.ext3>?2 and t.exam_id=?1 order by ext3 limit 500", nativeQuery = true)
-	List<String> queryExt3List(Long examId, String start);
-
-	@Query(value = "select distinct ext4 from ec_e_exam_student t where t.ext4>?2 and t.exam_id=?1 order by ext4 limit 500", nativeQuery = true)
-	List<String> queryExt4List(Long examId, String start);
-
-	@Query(value = "select distinct ext5 from ec_e_exam_student t where t.ext5>?2 and t.exam_id=?1 order by ext5 limit 500", nativeQuery = true)
-	List<String> queryExt5List(Long examId, String start);
-
-}
+package cn.com.qmth.examcloud.core.examwork.dao;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.QueryByExampleExecutor;
+
+import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamStudentEntity;
+
+public interface ExamStudentRepo
+		extends
+			JpaRepository<ExamStudentEntity, Long>,
+			QueryByExampleExecutor<ExamStudentEntity>,
+			JpaSpecificationExecutor<ExamStudentEntity> {
+
+	List<ExamStudentEntity> findByStudentId(Long examId);
+
+	List<ExamStudentEntity> findByIdIn(List<Long> ids);
+
+	@Modifying
+	@Query("delete from ExamStudentEntity s where s.examId = ?1")
+	void deleteByExamId(Long examId);
+
+	ExamStudentEntity findByExamIdAndStudentIdAndCourseId(Long examId, Long studentId,
+			Long courseId);
+
+	@Modifying
+	@Query("update ExamStudentEntity s set s.name = ?1, s.studentCode=?2 where s.studentId = ?3")
+	void updateStudent(String name, String studentCode, Long studentId);
+
+	@Modifying
+	@Query("update ExamStudentEntity s set s.courseName = ?1, s.courseLevel  = ?2  where s.courseId = ?3")
+	void updateCourse(String courseName, String courseLevel, Long courseId);
+
+	List<ExamStudentEntity> findTop2ByExamIdAndCourseIdAndPaperType(Long examId, Long courseId,
+			String paperType);
+
+	List<ExamStudentEntity> findTop2ByExamIdAndCourseId(Long examId, Long courseId);
+
+	@Query(value = "select distinct org_id from ec_e_exam_student t where t.org_id>?2 and t.exam_id=?1 order by org_id limit 500", nativeQuery = true)
+	List<Long> queryOrgIdList(Long examId, Long start);
+
+	@Query(value = "select distinct exam_site from ec_e_exam_student t where t.exam_site>?2 and t.exam_id=?1 order by exam_site limit 500", nativeQuery = true)
+	List<String> queryExamSiteList(Long examId, String start);
+
+	@Query(value = "select distinct ext1 from ec_e_exam_student t where t.ext1>?2 and t.exam_id=?1 order by ext1 limit 500", nativeQuery = true)
+	List<String> queryExt1List(Long examId, String start);
+
+	@Query(value = "select distinct ext2 from ec_e_exam_student t where t.ext2>?2 and t.exam_id=?1 order by ext2 limit 500", nativeQuery = true)
+	List<String> queryExt2List(Long examId, String start);
+
+	@Query(value = "select distinct ext3 from ec_e_exam_student t where t.ext3>?2 and t.exam_id=?1 order by ext3 limit 500", nativeQuery = true)
+	List<String> queryExt3List(Long examId, String start);
+
+	@Query(value = "select distinct ext4 from ec_e_exam_student t where t.ext4>?2 and t.exam_id=?1 order by ext4 limit 500", nativeQuery = true)
+	List<String> queryExt4List(Long examId, String start);
+
+	@Query(value = "select distinct ext5 from ec_e_exam_student t where t.ext5>?2 and t.exam_id=?1 order by ext5 limit 500", nativeQuery = true)
+	List<String> queryExt5List(Long examId, String start);
+
+	@Query(value = "select distinct specialty_name from ec_e_exam_student t where t.student_id=?1", nativeQuery = true)
+	List<String> querySpecialtyNameList(Long studentId);
+
+	@Query(value = "select distinct course_level from ec_e_exam_student t where t.student_id=?1", nativeQuery = true)
+	List<String> queryCourseLevelList(Long studentId);
+
+}