Database system course design - hotel management system based on python+pyqt5+mysql (can be run directly)--GUI programming

A project written a few months ago, through this project, you can learn about database triggers, the basic syntax of python, the use of some third-party libraries in python, including how python connects the front and back ends (interface and data) , as well as interface design and so on. I hope you can learn something from the project.

1. Project Background

1. Brief description of experimental design


The hotel management system establishes the system by providing the relationship between customer and employee information, including employee management functions, rental management functions, customer management functions, order management functions, report and maintenance functions, and login functions. The system can quickly find the customer's room information by searching the customer information. It also includes the addition, deletion, modification, and query of customer information and the addition, deletion, modification, and query of employee information
.
(2) The hotel has rooms of various standards. Room data includes room number, room class, room price and room status (whether there are already guests). The room number uniquely represents a room, and the room level determines the price of the room. There are various levels of rooms, including single rooms, standard rooms, deluxe rooms, business rooms, and executive rooms. The room status indicates whether the room can be booked, checked in or transferred.

Basic function realization:


(1) Room management.
(2) Management of guest room reservation and cancellation.
(3) Guest check-in and in-store consumption management.

(4) Settlement management.
(5) Realize classification query.
(6) Output the corresponding datagram

Describe the main functions of each business.


1. Room management: store room information data, room number, customers can check the room type (single room, standard room, deluxe room, business room, executive room), room price, room status (with or without guests, no guests: the room can be reserved , the room can be transferred in. There are guests: the guest can check out and transfer), and the room corresponds to the floor.
2. Customer management: Customers are divided into individual reservation customers and team reservation customers (reservation time, reservation customer number), individual check-in customers and team check-in customers (check-in time, check-in customer number), and room change function.
3. Employee management: You can add employees (name, gender, employee number, position, entry time), delete employees, modify employees, and query employee information. You can view all orders, add, delete, and modify rooms (room number, room type, price).
4. Reports and maintenance: data backup (export data, import data, export data tables to tables), reports.
5. Order management function: order record report, room type (picture description), payment amount, customer information (customer number, check-in time, check-out time) 6. Login function: login (staff (account password)
login /Customer (account password) login) password retrieval function, password modification function.

2. Analyze and list the data items involved according to the function.

  1. booking_client personal reservation form: (cid customer number, rid room number, star_time check-in time, end_time check-out time, booking_time reservation time, remark note)
  2. booking_team team booking form: (tid team number, rid room number, star_time check-in time, end_time check-out time, booking_time booking time, remark note)
  3. checking_clint personal check-in form: (rid room number, cid customer number, star_time check-in time, end_time check-out time, total_price total price, check_in_sid check-in employee number, remark note)
  4. Checking_team team check-in form: (rid room number, tid team good, star_time check-in time, end_time check-out time, total_price total price, check_in_sid check-in staff number, remark note)
  5. Client customer table: (cname name, cid customer number, cphone phone number, cage age, csex gender, register_sid registered employee number, accommodation_times check-in times, register_time registration time)
  6. Hotel order order form: (id user identification, ordertype order form, start_time reservation time, rid room number, pay_type payment method, money payment price, remark remarks, order_time order time, register_sid registered employee time number)
  7. room table: (rid room number, rtype type, rstorey floor, rprice price, rdesc room status, rpic room picture)
  8. Staff employee form: (sid employee number, sname name, ssex gender, stime registration entry time, susername account number, password password, srole permission, sidcard ID card, sphone mobile phone number)

9. Team table: (tname name, tid team name, tphone phone number, check_in_sid login employee number, accomodation_time check-in times, register_time registration time)

Second, the specific realization of the project

        1. A brief description of the data item.

1、booking_client客户个人预定表 (
  cid varchar(255) NOT NULL
  rid varchar(255) NOT NULL
  start_time date DEFAULT NULL
  end_time  date DEFAULT NULL)
2、booking_team团队预定表(
  tid varchar(255) NOT NULL
  rid varchar(255) NOT NULL
  start_time  date DEFAULT NULL
  end_time  date DEFAULT NULL
  booking_time  timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP)
   remark varchar(255) DEFAULT NULL
