Browse Source

小修改

CHENYIZONG 6 years ago
parent
commit
450c878449

+ 17 - 0
src/main/java/com/example/hotel/bl/hotel/HotelService.java

@@ -15,6 +15,15 @@ public interface HotelService {
      */
     void addHotel(HotelVO hotelVO) throws ServiceException;
 
+
+    /**
+     * 预订酒店修改剩余客房信息
+     * @param hotelId
+     * @param roomType
+     * @param rooms
+     */
+    void updateRoomInfo(Integer hotelId, String roomType,Integer rooms);
+
     /**
      * 列表获取酒店信息
      * @return
@@ -28,4 +37,12 @@ public interface HotelService {
      */
     HotelVO retrieveHotelDetails(Integer hotelId);
 
+    /**
+     * 查看酒店剩余某种房间数量
+     * @param hotelId
+     * @param roomType
+     * @return
+     */
+    int getRoomCurNum(Integer hotelId,String roomType);
+
 }

+ 16 - 0
src/main/java/com/example/hotel/bl/hotel/RoomService.java

@@ -18,4 +18,20 @@ public interface RoomService {
      * @param hotelRoom
      */
     void insertRoomInfo(HotelRoom hotelRoom);
+
+    /**
+     * 预订酒店后更新客房房间数量
+     * @param hotelId
+     * @param roomType
+     * @param rooms
+     */
+    void updateRoomInfo(Integer hotelId, String roomType, Integer rooms);
+
+    /**
+     * 获取酒店指定房间剩余数量
+     * @param hotelId
+     * @param roomType
+     * @return
+     */
+    int getRoomCurNum(Integer hotelId, String roomType);
 }

+ 10 - 0
src/main/java/com/example/hotel/blImpl/hotel/HotelServiceImpl.java

@@ -50,6 +50,16 @@ public class HotelServiceImpl implements HotelService {
         hotelMapper.insertHotel(hotel);
     }
 
+    @Override
+    public void updateRoomInfo(Integer hotelId, String roomType, Integer rooms) {
+        roomService.updateRoomInfo(hotelId,roomType,rooms);
+    }
+
+    @Override
+    public int getRoomCurNum(Integer hotelId, String roomType) {
+        return roomService.getRoomCurNum(hotelId,roomType);
+    }
+
     @Override
     public List<HotelVO> retrieveHotels() {
 

+ 10 - 0
src/main/java/com/example/hotel/blImpl/hotel/RoomServiceImpl.java

@@ -24,5 +24,15 @@ public class RoomServiceImpl implements RoomService {
         roomMapper.insertRoom(hotelRoom);
     }
 
+    @Override
+    public void updateRoomInfo(Integer hotelId, String roomType, Integer rooms) {
+        roomMapper.updateRoomInfo(hotelId,roomType,rooms);
+    }
+
+    @Override
+    public int getRoomCurNum(Integer hotelId, String roomType) {
+        return roomMapper.getRoomCurNum(hotelId,roomType);
+    }
+
 
 }

+ 3 - 3
src/main/java/com/example/hotel/po/Order.java

@@ -43,12 +43,12 @@ public class Order {
         this.hotelId = hotelId;
     }
 
-    public Date getCheckInnDate() {
+    public Date getCheckInDate() {
         return checkInDate;
     }
 
-    public void setCheckInnDate(Date checkInnDate) {
-        this.checkInDate = checkInnDate;
+    public void setCheckInDate(Date checkInDate) {
+        this.checkInDate = checkInDate;
     }
 
     public Date getCheckOutDate() {

+ 3 - 3
src/main/java/com/example/hotel/vo/OrderVO.java

@@ -42,12 +42,12 @@ public class OrderVO {
     public void setHotelId(Integer hotelId) {
         this.hotelId = hotelId;
     }
-    public Date getCheckInnDate() {
+    public Date getCheckInDate() {
         return checkInDate;
     }
 
-    public void setCheckInnDate(Date checkInnDate) {
-        this.checkInDate = checkInnDate;
+    public void setCheckInDate(Date checkInDate) {
+        this.checkInDate = checkInDate;
     }
 
     public Date getCheckOutDate() {