From ae9bfd2d66f68a553786ac78b12f4390e65e4e09 Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期五, 24 十一月 2023 18:30:18 +0800 Subject: [PATCH] 后台bug修改 --- cloud-server-other/src/main/java/com/dsh/other/controller/AskedQuestionsController.java | 74 ++++++++++++++++++++++++++++++++---- 1 files changed, 65 insertions(+), 9 deletions(-) diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/AskedQuestionsController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/AskedQuestionsController.java index ae9072a..8fe6133 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/controller/AskedQuestionsController.java +++ b/cloud-server-other/src/main/java/com/dsh/other/controller/AskedQuestionsController.java @@ -3,17 +3,17 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dsh.other.entity.FrequentlyAskedQuestions; +import com.dsh.other.model.vo.questionVo.QuestionChangeStateVO; import com.dsh.other.model.vo.questionVo.QuestionDetailsVo; import com.dsh.other.model.vo.questionVo.QuestionIns; +import com.dsh.other.model.vo.questionVo.QuestionSearchVO; import com.dsh.other.service.FrequentlyAskedQuestionsService; import org.springframework.beans.factory.annotation.Autowired; -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.RestController; +import org.springframework.web.bind.annotation.*; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.List; @RestController @@ -27,10 +27,67 @@ private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + /** + * 添加常见问题 + */ + @RequestMapping("/base/question/addQuestion") + public Object addQuestion(@RequestBody FrequentlyAskedQuestions frequentlyAskedQuestions){ + frequentlyAskedQuestions.setInsertTime(new Date()); + frequentlyAskedQuestions.setState(1); + return faqService.save(frequentlyAskedQuestions); + } + /** + * 修改常见问题 + */ + @RequestMapping("/base/question/editQuestion") + public Object editQuestion(@RequestBody FrequentlyAskedQuestions frequentlyAskedQuestions){ + return faqService.updateById(frequentlyAskedQuestions); + } + /** + * 上/下架、删除常见问题 type=1为上架 2为下架 3为删除 + */ + @RequestMapping("/base/question/changeState") + public Object changeState(@RequestBody QuestionChangeStateVO vo){ + return faqService.changeState(vo); + } + /** + * 查看详情 + */ + @RequestMapping("/base/question/getInfo") + public FrequentlyAskedQuestions getInfo(@RequestBody Integer id){ + return faqService.getInfo(id); + } + + /** + * 编辑常见问题 + */ + @RequestMapping("/base/question/updateQuestion") + public Object updateQuestion(@RequestBody FrequentlyAskedQuestions frequentlyAskedQuestions){ + return faqService.updateById(frequentlyAskedQuestions); + } + /** + * 获取所有常见问题 + * @return + */ + @RequestMapping("/base/question/listAll") + public List<FrequentlyAskedQuestions> listAll(@RequestBody QuestionSearchVO vo){ + QueryWrapper<FrequentlyAskedQuestions> frequentlyAskedQuestionsQueryWrapper = new QueryWrapper<>(); + if (vo.getState()!=null){ + frequentlyAskedQuestionsQueryWrapper.eq("state",vo.getState()); + } + if (vo.getContent()!=null && !vo.getContent().equals("") ){ + frequentlyAskedQuestionsQueryWrapper.like("content",vo.getContent()); + } + frequentlyAskedQuestionsQueryWrapper.ne("state",3); + frequentlyAskedQuestionsQueryWrapper.orderByDesc("sort"); + List<FrequentlyAskedQuestions> list = faqService.list(frequentlyAskedQuestionsQueryWrapper); + return list; + } + + @ResponseBody @PostMapping("/base/notice/queryQuestionDetails") - public QuestionDetailsVo getSysQuestionDetails(){ - QuestionDetailsVo notices = new QuestionDetailsVo(); + public List<QuestionIns> getSysQuestionDetails(){ List<QuestionIns> sysS = new ArrayList<>(); List<FrequentlyAskedQuestions> list = faqService.list(new QueryWrapper<FrequentlyAskedQuestions>() .eq("state", 1) @@ -43,14 +100,13 @@ notice.setQuesContents(noList.getAnswer()); sysS.add(notice); }); - notices.setSysS(sysS); } - return notices; + return sysS; } @PostMapping("/base/notice/queryQuestion") - public QuestionIns getSysQuestionBuId(@RequestBody Integer quesId){ + public QuestionIns getSysQuestionBuId(@RequestParam("quesId") Integer quesId){ QuestionIns sysNotice = new QuestionIns(); FrequentlyAskedQuestions notice = faqService.getById(quesId); if (null != notice){ -- Gitblit v1.7.1