参考文档 :https://blog.csdn.net/u011020900/article/details/52083166
/** * 编辑 * @param resId */ function edit(resId) { //iframe层 layer.open({ type: 2, title: '编辑服务资源', shadeClose: true, shade: 0.8, area: ['800px', '600px'], content: '/resource/editResourceById?resId=' + resId //iframe的url }); }
@RequestMapping(value = "/editResourceById", method = RequestMethod.GET) public ModelAndView editResourceById(@RequestParam(value = "resId", required = true) Integer resId) { ModelAndView modelAndView = new ModelAndView(); Resource resource = resourceService.getResourceById(resId); modelAndView.addObject("info", resource); modelAndView.setViewName("resource/editResourceById"); return modelAndView; }
@RequestMapping(value = "/saveEditResource", method = RequestMethod.POST) @ResponseBody public Map saveEditResource(Resource Resource) { boolean flag = resourceService.saveEditResource(Resource); Map map = new HashMap(); if (flag) { map.put("code", 200); map.put("msg", "更改成功"); } else { map.put("code", "500"); map.put("msg", "更改失败,代码错误"); } return map; }
/** * 获取资源列表 * * @param resType * @return */ @RequestMapping(value = "/getResourceList", method = RequestMethod.GET) public ModelAndView getResourceList(@RequestParam(value = "resType", required = true) Integer resType) { ModelAndView model = new ModelAndView(); ListresourceList = resourceService.getResourceList(resType); model.addObject("resourceList", resourceList); if (101 == resType) { // 跳转到 广告 资源列表 model.setViewName("account/reslist"); } else if (102 == resType) { // 跳转到 云 资源列表 } else if (103 == resType) { // 跳转到 服务 资源列表 model.setViewName("resource/getResourceList"); } return model; }