|
@@ -5,10 +5,7 @@ import com.qmth.themis.business.cache.bean.ExamCacheBean;
|
|
|
import com.qmth.themis.business.cache.bean.ExamPaperCacheBean;
|
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
|
import com.qmth.themis.business.dto.MqDto;
|
|
|
-import com.qmth.themis.business.entity.TBAttachment;
|
|
|
-import com.qmth.themis.business.entity.TBTaskHistory;
|
|
|
-import com.qmth.themis.business.entity.TBUser;
|
|
|
-import com.qmth.themis.business.entity.TEExamPaper;
|
|
|
+import com.qmth.themis.business.entity.*;
|
|
|
import com.qmth.themis.business.enums.*;
|
|
|
import com.qmth.themis.business.service.*;
|
|
|
import com.qmth.themis.business.util.MqUtil;
|
|
@@ -67,6 +64,9 @@ public class TEExamPaperController {
|
|
|
@Resource
|
|
|
TEExamCourseService examCourseService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ TOeExamRecordService tOeExamRecordService;
|
|
|
+
|
|
|
@ApiOperation(value = "考试试卷查询接口")
|
|
|
@RequestMapping(value = "/query", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "考试科目信息", response = TEExamPaper.class)})
|
|
@@ -190,4 +190,18 @@ public class TEExamPaperController {
|
|
|
}
|
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.TASK_ID, tbTaskHistory.getId()));
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "试卷删除接口")
|
|
|
+ @RequestMapping(value = "/delete", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = Result.class)})
|
|
|
+ @Transactional
|
|
|
+ public Result delete(@ApiParam(value = "试卷id", required = true) @RequestParam Long id) {
|
|
|
+ int count = tOeExamRecordService.count(new QueryWrapper<TOeExamRecord>().lambda().eq(TOeExamRecord::getPaperId, id));
|
|
|
+ if (count > 0) {
|
|
|
+ throw new BusinessException("该试卷已存在考试记录,无法删除");
|
|
|
+ }
|
|
|
+ teExamPaperService.removeById(id);
|
|
|
+ teExamPaperService.deleteExamPaperCacheBean(id);
|
|
|
+ return ResultUtil.ok(true);
|
|
|
+ }
|
|
|
}
|