|
@@ -7,7 +7,6 @@ import cn.com.xwy.boot.web.dto.RestResponse;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
|
import lombok.AllArgsConstructor;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -23,7 +22,7 @@ import java.util.List;
|
|
|
public class FaqController {
|
|
|
private final FaqServiceImpl faqService;
|
|
|
|
|
|
- @GetMapping("/one")
|
|
|
+ @GetMapping("/list/one")
|
|
|
/**
|
|
|
* @description 查询一级分类
|
|
|
* @date 2019/11/27 10:19
|
|
@@ -34,7 +33,7 @@ public class FaqController {
|
|
|
return RestResponse.ok(faqService.list(new QueryWrapper<Faq>().eq("type", 1).eq("parent_id", 0).orderByAsc("serial")), "查询成功");
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/child")
|
|
|
+ @GetMapping("/list/child")
|
|
|
/**
|
|
|
* @description 根据父分类id查询子分类
|
|
|
* @date 2019/11/27 10:19
|
|
@@ -45,7 +44,7 @@ public class FaqController {
|
|
|
return RestResponse.ok(faqService.list(new QueryWrapper<Faq>().eq("type", 1).eq("parent_id", parentId).orderByAsc("serial")), "查询成功");
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/question")
|
|
|
+ @GetMapping("/list/question")
|
|
|
/**
|
|
|
* @description 根据分类id查询问题标题列表
|
|
|
* @date 2019/11/27 10:25
|
|
@@ -53,7 +52,12 @@ public class FaqController {
|
|
|
* @return cn.com.xwy.boot.web.dto.RestResponse
|
|
|
*/
|
|
|
public RestResponse question(@RequestParam Integer parentId) {
|
|
|
- return RestResponse.ok(faqService.list(new QueryWrapper<Faq>().eq("type", 2).eq("parent_id", parentId).orderByAsc("serial")), "查询成功");
|
|
|
+ List<Faq> list = faqService.list(new QueryWrapper<Faq>().eq("type", 2).eq("parent_id", parentId).orderByAsc("serial"));
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ return RestResponse.ok(list, "查询成功");
|
|
|
+ }else {
|
|
|
+ return RestResponse.ok(null, "无数据");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@GetMapping("/answer")
|
|
@@ -75,7 +79,6 @@ public class FaqController {
|
|
|
* @return cn.com.xwy.boot.web.dto.RestResponse
|
|
|
*/
|
|
|
public RestResponse addOne(@RequestBody Faq faq) {
|
|
|
- //@RequestParam String title, @RequestParam String description
|
|
|
return RestResponse.ok(null, faqService.addOne(faq.getContent(), faq.getDescription()));
|
|
|
}
|
|
|
|
|
@@ -87,7 +90,6 @@ public class FaqController {
|
|
|
* @return cn.com.xwy.boot.web.dto.RestResponse
|
|
|
*/
|
|
|
public RestResponse addChild(@RequestBody Faq faq) {
|
|
|
- //@RequestParam int parentId, @RequestParam String title, @RequestParam String description
|
|
|
return RestResponse.ok(null, faqService.addChild(faq.getParentId(), faq.getContent(), faq.getDescription()));
|
|
|
}
|
|
|
|
|
@@ -99,7 +101,6 @@ public class FaqController {
|
|
|
* @return cn.com.xwy.boot.web.dto.RestResponse
|
|
|
*/
|
|
|
public RestResponse addQuestion(@RequestBody Faq faq) {
|
|
|
- //@RequestParam int parentId, @RequestParam String title, @RequestParam String description
|
|
|
return RestResponse.ok(null, faqService.addQuestion(faq.getParentId(), faq.getContent(), faq.getDescription()));
|
|
|
}
|
|
|
|
|
@@ -111,7 +112,6 @@ public class FaqController {
|
|
|
* @return cn.com.xwy.boot.web.dto.RestResponse
|
|
|
*/
|
|
|
public RestResponse addAnswer(@RequestBody Faq faq) {
|
|
|
- //@RequestParam int parentId, @RequestParam String content, @RequestParam String description
|
|
|
return RestResponse.ok(null, faqService.addAnswer(faq.getParentId(), faq.getContent(), faq.getDescription()));
|
|
|
}
|
|
|
|