Browse Source

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

闪电 3 weeks ago
parent
commit
bccf2cdfe1

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

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