|
@@ -282,6 +282,10 @@ public class KmtExerciseQuestionDealServiceImpl implements KmtExerciseQuestionDe
|
|
|
if (request.getType() == 1){
|
|
|
//大题上移, 先查找上一题的题目id列表
|
|
|
KmtExerciseQuestion previousQuestion = kmtExerciseMapper.findByBookIdAndNum(kmtExerciseQuestion.getBookId(), kmtExerciseQuestion.getNum() - 1);
|
|
|
+ if (!previousQuestion.getBookCourseId().equals(kmtExerciseQuestion.getBookCourseId())){
|
|
|
+ return responseEntity.failure(ResponseConstant.CODE_000, "已移动到第一题位置");
|
|
|
+ }
|
|
|
+
|
|
|
List<KmtExerciseQuestion> previousQuestions = kmtExerciseMapper.findQuestionsByBookCourseIdAndBigIndex(previousQuestion.getBookCourseId(), previousQuestion.getBigQuestionIndex());
|
|
|
List<KmtExerciseQuestion> thisQuestions = kmtExerciseMapper.findQuestionsByBookCourseIdAndBigIndex(kmtExerciseQuestion.getBookCourseId(), kmtExerciseQuestion.getBigQuestionIndex());
|
|
|
if (previousQuestions != null && thisQuestions != null){
|
|
@@ -295,8 +299,10 @@ public class KmtExerciseQuestionDealServiceImpl implements KmtExerciseQuestionDe
|
|
|
} else if (request.getType() == 2){
|
|
|
List<KmtExerciseQuestion> thisQuestions = kmtExerciseMapper.findQuestionsByBookCourseIdAndBigIndex(kmtExerciseQuestion.getBookCourseId(), kmtExerciseQuestion.getBigQuestionIndex());
|
|
|
int thisSize = thisQuestions.size();
|
|
|
-
|
|
|
KmtExerciseQuestion nextQuestion = kmtExerciseMapper.findByBookIdAndNum(kmtExerciseQuestion.getBookId(), kmtExerciseQuestion.getNum() + thisSize);
|
|
|
+ if (!nextQuestion.getBookCourseId().equals(kmtExerciseQuestion.getBookCourseId())){
|
|
|
+ return responseEntity.failure(ResponseConstant.CODE_000, "已移动到最后一题位置");
|
|
|
+ }
|
|
|
List<KmtExerciseQuestion> nextQuestions = kmtExerciseMapper.findQuestionsByBookCourseIdAndBigIndex(nextQuestion.getBookCourseId(), nextQuestion.getBigQuestionIndex());
|
|
|
if (nextQuestions != null && thisQuestions != null){
|
|
|
int nextSize = nextQuestions.size();
|