From c832cae4de3ff53e3b80cad317fbdd84de46c02d Mon Sep 17 00:00:00 2001 From: hjl <1657978663@qq.com> Date: 星期五, 19 七月 2024 09:31:34 +0800 Subject: [PATCH] fix: 学习端bug --- ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TSubjectController.java | 29 +++++++++++++++++------------ 1 files changed, 17 insertions(+), 12 deletions(-) diff --git a/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TSubjectController.java b/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TSubjectController.java index 5ac03e0..3c83d42 100644 --- a/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TSubjectController.java +++ b/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TSubjectController.java @@ -3,6 +3,7 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.page.PageInfo; +import com.ruoyi.management.api.feignClient.ManagementClient; import com.ruoyi.study.domain.*; import com.ruoyi.study.dto.SubjectDTO; import com.ruoyi.study.dto.SubjectQuery; @@ -49,8 +50,9 @@ @Autowired private ITStudyService studyService; + @PostMapping("/subjectList") - @ApiOperation(value = "列表查询", tags = {"题目管理"}) +// @ApiOperation(value = "列表查询", tags = {"题目管理"}) public R<PageInfo<SubjectVO>> subjectList(@RequestBody SubjectQuery query) { PageInfo<SubjectVO> res = new PageInfo<>(query.getPageNumber(), query.getPageSize()); List<SubjectVO> list = subjectService.listAll(query); @@ -84,7 +86,7 @@ return R.ok(res); } @PostMapping("/add") - @ApiOperation(value = "添加", tags = {"题目管理"}) +// @ApiOperation(value = "添加", tags = {"题目管理"}) public R add(@RequestBody SubjectDTO dto) { TSubject tSubject = new TSubject(); BeanUtils.copyProperties(dto,tSubject); @@ -92,12 +94,12 @@ return R.ok("添加成功"); } @PostMapping("/update") - @ApiOperation(value = "编辑", tags = {"题目管理"}) +// @ApiOperation(value = "编辑", tags = {"题目管理"}) public R update(@RequestBody SubjectDTO dto) { TSubject tSubject = new TSubject(); // 判断当前题目有没有被使用 - R<Object> week = getObjectR(dto.getId()); - if (week != null) return week; +// R<Object> week = getObjectR(dto.getId()); +// if (week != null) return week; BeanUtils.copyProperties(dto,tSubject); subjectService.updateById(tSubject); return R.ok("编辑成功"); @@ -116,7 +118,7 @@ if (s.equals(String.valueOf(id))) { Integer week = tStudyListen.getWeek(); Integer day = tStudyListen.getDay(); - return R.fail("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "听音选图中使用"); + return R.failUpdate("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "听音选图中使用"); } } } @@ -128,7 +130,7 @@ if (s.equals(String.valueOf(id))) { Integer week = tStudyListen.getWeek(); Integer day = tStudyListen.getDay(); - return R.fail("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "看图选音中使用"); + return R.failUpdate("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "看图选音中使用"); } } } @@ -140,7 +142,7 @@ if (s.equals(String.valueOf(id))) { Integer week = tStudyListen.getWeek(); Integer day = tStudyListen.getDay(); - return R.fail("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "归纳排除中使用"); + return R.failUpdate("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "归纳排除中使用"); } } } @@ -152,7 +154,7 @@ if (subject.equals(id) || answerSubject.equals(id)) { Integer week = tStudyListen.getWeek(); Integer day = tStudyListen.getDay(); - return R.fail("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "有问有答中使用"); + return R.failUpdate("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "有问有答中使用"); } } } @@ -163,7 +165,7 @@ if (s.equals(String.valueOf(id))) { Integer week = tStudyListen.getWeek(); Integer day = tStudyListen.getDay(); - return R.fail("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "音图相配中使用"); + return R.failUpdate("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "音图相配中使用"); } } } @@ -172,7 +174,7 @@ } @PostMapping("/getInfo") - @ApiOperation(value = "查看详情", tags = {"题目管理"}) +// @ApiOperation(value = "查看详情", tags = {"题目管理"}) public R<SubjectDTO> getInfo(@RequestParam("id") Integer id) { TSubject byId = subjectService.getById(id); SubjectDTO subjectDTO = new SubjectDTO(); @@ -180,7 +182,7 @@ return R.ok(subjectDTO); } @PostMapping("/updateState/{id}/{state}") - @ApiOperation(value = "修改状态", tags = {"题目管理"}) +// @ApiOperation(value = "修改状态", tags = {"题目管理"}) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "题目id", required = true), @ApiImplicitParam(name = "state", value = "1上架2下架3删除", required = true), @@ -197,6 +199,9 @@ TSubject byId = subjectService.getById(id); byId.setState(state); subjectService.updateById(byId); + if (state == 3){ + subjectService.removeById(byId); + } return R.ok("编辑成功"); } } -- Gitblit v1.7.1