StandardMemoController.java 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package lingtao.net.controller;
  2. import java.util.List;
  3. import javax.servlet.http.HttpSession;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.web.bind.annotation.RequestMapping;
  6. import org.springframework.web.bind.annotation.RequestParam;
  7. import org.springframework.web.bind.annotation.RestController;
  8. import com.github.pagehelper.PageHelper;
  9. import com.github.pagehelper.PageInfo;
  10. import lingtao.net.bean.Information;
  11. import lingtao.net.bean.Msg;
  12. import lingtao.net.service.InformationService;
  13. @RestController
  14. public class InformationController {
  15. @Autowired
  16. private InformationService informationService;
  17. /**
  18. * 产品知识列表
  19. *
  20. * @return
  21. */
  22. @RequestMapping("/getInformations")
  23. public Msg getInformations(@RequestParam(value = "page", defaultValue = "1") Integer page,
  24. @RequestParam(value = "limit", defaultValue = "10") Integer limit, Information information) {
  25. PageHelper.startPage(page, limit);
  26. List<Information> informationList = informationService.getInformations(information);
  27. PageInfo<Information> pageInfo = new PageInfo<Information>(informationList);
  28. return Msg.success().add("list", pageInfo);
  29. }
  30. /**
  31. * 添加产品知识
  32. */
  33. @RequestMapping("/addInformation")
  34. public Msg addInformation(Information information, HttpSession session) {
  35. informationService.addInformation(information, session);
  36. return Msg.success();
  37. }
  38. /**
  39. * 修改产品知识
  40. */
  41. @RequestMapping("/updateInformation")
  42. public Msg updateInformation(Information information, HttpSession session) {
  43. informationService.updateInformationById(information, session);
  44. return Msg.success();
  45. }
  46. /**
  47. * 删除
  48. */
  49. @RequestMapping("/deleteInformation")
  50. public Msg deleteInformation(@RequestParam("id") Integer id) {
  51. informationService.deleteInformationById(id);
  52. return Msg.success();
  53. }
  54. }