@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; }