@RequestMapping("/save") @ResponseBody public Object saveUser(User user) { User saveUser = userService.save(user); Map map = new HashMap(); map.put("state", saveUser.getId() != null ? "success" : "error"); List<User> all = userRepository.findAll(); map.put("rows", all); return map; }
@RequestMapping("/findById") public String findById(Long id) { User user = userService.findById(id); return user.getFirstName(); }