package com.example.hotel.controller.user; import com.example.hotel.bl.user.ClientService; import com.example.hotel.util.Result; import com.example.hotel.vo.OrderVO; import com.example.hotel.vo.ResponseVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; /** * @Author: chenyizong * @Date: 2020-02-29 */ @RestController() @RequestMapping("/api") public class ClientController { @Autowired private ClientService clientService; @PostMapping("/hotel/reserve") public ResponseVO reserveHotel(@RequestBody OrderVO orderVO){ clientService.addOrder(orderVO); return ResponseVO.buildSuccess(orderVO); } @GetMapping("/order/all") public ResponseEntity retrieveAllOrders(){ return Result.ok(clientService.retrieveOrders()); } }