3、checkin_client个人入住表 (
  rid 房间号 varchar(255) NOT NULL
  cid客户号  varchar(255) NOT NULL
  start_time入住时间  date DEFAULT NULL
  end_time退房时间  date DEFAULT NULL
  total_price总价格  varchar(255) DEFAULT NULL
  check_in_sid办理入住的员工编号  varchar(255) DEFAULT NULL
  remark备注  varchar(255) DEFAULT NULL)
4、checkin_team团队入住表(
  rid房间号 varchar(255) NOT NULL
  tid 客户号  varchar(255) NOT NULL
  start_time入住时间 date DEFAULT NULL
  end_time退房时间  date DEFAULT NULL
  total_price总价格  varchar(255) DEFAULT NULL,
  check_in_sid办理入住的员工编号  varchar(255) DEFAULT NULL,
  remark备注   varchar(255) DEFAULT NULL)
5、 client客户表 (
  cname姓名  varchar(255) NOT NULL
  cid客户号  varchar(255) NOT NULL
  cphone电话号  varchar(255) DEFAULT NULL
  cage年龄  varchar(255) NOT NULL
  csex性别  varchar(255) DEFAULT NULL
  register_sid注册员工号  varchar(255) DEFAULT NULL
  accomodation_times入住次数  int(11) DEFAULT NULL)
  register_time注册时间  timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP)
6、hotelorder订单表 (
  id 用户标识  varchar(255) NOT NULL
  ordertype订单形式  varchar(255) NOT NULL
  start_time入住时间  date NOT NULL
  end_time退房时间  date NOT NULL
  rid房间号  varchar(255) NOT NULL
  pay_type支付方式  varchar(255) DEFAULT NULL
  money缴费  varchar(255) DEFAULT NULL
  remarkv备注  varchar(255) DEFAULT NULL
  order_time订单时间  timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
  register_sid注册员工编号  varchar(255) DEFAULT NULL)
7、room房间表 (
  rid房间号  varchar(255) NOT NULL
  rtype房间类型  varchar(255) NOT NULL
  rstorey楼层  varchar(255) NOT NULL
  rprice价格  varchar(255) NOT NULL
  rdesc房间状态  varchar(255) DEFAULT NULL
  rpic房间图片  varchar(255) DEFAULT NULL)
8、 staff员工表 (
  sid 员工号  varchar(255) NOT NULL
  sname 姓名  varchar(255) NOT NULL
  ssex性别  varchar(255) DEFAULT NULL
  stime入职时间  date DEFAULT NULL
  susername账号  varchar(255) NOT NULL
  spassword 密码  varchar(255) NOT NULL
  srole 权限  varchar(255) NOT NULL
  sidcard 身份证号  varchar(255) NOT NULL
  sphone 手机号码 varchar(255) DEFAULT NULL)
9、team 团队表(
  tname名字  varchar(255) NOT NULL
  tid团队号  varchar(255) NOT NULL
  tphone电话号码  varchar(255) DEFAULT NULL
  check_in_sid 登记员工编号 varchar(255) DEFAULT NULL
  accomodation_times 入住次数 int(11) DEFAULT NULL
  register_time注册时间 timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP)

        2. Safety analysis

Data security refers to protecting digital information from unauthorized access and resisting risks such as damage and theft during the entire life cycle of digital information. To this end, we have set up permission access, and only the correct account password can be viewed For related information, non-administrator logins cannot obtain system information. In addition, we can also view the corresponding data reports and customer employee personal information through the input account password matching, or modify the data that needs to be changed. This also makes it difficult for information to be leaked out, increasing the modifiability of data. In order to prevent the administrator from wanting to change the password, we have also set up the function of changing the password on the login page, which strengthens the security of the data. In order to prevent problems such as loss of original data caused by human error, data loss caused by software bugs, and database data loss caused by hardware failures, we have set up database backups to retrieve lost data information. Especially the customer's reservation information, check-in information and data report information, our database will be updated every time a new customer or group is added, which is also conducive to our data verification. Using database backups also facilitates the use of the same database for new environment setups and development and test environment database setups. From the perspectives of data security, data backup and others, describe the security policies and risk control policies that the system can adopt

        3. Give the relationship model, and mark the primary key and external key of the relationship model.

