ClientController.java 900 B

1234567891011121314151617181920212223242526272829303132333435
  1. package com.example.hotel.controller.user;
  2. import com.example.hotel.bl.user.ClientService;
  3. import com.example.hotel.util.Result;
  4. import com.example.hotel.vo.OrderVO;
  5. import com.example.hotel.vo.ResponseVO;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.http.ResponseEntity;
  8. import org.springframework.web.bind.annotation.*;
  9. /**
  10. * @Author: chenyizong
  11. * @Date: 2020-02-29
  12. */
  13. @RestController()
  14. @RequestMapping("/api")
  15. public class ClientController {
  16. @Autowired
  17. private ClientService clientService;
  18. @PostMapping("/hotel/reserve")
  19. public ResponseVO reserveHotel(@RequestBody OrderVO orderVO){
  20. clientService.addOrder(orderVO);
  21. return ResponseVO.buildSuccess(orderVO);
  22. }
  23. @GetMapping("/order/all")
  24. public ResponseEntity<?> retrieveAllOrders(){
  25. return Result.ok(clientService.retrieveOrders());
  26. }
  27. }