简体   繁体   English

如何在mysql数据库中管理酒店预订系统的库存表

[英]How to mange inventory tables for a hotel booking system in mysql database

在此处输入图片说明
Hi am working on a hotel booking system. 嗨,我在酒店预订系统上工作。 Where admin can add multiple hotels and multiple rooms for each hotel. 管理员可以在其中添加多个酒店,并为每个酒店添加多个房间。
But right now i am stuck in inventory management. 但是现在我被困在库存管理中。 For every room there will be 3 type of inventories 每个房间都有3种清单

  1. Master inventory : here admin can add number of room available for a particular type of room (Eg: Suite room) Sunday to Saturday. 主清单 :管理员可以在周日至周六添加特定类型房间(例如套房)的可用房间数量。 Available room count will be different in each days. 可用客房数量每天都会有所不同。
  2. Periodic inventory : Here admin can choose starting date and ending date and number of room available in between those date's. 定期盘点 :管理员可以在此处选择开始日期和结束日期以及这些日期之间的可用房间数。
  3. Daily inventory : Here admin can choose a date and number of available rooms in that particular date. 每日库存 :管理员可以在此处选择日期和该日期的可用客房数量。

And priority order for inventory selection will be 3 -> 2 -> 1. 选择库存的优先顺序为3-> 2-> 1。
ie. 即。 When user select a date in website and search for hotels. 当用户在网站上选择日期并搜索酒店时。 First check in daily inventory if there is a daily inventory found then and its match for the user requirement then will proceed further. 首先检查每日库存 ,然后找到每日库存,然后再与用户需求进行匹配。
Else if there is no daily inventory then will check for periodic inventory and If periodic inventory not found then will check for master inventory . 否则,如果没有每日库存,则将检查定期库存,如果没有找到定期库存,则将检查主库存
For every room there will be a master inventory but periodic and daily inventory are optional. 每个房间都有一个主清单,但定期和每日清单是可选的。 And in master inventory you can give available rooms from Sunday to Saturday ie. 在总库存中,您可以给星期日至星期六的可用房间。 for 7 days in a week. 一周7天。 Same for periodic inventory. 定期库存相同。

Right now i am trying to implement it like this 现在我正在尝试像这样实现它

Room table 房间表

ID integer
HOTEL_ID integer
ROOM_NAME varchar
INV_SUN integer
INV_MON integer
INV_TUE integer
.
.
INV_SAT integer
PERIODIC_STAR_DATE Date
PERIODIC_END_DATE Date
PERIODIC_SUN integer
PERIODIC_MON integer
.
.
PERIODIC_SAT integer

I don't know the method i following is correct and i have no idea how to mange daily inventory. 我不知道我遵循的方法是正确的,而且我也不知道如何管理每日库存。 As of now it is really difficult to search availability for hotels. 到目前为止,要搜索酒店的空房情况确实很困难。
Please advice me how to redesign the database in a better way. 请给我建议如何以更好的方式重新设计数据库。

Here is your answer: 这是您的答案:
在此处输入图片说明 This design states that: 该设计指出:

  1. There are many hotels 有很多酒店
  2. Each hotel have many room types eg suite, 2 beds, 3 beds etc. 每个酒店都有多种房型,例如套房,2张床,3张床等。
  3. Each room type contains the rooms that have isBooked integer ie 0 or 1 每个房间类型都包含具有isBooked整数的房间,即0或1
  4. Finally there is Booking table that stores specific hotel different rooms data 最后是预订表,用于存储特定酒店不同房间的数据

Now you can make queries eg 现在您可以进行查询,例如

  1. Which type of rooms in which hotels are reserved 预订酒店的房间类型
  2. How many rooms are booked 预订了多少房间
  3. What rooms are booked for specific hotel from this date to this date 从此日期到该日期预订特定酒店的房间
  4. How many rooms are empty 多少间空房间
  5. Which type of rooms for which hotel are empty or reserved 旅馆的哪种类型的房间为空房间或已预订

so on and so forth. 等等等等。 You can make numerous queries but this 4 tables are enough to meet your requirements in all respect 您可以进行许多查询,但是这4个表足以满足您的所有要求

Update: 更新:

  1. Admins table have different admin roles. 管理员表具有不同的管理员角色。 Each admin will manage a hotel, its room_type, rooms and booking Update-2 每个管理员将管理一个酒店,它的room_type,房间和预订Update-2
    在此处输入图片说明

    Update-3: 更新3:
    在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM