package kr.wisestone.owl.web.controller; import kr.wisestone.owl.constant.Constants; import kr.wisestone.owl.service.FaqService; import kr.wisestone.owl.web.condition.FaqCondition; import kr.wisestone.owl.web.form.EventForm; import kr.wisestone.owl.web.form.FaqForm; import kr.wisestone.owl.web.form.NoticeForm; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.Map; /** * zenith at 20200730 */ @Controller public class FaqController extends BaseController { @Autowired private FaqService faqService; // faq 생성 @RequestMapping(value = "/faq/add", produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Map add(@RequestBody Map> params) { Map resJsonData = new HashMap<>(); this.faqService.addFaq(FaqForm.make(params.get(Constants.REQ_KEY_CONTENT))); return this.setSuccessMessage(resJsonData); } // faq 조회 @RequestMapping(value = "/faq/find", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Map find(@RequestBody Map> params) { Map resJsonData = new HashMap<>(); Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params)); this.faqService.findFaq(resJsonData, FaqCondition.make(params.get(Constants.REQ_KEY_CONTENT)), pageable); return this.setSuccessMessage(resJsonData); } // faq 상세 조회 @RequestMapping(value = "/faq/detail", produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Map detail(@RequestBody Map> params) { Map resJsonData = new HashMap<>(); this.faqService.detailFaq(resJsonData, FaqCondition.make(params.get(Constants.REQ_KEY_CONTENT))); return this.setSuccessMessage(resJsonData); } // faq 수정 @RequestMapping(value = "/faq/modify", produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Map modify(@RequestBody Map> params) { Map resJsonData = new HashMap<>(); this.faqService.modifyFaq(FaqForm.make(params.get(Constants.REQ_KEY_CONTENT))); return this.setSuccessMessage(resJsonData); } // faq 할성 @RequestMapping(value = "/faq/activation", produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Map activation(@RequestBody Map> params) { Map resJsonData = new HashMap<>(); this.faqService.activeFaq(FaqForm.make(params.get(Constants.REQ_KEY_CONTENT))); return this.setSuccessMessage(resJsonData); } @RequestMapping(value = "/faq/remove", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Map remove(@RequestBody Map> params) { Map resJsonData = new HashMap<>(); Map content = params.get(Constants.REQ_KEY_CONTENT); this.faqService.remove(FaqForm.make(content)); return this.setSuccessMessage(resJsonData); } @RequestMapping(value = "/faq/downloadExcel", method = RequestMethod.POST) public ModelAndView downloadExcel(HttpServletRequest request, Model model) { return this.faqService.downloadExcel(request, model); } }