@RequestMapping(value = "delete/{id}") public String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttributes) { User user = accountService.getUser(id); accountService.deleteUser(id); redirectAttributes.addFlashAttribute("message", "删除用户" + user.getLoginName() + "成功"); return "redirect:/admin/user"; }
@RequestMapping(value = "update", method = RequestMethod.POST) public String update( @Valid @ModelAttribute("user") User user, RedirectAttributes redirectAttributes) { accountService.updateUser(user); redirectAttributes.addFlashAttribute("message", "更新用户" + user.getLoginName() + "成功"); return "redirect:/admin/user"; }