@RequestMapping(value = "cancelSite.html", method = RequestMethod.POST) public @ResponseBody String cancelSite( Integer employeeId, String siteIds, HttpServletRequest request) { try { String[] vals = siteIds.split(","); for (int i = 0; i < vals.length; i++) { employeeSiteService.delete(employeeId, Integer.parseInt(vals[i])); } } catch (Exception e) { return "error"; } return "success"; }
/** * 分配站点 * * @param employeeId * @param siteId * @return */ @RequestMapping(value = "assortSite.html", method = RequestMethod.POST) public @ResponseBody String assortSite( Integer employeeId, String siteIds, HttpServletRequest request) { try { String[] vals = siteIds.split(","); List<EmployeeSite> list = new ArrayList<EmployeeSite>(); for (int i = 0; i < vals.length; i++) { EmployeeSite employeeSite = new EmployeeSite(); employeeSite.setEmployeeId(employeeId); employeeSite.setSiteId(Integer.parseInt(vals[i])); list.add(employeeSite); } employeeSiteService.saveAll(list); } catch (Exception e) { return "error"; } return "success"; }