/** 修改用户资源页面. */ @RequestMapping(value = {"resource"}) public String resource(Model model) throws Exception { List<TreeNode> treeNodes = resourceManager.getResourceTree(null, true); String resourceComboboxData = JsonMapper.nonDefaultMapper().toJson(treeNodes); logger.debug(resourceComboboxData); model.addAttribute("resourceComboboxData", resourceComboboxData); return "modules/sys/user-resource"; }
/** 修改用户资源. */ @RequestMapping(value = {"updateUserResource"}) @ResponseBody public Result updateUserResource( @ModelAttribute("model") User user, @RequestParam(value = "resourceIds", required = false) List<Long> resourceIds) throws Exception { Result result = null; List<Resource> rs = Lists.newArrayList(); if (Collections3.isNotEmpty(resourceIds)) { for (Long id : resourceIds) { Resource resource = resourceManager.loadById(id); rs.add(resource); } } user.setResources(rs); userManager.saveEntity(user); result = Result.successResult(); return result; }