瀏覽代碼

fix: 添加试卷编号为行号问题

闪电 3 周之前
父節點
當前提交
bccf2cdfe1

+ 6 - 6
smart-steward-service/src/main/java/com/smartSteward/service/exam/impl/ExamPaperServiceImpl.java

166
                                QuestionTypes.FILL_BLANK.getCode().equals(q.getQuestionType()));
166
                                QuestionTypes.FILL_BLANK.getCode().equals(q.getQuestionType()));
167
         examPaper.setIsSubjective(hasSubjective ? 1 : 0);
167
         examPaper.setIsSubjective(hasSubjective ? 1 : 0);
168
 
168
 
169
-        int paperId = examPaperMapper.insertExamPaper(examPaper);
169
+        examPaperMapper.insertExamPaper(examPaper);
170
 
170
 
171
         // 新增试卷主包含的试题
171
         // 新增试卷主包含的试题
172
         for (ExamPaperQuestion question : examPaper.getQuestions())
172
         for (ExamPaperQuestion question : examPaper.getQuestions())
173
         {
173
         {
174
-            question.setPaperId((long) paperId);
174
+            question.setPaperId(examPaper.getId());
175
             question.setCreateTime(DateUtils.getNowDate());
175
             question.setCreateTime(DateUtils.getNowDate());
176
             question.setDelFlag("0");
176
             question.setDelFlag("0");
177
             question.setCreateBy(SecurityUtils.getUsername());
177
             question.setCreateBy(SecurityUtils.getUsername());
178
         }
178
         }
179
         examPaperQuestionMapper.batchInsertExamPaperQuestion(examPaper.getQuestions());
179
         examPaperQuestionMapper.batchInsertExamPaperQuestion(examPaper.getQuestions());
180
-        return paperId;
180
+        return Math.toIntExact(examPaper.getId());
181
     }
181
     }
182
 
182
 
183
     /**
183
     /**
234
                                QuestionTypes.FILL_BLANK.getCode().equals(q.getQuestionType()));
234
                                QuestionTypes.FILL_BLANK.getCode().equals(q.getQuestionType()));
235
         examPaper.setIsSubjective(hasSubjective ? 1 : 0);
235
         examPaper.setIsSubjective(hasSubjective ? 1 : 0);
236
 
236
 
237
-        int paperId = examPaperMapper.updateExamPaper(examPaper);
237
+        examPaperMapper.updateExamPaper(examPaper);
238
 
238
 
239
         // 更新试卷主包含的试题
239
         // 更新试卷主包含的试题
240
         examPaperQuestionMapper.deleteExamPaperQuestionByPaperId(examPaper.getId());
240
         examPaperQuestionMapper.deleteExamPaperQuestionByPaperId(examPaper.getId());
241
         for (ExamPaperQuestion question : examPaper.getQuestions())
241
         for (ExamPaperQuestion question : examPaper.getQuestions())
242
         {
242
         {
243
-            question.setPaperId((long) paperId);
243
+            question.setPaperId(examPaper.getId());
244
             question.setCreateTime(DateUtils.getNowDate());
244
             question.setCreateTime(DateUtils.getNowDate());
245
             question.setDelFlag("0");
245
             question.setDelFlag("0");
246
             question.setCreateBy(SecurityUtils.getUsername());
246
             question.setCreateBy(SecurityUtils.getUsername());
247
         }
247
         }
248
         examPaperQuestionMapper.batchInsertExamPaperQuestion(examPaper.getQuestions());
248
         examPaperQuestionMapper.batchInsertExamPaperQuestion(examPaper.getQuestions());
249
 
249
 
250
-        return paperId;
250
+        return Math.toIntExact(examPaper.getId());
251
     }
251
     }
252
 
252
 
253
     /**
253
     /**