|
@@ -0,0 +1,63 @@
|
|
|
|
+/**
|
|
|
|
+* @版权信息 (@copyright Copyright 2017-XXXX JDJR.COM All Right Reserved);
|
|
|
|
+* @see
|
|
|
|
+* @author 于海涛 京东金融【技术研发部-证券及营销平台研发部-营销平台研发部】
|
|
|
|
+* @version 1.0
|
|
|
|
+* @date 2018年6月7日
|
|
|
|
+*/
|
|
|
|
+
|
|
|
|
+package com.zskk.shop.controller.admin;
|
|
|
|
+
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
+
|
|
|
|
+import com.zskk.shop.controller.AbstractController;
|
|
|
|
+import com.zskk.shop.controller.bean.ControllerResult;
|
|
|
|
+import com.zskk.shop.controller.bean.PageBean;
|
|
|
|
+import com.zskk.shop.dao.entry.FAQ;
|
|
|
|
+import com.zskk.shop.exception.ErrorConstant;
|
|
|
|
+import com.zskk.shop.exception.ZSKKException;
|
|
|
|
+import com.zskk.shop.service.FAQService;
|
|
|
|
+
|
|
|
|
+@RequestMapping("/manage/faq")
|
|
|
|
+@Controller
|
|
|
|
+public class FAQController extends AbstractController{
|
|
|
|
+ @Autowired
|
|
|
|
+ private FAQService faqService;
|
|
|
|
+
|
|
|
|
+ @RequestMapping("/all")
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public ControllerResult all(@RequestParam("status") Integer status, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize){
|
|
|
|
+ PageBean bean = new PageBean();
|
|
|
|
+ bean.setList(faqService.queryAll(status, page, pageSize));
|
|
|
|
+ bean.setTotalCount(faqService.queryAllCount(status));
|
|
|
|
+ return new ControllerResult(bean);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping("/get")
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public ControllerResult get(@RequestParam("id") Integer id){
|
|
|
|
+ FAQ faq = faqService.queryFAQ(id);
|
|
|
|
+ if (faq == null){
|
|
|
|
+ throw new ZSKKException(ErrorConstant.PARAM_ERROR);
|
|
|
|
+ }
|
|
|
|
+ return new ControllerResult(faq);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping("/save")
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public ControllerResult save(FAQ faq){
|
|
|
|
+ String question = faq.getQuestion();
|
|
|
|
+ String answer = faq.getAnswer();
|
|
|
|
+ if (StringUtils.isBlank(question) || StringUtils.isBlank(answer)){
|
|
|
|
+ throw new ZSKKException(ErrorConstant.PARAM_ERROR);
|
|
|
|
+ }
|
|
|
|
+ faqService.save(this.getUser(), faq.getQuestion(), faq.getAnswer());
|
|
|
|
+ return new ControllerResult(Boolean.TRUE);
|
|
|
|
+ }
|
|
|
|
+}
|