0

我前段时间开发了一个酒店管理系统。不同之处在于,该系统被几家在单个数据库中出租房屋的酒店和业主使用。我不能只为房间类型/住宿添加价格,因为它们可能与一周或另一周不同。

我用来克服移动房屋的固定住宿时间(周末、几周、周中)和预订酒店房间的可能性(不到达天数、最短住宿时间等)的方法是将价格存储在价格表中。如下:

tablename: Availability
int id
int roomTypeId
decimal rate
dateTime day
bit canArrive
int minimumStay
...

我想知道,现在数据库随着越来越多的酒店和移动房屋而增长,如果这种方法做得正确,或者是否有更好的方法而不是为每种房间类型和每个日期存储价格。

4

1 回答 1

1

当然!
需要注意的是,虽然费率每天都在变化,但通常不会(否则,任何显示费率的广告都会很快过时——它们可能是几个月前设计的)。

一个简单、幼稚(第一次迭代)的设计如下:

Hotel
=========
id -- autoincrement
name -- varchar(50)
contactInformation -- (address, phone, etc)

RoomType
==========
id -- autoincrement
description -- varchar(50)

HotelRoomTypeRate
==================
id -- autoincrement
hotelId -- fk reference to hotel.id
roomTypeId -- fk reference to roomType.id
rate -- decimal
effectiveOn -- date (this is 'business'/calendar day)

HotelRoom
===========
id -- autoincrement
hotelId -- fk reference to hotel.id
roomTypeId -- fk reference to roomType.id
status -- fk reference to status table, for things like 'under construction'

HotelCheckIn
==============
id -- autoincrement
hotelId -- fk reference to hotel.id
customerId -- fk reference to customer.id
hotelRoomId -- fk reference to hotelRoom.id
checkedInOn -- date (again, 'business'/calendar day)

HotelCheckOut
===============
id -- autoincrement
hotelCheckInId -- fk reference to hotelCheckIn.id
checkedOutOn -- date (again, 'business'/calendar day)

您当然需要调整它以满足您的需求。

于 2012-09-20T16:02:43.137 回答