@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("/findAll") @ResponseBody public Object findAll() { Map map = new HashMap(); map.put("currentPage", 1); map.put("totalPage", 12); map.put("total", 110); map.put("pageSize", 15); List<User> all = userRepository.findAll(); map.put("rows", all); return map; }
@RequestMapping("/thymeleaf") public Object thymeleaf(Model model) { List<User> all = userRepository.findAll(); model.addAttribute("users", all); return "thymeleaf-test"; }