@RequestMapping(value = "/init-update/{id}")
  public String initUpdate(@PathVariable long id, Model model) {
    model.addAttribute("resources", resourcesService.getById(id));
    model.addAttribute("modules", resourcesService.getModules());

    return "resources/update";
  }
  @RequestMapping(value = "/enable/{id}")
  @ResponseBody
  public Map<String, Object> enableStatus(@PathVariable("id") long id) {
    Map<String, Object> map = new HashMap<String, Object>();
    Resources r = resourcesService.getById(id);

    if (r == null) throw new BusinessException("无法删除,没有这个资源");

    String username = SecurityContextHolder.getContext().getAuthentication().getName();

    if (resourcesService.enableOrNot(r, username)) {
      map.put("flag", true);
    } else {
      map.put("flag", false);
    }

    return map;
  }