From c560f1a14ae1fc468d90e50e6a32d805295875da Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期一, 01 九月 2025 15:35:59 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/2.0' into 2.0
---
cloud-server-other/src/main/java/com/dsh/other/controller/AskedQuestionsController.java | 79 +++++++++++++++++++++++++++++++++++----
1 files changed, 71 insertions(+), 8 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 0f7bd74..348930c 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,14 +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.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
@RestController
@@ -22,17 +25,78 @@
private FrequentlyAskedQuestionsService faqService;
- private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+ 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)
.orderByDesc("insertTime"));
- if (list.size() > 0 ){
+ if (list.size() > 0) {
list.forEach(noList -> {
QuestionIns notice = new QuestionIns();
notice.setQuesId(noList.getId());
@@ -40,17 +104,16 @@
notice.setQuesContents(noList.getAnswer());
sysS.add(notice);
});
- notices.setSysS(sysS);
}
- return notices;
+ return sysS;
}
@PostMapping("/base/notice/queryQuestion")
- public QuestionIns getSysQuestionBuId(@RequestParam("quesId") Integer quesId){
+ public QuestionIns getSysQuestionBuId(@RequestParam("quesId") Integer quesId) {
QuestionIns sysNotice = new QuestionIns();
FrequentlyAskedQuestions notice = faqService.getById(quesId);
- if (null != notice){
+ if (null != notice) {
sysNotice.setQuesId(notice.getId());
sysNotice.setQuesTitle(notice.getContent());
sysNotice.setQuesContents(notice.getAnswer());
--
Gitblit v1.7.1