/** * @Description: 获取分享信息列表 * * @param: @param request * @param: @param response * @throws */ @RequestMapping(value = "/GetList", method = RequestMethod.POST) public void getList( PageRequest pageRequest, HttpServletRequest request, HttpServletResponse response) { try { List<Share> list = shareService.getList(pageRequest); Map<String, Object> result = new HashMap<String, Object>(); result.put("iTotalRecords", 0); int count = shareService.getCount(pageRequest); // 总条数 result.put("iTotalDisplayRecords", count); // 内容列表 result.put("aaData", list); String json = com.alibaba.fastjson.JSON.toJSONString(result); out(json, response); } catch (Exception e) { e.printStackTrace(); log.error(e.getMessage()); } }
/** * 跳转说说编辑页面 * * @param id * @param request * @param response * @return */ @ResponseBody @RequestMapping(value = "/edit", method = RequestMethod.GET) public ModelAndView edit(String id, HttpServletRequest request, HttpServletResponse response) { ModelAndView modelAndView = new ModelAndView("share/share_view"); try { Share share = new Share(); if (!StringUtils.isEmpty(id)) { share = shareService.getShareByid(id); } modelAndView.addObject("share", share); } catch (Exception e) { e.printStackTrace(); log.error(e.getMessage()); } return modelAndView; }
/** * @Description: 删除信息 * * @param: @param request * @param: @param response * @throws */ @ResponseBody @RequestMapping(value = "/delete", method = RequestMethod.POST) public String delete(String ids, HttpServletRequest request, HttpServletResponse response) { String result = "fail"; try { if (!StringUtils.isEmpty(ids)) { int i = shareService.delete(ids); System.out.println(i); if (i > 0) { result = "success"; } } } catch (Exception e) { e.printStackTrace(); log.error(e.getMessage()); } return result; }