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 informationList = informationService.getInformations(information); PageInfo pageInfo = new PageInfo(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(); } }