| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- package lingtao.net.controller;
- import java.util.List;
- import javax.servlet.http.HttpSession;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- import lingtao.net.bean.Information;
- import lingtao.net.bean.Msg;
- import lingtao.net.service.InformationService;
- @RestController
- public class InformationController {
- @Autowired
- private InformationService informationService;
- /**
- * 产品知识列表
- *
- * @return
- */
- @RequestMapping("/getInformations")
- public Msg getInformations(@RequestParam(value = "page", defaultValue = "1") Integer page,
- @RequestParam(value = "limit", defaultValue = "10") Integer limit, Information information) {
- PageHelper.startPage(page, limit);
- List<Information> informationList = informationService.getInformations(information);
- PageInfo<Information> pageInfo = new PageInfo<Information>(informationList);
- return Msg.success().add("list", pageInfo);
- }
- /**
- * 添加产品知识
- */
- @RequestMapping("/addInformation")
- public Msg addInformation(Information information, HttpSession session) {
- informationService.addInformation(information, session);
- return Msg.success();
- }
- /**
- * 修改产品知识
- */
- @RequestMapping("/updateInformation")
- public Msg updateInformation(Information information, HttpSession session) {
- informationService.updateInformationById(information, session);
- return Msg.success();
- }
- /**
- * 删除
- */
- @RequestMapping("/deleteInformation")
- public Msg deleteInformation(@RequestParam("id") Integer id) {
- informationService.deleteInformationById(id);
- return Msg.success();
- }
- }
|