1. booking_client personal booking form: (cid,rid,star_time,end_time,booking_time,remark)

Primary key: (cid,rid)

外码:(cid) REFERENCES client (cid)

  (rid) REFERENCES room (rid)

Normal form level: 1NF

2. booking_team team booking table: (tid, rid, star_time, end_time, booking_time, remark)

Primary key: (tid,rid)

外码:(time) REFERENCES team (time)

  (rid) REFERENCES room (rid)

    Normal form level: 1NF

3. Checking_clint personal check-in form: (rid, cid, star_time, end_time, total_price, check_in_sid, remark)

Primary key: (rid,cid)

外码: (rid) REFERENCES  room (rid)

 (cid) REFERENCES client (cid)

 (check_in_sid) REFERENCES staff (sid)

Normal form level: 1NF

4. Checking_team check-in form: (rid, tid, star_time, end_time, total_price, check_in_sid, remark)

Primary key: (rid,tid)

外码:(rid) REFERENCES room (rid)

 (check_in_sid) REFERENCES staff (sid)

  (time) REFERENCES team (time)

Normal form level: 1NF

5. clien customer table: (cname, cid, cphone, cage, csex, register_sid, accommodation_times entry, register_time)

Primary code: (cid)

外码:(register_sid) REFERENCES staff(sid)

Paradigm level: 3NF

6、hotelorder订单表:(id,ordertype,start_time,rid,pay_type,money,remark,order_time,register_sid)

主码:(id,start_time,end_time,rid,ordertype)

外码:(rid) REFERENCES room(rid)

Normal form level: 1NF

7. Room table: (rid, rtype, rstorey, rprice, rdesc, rpic)

Primary code: (rid)

Outer code: no

Paradigm level: BCNF

8. Staff table: (sid, sname, ssex, stime, susername, password, srole, sidcard, sphone)

Primary key: (sid)

Outer code: no

Paradigm level: BCNF

9, team team table: (tname, tid, tphone, check_in_sid, accommodation_time, register_time)

Primary code: (tid)

外码:(check_in_sid) REFERENCES staff (sid)

Paradigm level: 3NF

        4. Global ER diagram

        5. Data Security

 Data security refers to protecting digital information from unauthorized access and resisting risks such as damage and theft during the entire life cycle of digital information. To this end, we have set up permission access, and only the correct account password can be viewed For related information, non-administrator logins cannot obtain system information. In addition, we can also view the corresponding data reports and customer employee personal information through the input account password matching, or modify the data that needs to be changed. This also makes it difficult for information to be leaked out, increasing the modifiability of data. If the user wants to change the password, we have also set up the function of changing the password on the login page, which strengthens the security of the data. In order to prevent problems such as loss of original data caused by human error, data loss caused by software bugs, and database data loss caused by hardware failures, we have set up database backups to retrieve lost data information. Especially the customer's reservation information, check-in information and data report information, our database will be updated every time a new customer or group is added, which is also conducive to our data verification. Using database backups also facilitates the use of the same database for new environment setups and development and test environment database setups.

Third, the creation of the database

There are too many pictures, and it would be too much space to post them all. If you want to see them, just like, bookmark and follow, and then private message me in the background.

 

 Four, GUI interface presentation

It's the same, I didn't show all the interface, but only a part of it. If you want to see the follow-up, just like, bookmark and follow, and then private message me in the background.

1. Modify password interface

2. View personal information, employees can log in to view

3. Add employees and fill in their basic information

 

4. Query room information

 

 5. Query report: occupancy rate and order volume, as well as relevant information of customers and employees

 6. Database risk prevention measures: data backup, and generate the backup file on the computer

 7. The main interface of the hotel management system

Five, the code file

 

 If you need the source code, please like, collect and follow, and then private message me in the background! ! !

Guess you like

Origin blog.csdn.net/m0_63309778/article/details/132414740