package com.ruoyi.management.controller;
|
|
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
import com.ruoyi.common.core.web.page.PageInfo;
|
import com.ruoyi.study.api.dto.*;
|
import com.ruoyi.study.api.feignClient.StudyClient;
|
import com.ruoyi.study.api.model.TStory;
|
import com.ruoyi.study.api.model.TSubject;
|
import com.ruoyi.study.api.vo.StudyDTO;
|
import com.ruoyi.study.api.vo.*;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import java.util.List;
|
|
/**
|
* <p>
|
* 学习类型前端控制器
|
* </p>
|
*
|
* @author 无关风月
|
* @since 2024-04-26
|
*/
|
@Controller
|
@RequestMapping("/tStudy")
|
public class TStudyController {
|
@Autowired
|
private StudyClient studyClient;
|
@ApiOperation(value = "选择题目列表查询", tags = {"后台-学习"})
|
@PostMapping(value = "/subjectList1")
|
@ResponseBody
|
public AjaxResult<PageInfo<TSubject>> subjectList(ChoiceSubject dto) {
|
R<PageInfo<TSubject>> pageInfoR = studyClient.subjectList(dto);
|
PageInfo<TSubject> data = pageInfoR.getData();
|
return AjaxResult.success(data);
|
}
|
@ApiOperation(value = "选择故事列表查询", tags = {"后台-学习"})
|
@PostMapping(value = "/storyList1")
|
@ResponseBody
|
public AjaxResult<PageInfo<TStory>> storyList(ChoiceStory dto) {
|
R<PageInfo<TStory>> pageInfoR = studyClient.storyList(dto);
|
PageInfo<TStory> data = pageInfoR.getData();
|
return AjaxResult.success(data);
|
}
|
@ApiOperation(value = "新增或修改学习配置", tags = {"后台-学习"})
|
@PostMapping(value = "/addStudySet")
|
@ResponseBody
|
public AjaxResult addStudySet(@RequestBody AddStudySetDTO dto) {
|
R<Object> objectR = studyClient.addStudySet(dto);
|
String string = objectR.getMsg().toString();
|
int code = objectR.getCode();
|
if (code == 500){
|
return AjaxResult.error(string);
|
}
|
return AjaxResult.success("保存成功");
|
}
|
|
/**
|
* 通过类型、周目、day查询学习配置
|
* @return
|
*/
|
@ApiOperation(value = "类型管理查看详情", tags = {"后台-学习"})
|
@PostMapping(value = "/getStudySet")
|
@ResponseBody
|
public AjaxResult<StudyVO> getStudySet(StudyDTO dto) {
|
R<StudyVO> studySet = studyClient.getStudySet(dto);
|
StudyVO data = studySet.getData();
|
return AjaxResult.success(data);
|
}
|
@ApiOperation(value = "类型管理列表数据", tags = {"后台-学习"})
|
@PostMapping(value = "/getStudy")
|
@ResponseBody
|
public AjaxResult<List<StudyListVO>> getStudy() {
|
R<List<StudyListVO>> data = studyClient.getStudyList();
|
List<StudyListVO> res = data.getData();
|
return AjaxResult.success(res);
|
}
|
@ApiOperation(value = "添加周目", tags = {"后台-学习"})
|
@PostMapping(value = "/addWeek")
|
@ResponseBody
|
public AjaxResult addWeek(AddWeekDTO dto) {
|
studyClient.addWeek(dto);
|
return AjaxResult.success();
|
}
|
@ApiOperation(value = "列表查询", tags = {"后台-题目管理"})
|
@PostMapping(value = "/subjectList")
|
@ResponseBody
|
public AjaxResult<PageInfo<SubjectVO>> subjectList(SubjectQuery query) {
|
R<PageInfo<SubjectVO>> pageInfoR = studyClient.subjectList(query);
|
return AjaxResult.success(pageInfoR.getData());
|
}
|
@ApiOperation(value = "列表查询", tags = {"后台-故事管理"})
|
@PostMapping(value = "/storyList")
|
@ResponseBody
|
public AjaxResult<PageInfo<SubjectVO>> storyList(SubjectQuery query) {
|
R<PageInfo<SubjectVO>> pageInfoR = studyClient.storyList(query);
|
return AjaxResult.success(pageInfoR.getData());
|
}
|
@ApiOperation(value = "添加", tags = {"后台-题目管理"})
|
@PostMapping(value = "/addSubject")
|
@ResponseBody
|
public AjaxResult addSubject(SubjectDTO dto) {
|
studyClient.add(dto);
|
return AjaxResult.success("添加成功");
|
}
|
@ApiOperation(value = "修改", tags = {"后台-题目管理"})
|
@PostMapping(value = "/updateSubject")
|
@ResponseBody
|
public AjaxResult updateSubject(SubjectDTO dto) {
|
R update = studyClient.update(dto);
|
int code = update.getCode();
|
if (code == 500){
|
return AjaxResult.error(update.getMsg());
|
}
|
return AjaxResult.success("添加成功");
|
}
|
@ApiOperation(value = "查看详情", tags = {"后台-题目管理"})
|
@PostMapping(value = "/getSubjectInfo")
|
@ResponseBody
|
public AjaxResult<SubjectDTO> getSubjectInfo(Integer id) {
|
R<SubjectDTO> info = studyClient.getInfo(id);
|
SubjectDTO data = info.getData();
|
return AjaxResult.success(data);
|
}
|
@ApiOperation(value = "修改状态", tags = {"后台-题目管理"})
|
@PostMapping(value = "/updateState")
|
@ResponseBody
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "id", name = "id", required = true),
|
@ApiImplicitParam(value = "状态 1上架2下架3删除", name = "state", required = true),
|
})
|
public R updateState(Integer id, Integer state) {
|
R update = studyClient.updateState(id,state);
|
int code = update.getCode();
|
if (code == 602){
|
return R.failUpdate(update.getMsg());
|
}
|
return R.ok("修改成功");
|
}
|
@ApiOperation(value = "添加", tags = {"后台-故事管理"})
|
@PostMapping(value = "/addStory")
|
@ResponseBody
|
public AjaxResult addStory(StoryDTO dto) {
|
studyClient.add(dto);
|
return AjaxResult.success("添加成功");
|
}
|
@ApiOperation(value = "修改", tags = {"后台-故事管理"})
|
@PostMapping(value = "/updateStory")
|
@ResponseBody
|
public R updateStory(StoryDTO dto) {
|
R update = studyClient.update(dto);
|
int code = update.getCode();
|
if (code == 602){
|
return R.failUpdate(update.getMsg());
|
}
|
|
return R.ok("添加成功");
|
}
|
@ApiOperation(value = "查看详情", tags = {"后台-故事管理"})
|
@PostMapping(value = "/getStoryInfo")
|
@ResponseBody
|
public AjaxResult<StoryDTO> getStoryInfo(Integer id) {
|
R<StoryDTO> info = studyClient.getInfo1(id);
|
StoryDTO data = info.getData();
|
return AjaxResult.success(data);
|
}
|
@ApiOperation(value = "修改状态", tags = {"后台-故事管理"})
|
@PostMapping(value = "/updateState1")
|
@ResponseBody
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "id", name = "id", required = true),
|
@ApiImplicitParam(value = "状态 1上架2下架3删除", name = "state", required = true),
|
})
|
public R updateState1(Integer id, Integer state) {
|
R update = studyClient.updateState1(id,state);
|
int code = update.getCode();
|
if (code == 602){
|
return R.failUpdate(update.getMsg());
|
}
|
return R.ok("修改成功");
|
}
|
}
|