예제 #1
0
 @RequestMapping("aution")
 public String aution(Model model) throws Exception {
   List<Resource> rs = resourceService.queryAll(new Resource());
   List<TreeObject> treeObjects = new ArrayList<TreeObject>();
   for (Resource res : rs) { // 转换为树对象
     TreeObject t = new TreeObject();
     PropertyUtils.copyProperties(t, res);
     treeObjects.add(t);
   }
   List<TreeObject> ns = TreeUtil.getChildResources(treeObjects, 0);
   model.addAttribute("permissions", ns);
   return Common.BACKGROUND_PATH + "/resource/permissions";
 }
예제 #2
0
 @ResponseBody
 @RequestMapping("resources")
 public Map<String, Object> resources(Resource resource, HttpServletRequest request)
     throws Exception {
   Map<String, Object> map = new HashMap<String, Object>();
   List<Resource> rs;
   if (PropertiesUtils.findPropertiesKey("rootName").equals(Common.findAuthenticatedUsername())) {
     rs = resourceService.queryAll(resource);
   } else {
     rs = resourceService.findAccountResources(Common.findUserSessionId(request));
   }
   List<TreeObject> treeObjects = new ArrayList<TreeObject>();
   for (Resource res : rs) { // 转换为树对象
     TreeObject t = new TreeObject();
     PropertyUtils.copyProperties(t, res);
     treeObjects.add(t);
   }
   List<TreeObject> ns = TreeUtil.getChildResources(treeObjects, 0);
   BeanUtil.sort(ns, "id", false);
   map.put("resourceTree", ns);
   return map;
 }