@Log(message = "删除了{0}用户。") @RequiresPermissions("User:delete") @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST) public @ResponseBody String delete(@PathVariable Long id) { User user = null; try { user = userService.get(id); userService.delete(user.getId()); } catch (ServiceException e) { return AjaxObject.newError(e.getMessage()).setCallbackType("").toString(); } LogUitl.putArgs(LogMessageObject.newWrite().setObjects(new Object[] {user.getUsername()})); return AjaxObject.newOk("删除用户成功!").setCallbackType("").toString(); }
@Log(message = "删除了{0}用户。") @RequiresPermissions("User:delete") @RequestMapping(value = "/delete", method = RequestMethod.POST) public @ResponseBody String deleteMany(Long[] ids) { String[] usernames = new String[ids.length]; try { for (int i = 0; i < ids.length; i++) { User user = userService.get(ids[i]); userService.delete(user.getId()); usernames[i] = user.getUsername(); } } catch (ServiceException e) { return AjaxObject.newError(e.getMessage()).setCallbackType("").toString(); } LogUitl.putArgs( LogMessageObject.newWrite().setObjects(new Object[] {Arrays.toString(usernames)})); return AjaxObject.newOk("删除用户成功!").setCallbackType("").toString(); }