@RequestMapping(value = "edit.html", method = RequestMethod.POST) public String edit(@ModelAttribute("link") Link link, HttpServletRequest request) { BackSession backSession = (BackSession) request.getSession().getAttribute(Constants.BACK_EMPLOYEE_SESSION); Validator validator = new Validator(); validator.isNotBlankValidator(link.getLinkUrl(), "请填写链接URL"); validator.isNotBlankValidator(link.getLinkText(), "请填写链接文本"); if (StringUtils.isNotEmpty(validator.renderHtmlMessage())) { request.setAttribute("message", validator.renderHtmlMessage()); } else { if (link.getId() == null) { link.setSiteId(backSession.getSiteId()); link.setCreatedAt(new Date()); link.setUpdatedAt(new Date()); linkService.save(link); request.setAttribute("message", "链接信息增加成功"); } else { link.setUpdatedAt(new Date()); link.setSiteId(backSession.getSiteId()); linkService.update(link); request.setAttribute("message", "链接信息更新成功"); } } return "admin/link/edit"; }
@RequestMapping(value = "list.html", method = RequestMethod.POST) public @ResponseBody String list( Employee employee, Page<Employee> page, HttpServletRequest request) { BackSession backSession = (BackSession) request.getSession().getAttribute(Constants.BACK_EMPLOYEE_SESSION); page = employeeService.list(page, employee, backSession.getSiteId()); return new Pager<Employee>().getJsonPagerData(page); }
@RequestMapping(value = "list.html", method = RequestMethod.POST) public @ResponseBody String list( Link link, Page<Link> page, HttpServletRequest request, HttpServletResponse response) { BackSession backSession = (BackSession) request.getSession().getAttribute(Constants.BACK_EMPLOYEE_SESSION); Integer siteId = backSession.getSiteId(); link.setSiteId(siteId); Page<Link> list = linkService.findLinkBySiteId(page, link); return new Pager<Link>().getJsonPagerData(list); }