コード例 #1
0
 @ResponseBody
 @RequestMapping("queryAll")
 public List<Resource> queryAll(HttpServletRequest request) {
   if (PropertiesUtils.findPropertiesKey("rootName")
       .equals(Common.findAuthenticatedUsername())) { // 根据账号拥有所有权限
     return resourceService.queryAll(new Resource());
   } else {
     return resourceService.queryAll(new Resource());
   }
 }
コード例 #2
0
 /**
  * 跳转到新增界面
  *
  * @return
  */
 @RequestMapping("addUI")
 public String addUI(Model model) {
   List<Resource> resources = resourceService.queryAll(new Resource());
   model.addAttribute("resources", resources);
   Dic dic = new Dic();
   dic.setDicTypeKey("res_type");
   model.addAttribute("dics", dicService.queryAll(dic));
   return Common.BACKGROUND_PATH + "/resource/add";
 }
コード例 #3
0
 /**
  * 跳转到修改界面
  *
  * @param model
  * @param resourceId 修改菜单信息ID
  * @return
  */
 @RequestMapping("editUI")
 public String editUI(Model model, String resourceId) {
   List<Resource> resources = resourceService.queryAll(new Resource());
   model.addAttribute("resources", resources);
   Resource resource = resourceService.getById(resourceId);
   model.addAttribute("cur", resource);
   Dic dic = new Dic();
   dic.setDicTypeKey("res_type");
   model.addAttribute("dics", dicService.queryAll(dic));
   return Common.BACKGROUND_PATH + "/resource/edit";
 }
コード例 #4
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";
 }
コード例 #5
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;
 }