wangwei 6 years ago
parent
commit
f96fc2f303

+ 7 - 1
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/provider/HandleSyncCloudServiceProvider.java

@@ -23,6 +23,7 @@ import cn.com.qmth.examcloud.commons.api.response.SyncSpecialtyResp;
 import cn.com.qmth.examcloud.commons.api.response.SyncStudentResp;
 import cn.com.qmth.examcloud.commons.base.exception.StatusException;
 import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.core.examwork.dao.ExamCourseRelationRepo;
 import cn.com.qmth.examcloud.core.examwork.dao.ExamStudentRepo;
 import io.swagger.annotations.ApiOperation;
 
@@ -45,6 +46,9 @@ public class HandleSyncCloudServiceProvider extends ControllerSupport
 	@Autowired
 	ExamStudentRepo examStudentRepo;
 
+	@Autowired
+	ExamCourseRelationRepo examCourseRelationRepo;
+
 	@ApiOperation(value = "同步课程")
 	@PostMapping("syncCourse")
 	@Override
@@ -67,7 +71,9 @@ public class HandleSyncCloudServiceProvider extends ControllerSupport
 			throw new StatusException("B-100004", "rootOrgId is null");
 		}
 
-		examStudentRepo.updateCourse(courseName, courseLevel, rootOrgId, courseId);
+		examStudentRepo.updateCourse(courseName, courseLevel, courseId);
+
+		examCourseRelationRepo.updateCourse(courseName, courseLevel, courseId);
 
 		SyncCourseResp resp = new SyncCourseResp();
 		return resp;

+ 6 - 0
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/core/examwork/dao/ExamCourseRelationRepo.java

@@ -2,6 +2,8 @@ package cn.com.qmth.examcloud.core.examwork.dao;
 
 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.ExamCourseRelationEntity;
@@ -24,4 +26,8 @@ public interface ExamCourseRelationRepo
 
 	void deleteByExamIdAndCourseId(Long examId, Long courseId);
 
+	@Modifying
+	@Query("update ExamCourseRelationEntity s set s.courseName = ?1, s.courseLevel  = ?2  where s.courseId=?3")
+	void updateCourse(String courseName, String courseLevel, Long courseId);
+
 }

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

@@ -32,8 +32,8 @@ public interface ExamStudentRepo
 	void updateStudent(String name, Long studentId);
 
 	@Modifying
-	@Query("update ExamStudentEntity s set s.courseName = ?1, s.courseLevel  = ?2  where s.rootOrgId = ?3 and s.courseId=?4")
-	void updateCourse(String courseName, String courseLevel, Long rootOrgId, Long courseId);
+	@Query("update ExamStudentEntity s set s.courseName = ?1, s.courseLevel  = ?2  where s.courseId = ?3")
+	void updateCourse(String courseName, String courseLevel, Long courseId);
 
 	int countByExamIdAndCourseIdAndPaperType(Long examId, Long courseId, String paperType);