/**
* @author hq.zheng
* @create 2019-03-14-下午 4:57
*/
@RestController
public class UserController {
@Autowired
UserRepository userRepository;
//根据id查找
@GetMapping("/user/{id}")
public User getUser(@PathVariable("id") Integer id){
User user = userRepository.findOne(id);
return user;
}
//新增
@GetMapping("/user")
public User insertUser(User user){
User user1 = userRepository.save(user);
return user1;
}
}