TipContentController.java 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package lingtao.net.controller;
  2. import com.github.pagehelper.PageHelper;
  3. import com.github.pagehelper.PageInfo;
  4. import lingtao.net.bean.Msg;
  5. import lingtao.net.bean.StandardMemo;
  6. import lingtao.net.bean.TipContent;
  7. import lingtao.net.service.StandardMemoService;
  8. import lingtao.net.service.TipContentService;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.RequestParam;
  12. import org.springframework.web.bind.annotation.RestController;
  13. import javax.servlet.http.HttpSession;
  14. import java.util.List;
  15. @RestController
  16. public class TipContentController {
  17. @Autowired
  18. private TipContentService tipContentService;
  19. /**
  20. * 产品知识列表
  21. *
  22. * @return
  23. */
  24. @RequestMapping("/getTipContent")
  25. public Msg getStandard(@RequestParam(value = "page", defaultValue = "1") Integer page,
  26. @RequestParam(value = "limit", defaultValue = "10") Integer limit, TipContent tipContent) {
  27. PageHelper.startPage(page, limit);
  28. List<TipContent> tipContentList = tipContentService.getTipContents(tipContent);
  29. PageInfo<TipContent> pageInfo = new PageInfo<>(tipContentList);
  30. return Msg.success().add("list", pageInfo);
  31. }
  32. /**
  33. * 添加产品知识
  34. */
  35. @RequestMapping("/addTipContent")
  36. public Msg addStandard(TipContent tipContent, HttpSession session) {
  37. tipContentService.addTipContent(tipContent, session);
  38. return Msg.success();
  39. }
  40. /**
  41. * 修改产品知识
  42. */
  43. @RequestMapping("/updateTipContent")
  44. public Msg updateStandard(TipContent tipContent, HttpSession session) {
  45. tipContentService.updateTipContentById(tipContent, session);
  46. return Msg.success();
  47. }
  48. /**
  49. * 删除
  50. */
  51. @RequestMapping("/deleteTipContent")
  52. public Msg deleteStandard(@RequestParam("id") Integer id) {
  53. tipContentService.deleteTipContentById(id);
  54. return Msg.success();
  55. }
  56. }