| | |
| | | |
| | | |
| | | @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); |
| | |
| | | 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); |
| | |
| | | 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("编辑成功"); |
| | |
| | | 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 + "、" + "听音选图中使用"); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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 + "、" + "看图选音中使用"); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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 + "、" + "归纳排除中使用"); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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 + "、" + "有问有答中使用"); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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 + "、" + "音图相配中使用"); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @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(); |
| | |
| | | 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), |