|
|
@@ -4,6 +4,7 @@ import com.example.hotel.bl.hotel.HotelService;
|
|
|
import com.example.hotel.po.HotelRoom;
|
|
|
import com.example.hotel.util.Result;
|
|
|
import com.example.hotel.vo.HotelVO;
|
|
|
+import com.example.hotel.vo.ResponseVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -16,27 +17,27 @@ public class HotelController {
|
|
|
private HotelService hotelService;
|
|
|
|
|
|
@PostMapping()
|
|
|
- public ResponseEntity<?> createHotel(@RequestBody HotelVO hotelVO) {
|
|
|
+ public ResponseVO createHotel(@RequestBody HotelVO hotelVO) {
|
|
|
|
|
|
hotelService.addHotel(hotelVO);
|
|
|
- return Result.ok();
|
|
|
+ return ResponseVO.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@GetMapping("/all")
|
|
|
- public ResponseEntity<?> retrieveAllHotels(){
|
|
|
- return Result.ok(hotelService.retrieveHotels());
|
|
|
+ public ResponseVO retrieveAllHotels(){
|
|
|
+ return ResponseVO.buildSuccess(hotelService.retrieveHotels());
|
|
|
}
|
|
|
|
|
|
@PostMapping("/roomInfo")
|
|
|
- public ResponseEntity<?> addRoomInfo(@RequestBody HotelRoom hotelRoom) {
|
|
|
+ public ResponseVO addRoomInfo(@RequestBody HotelRoom hotelRoom) {
|
|
|
hotelService.addHotelRoomInfo(hotelRoom);
|
|
|
- return Result.ok();
|
|
|
+ return ResponseVO.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@GetMapping("/{hotelId}/detail")
|
|
|
- public ResponseEntity<?> retrieveHotelDetail(@PathVariable Integer hotelId) {
|
|
|
+ public ResponseVO retrieveHotelDetail(@PathVariable Integer hotelId) {
|
|
|
|
|
|
- return Result.ok(hotelService.retrieveHotelDetails(hotelId));
|
|
|
+ return ResponseVO.buildSuccess(hotelService.retrieveHotelDetails(hotelId));
|
|
|
}
|
|
|
|
|
|
|