diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/ExamController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/ExamController.java index ed50056..151ce6d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/ExamController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/ExamController.java @@ -117,13 +117,12 @@ public class ExamController extends BaseController { return success(examManager.detail(id)); } - - - - - - - + @Log(title = "考试", businessType = BusinessType.UPDATE) + @PostMapping("/changeStatus") + @ResponseBody + public AjaxResult changeStatus(ExamDTO examDTO) { + return success(examManager.changeStatus(examDTO)); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/ExamManager.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/ExamManager.java index 7c9dd9d..2c02f33 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/ExamManager.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/ExamManager.java @@ -187,4 +187,18 @@ public class ExamManager { reqDTO.setTotalScore(objScore); } + + /** + * + * 启用,禁用 + * @param examDTO + * @return boolean + */ + public boolean changeStatus(ExamDTO examDTO) { + return elExamService.lambdaUpdate() + .eq(ElExam::getId, examDTO.getId()) + .set(ElExam::getState, examDTO.getState()) + .update(); + } + }