mirror of
				https://github.com/FreeeBird/hotel.git
				synced 2025-10-31 20:44:52 +08:00 
			
		
		
		
	1.更改字符串常量
2.添加数据库创建sql
This commit is contained in:
		| @@ -3,7 +3,7 @@ package cn.mafangui.hotel.controller; | |||||||
|  |  | ||||||
| import cn.mafangui.hotel.entity.Room; | import cn.mafangui.hotel.entity.Room; | ||||||
| import cn.mafangui.hotel.service.RoomService; | import cn.mafangui.hotel.service.RoomService; | ||||||
| import cn.mafangui.hotel.utils.finalString; | import cn.mafangui.hotel.utils.StaticString; | ||||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||||
| import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||||
| @@ -20,25 +20,26 @@ public class RoomController { | |||||||
|      * 增加房间 |      * 增加房间 | ||||||
|      * @param roomNumber |      * @param roomNumber | ||||||
|      * @param roomFloor |      * @param roomFloor | ||||||
|      * @param roomType |  | ||||||
|      * @param typeName |      * @param typeName | ||||||
|      * @param roomPrice |      * @param roomPrice | ||||||
|      * @param roomDiscount |      * @param roomDiscount | ||||||
|      * @param roomStatus |      * @param roomStatus | ||||||
|  |      * @param remark | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     @RequestMapping(value = "/add") |     @RequestMapping(value = "/add") | ||||||
|     public HashMap addRoom(String roomNumber, int roomFloor, int roomType, String typeName, double roomPrice,double roomDiscount,String roomStatus){ |     public HashMap addRoom(String roomNumber, int roomFloor, String typeName, | ||||||
|  |                            double roomPrice,double roomDiscount,String roomStatus,String remark){ | ||||||
|         HashMap result = new HashMap(); |         HashMap result = new HashMap(); | ||||||
|         int data = 0; |         int data = 0; | ||||||
|         Room room = new Room(roomNumber,roomFloor,roomType,typeName,roomPrice,roomDiscount,roomStatus); |         Room room = new Room(roomNumber,roomFloor,typeName,roomPrice,roomDiscount,roomStatus,remark); | ||||||
|         try { |         try { | ||||||
|             data = roomService.addRoom(room); |             data = roomService.addRoom(room); | ||||||
|         }catch (Exception e){ |         }catch (Exception e){ | ||||||
|             data = -1; |             data = -1; | ||||||
|         } |         } | ||||||
|         result.put(finalString.CODE,20000); |         result.put(StaticString.CODE,20000); | ||||||
|         result.put(finalString.DATA,data); |         result.put(StaticString.DATA,data); | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -61,8 +62,8 @@ public class RoomController { | |||||||
|         }catch (Exception e){ |         }catch (Exception e){ | ||||||
|             data = -1; |             data = -1; | ||||||
|         } |         } | ||||||
|         result.put(finalString.CODE,20000); |         result.put(StaticString.CODE,20000); | ||||||
|         result.put(finalString.DATA,data); |         result.put(StaticString.DATA,data); | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -71,26 +72,27 @@ public class RoomController { | |||||||
|      * @param roomId |      * @param roomId | ||||||
|      * @param roomNumber |      * @param roomNumber | ||||||
|      * @param roomFloor |      * @param roomFloor | ||||||
|      * @param roomType |  | ||||||
|      * @param typeName |      * @param typeName | ||||||
|      * @param roomPrice |      * @param roomPrice | ||||||
|      * @param roomDiscount |      * @param roomDiscount | ||||||
|      * @param roomStatus |      * @param roomStatus | ||||||
|  |      * @param remark | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     @RequestMapping(value = "/update") |     @RequestMapping(value = "/update") | ||||||
|     public HashMap updateRoom(int roomId,String roomNumber, int roomFloor, int roomType, String typeName, double roomPrice,double roomDiscount,String roomStatus){ |     public HashMap updateRoom(int roomId,String roomNumber, int roomFloor, String typeName, | ||||||
|  |                               double roomPrice,double roomDiscount,String roomStatus,String remark){ | ||||||
|         HashMap result = new HashMap(); |         HashMap result = new HashMap(); | ||||||
|         int data = 0; |         int data = 0; | ||||||
|         Room room = new Room(roomNumber,roomFloor,roomType,typeName,roomPrice,roomDiscount,roomStatus); |         Room room = new Room(roomNumber,roomFloor,typeName,roomPrice,roomDiscount,roomStatus,remark); | ||||||
|         room.setRoomId(roomId); |         room.setRoomId(roomId); | ||||||
|         try { |         try { | ||||||
|             data = roomService.updateRoom(room); |             data = roomService.updateRoom(room); | ||||||
|         }catch (Exception e){ |         }catch (Exception e){ | ||||||
|             data = -1; |             data = -1; | ||||||
|         } |         } | ||||||
|         result.put(finalString.CODE,20000); |         result.put(StaticString.CODE,20000); | ||||||
|         result.put(finalString.DATA,data); |         result.put(StaticString.DATA,data); | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -101,8 +103,8 @@ public class RoomController { | |||||||
|     @RequestMapping(value = "/all") |     @RequestMapping(value = "/all") | ||||||
|     public HashMap allRoom(){ |     public HashMap allRoom(){ | ||||||
|         HashMap result = new HashMap(); |         HashMap result = new HashMap(); | ||||||
|         result.put(finalString.DATA,roomService.findAll()); |         result.put(StaticString.DATA,roomService.findAll()); | ||||||
|         result.put(finalString.CODE,20000); |         result.put(StaticString.CODE,20000); | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -115,11 +117,11 @@ public class RoomController { | |||||||
|     @RequestMapping(value = "/withId") |     @RequestMapping(value = "/withId") | ||||||
|     public HashMap findRoomById(int roomId){ |     public HashMap findRoomById(int roomId){ | ||||||
|         HashMap result = new HashMap(); |         HashMap result = new HashMap(); | ||||||
|         result.put(finalString.CODE,20000); |         result.put(StaticString.CODE,20000); | ||||||
|         try{ |         try{ | ||||||
|             result.put(finalString.DATA,roomService.findById(roomId)); |             result.put(StaticString.DATA,roomService.findById(roomId)); | ||||||
|         }catch (Exception e){ |         }catch (Exception e){ | ||||||
|             result.put(finalString.DATA,-1); |             result.put(StaticString.DATA,-1); | ||||||
|         } |         } | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
| @@ -132,11 +134,11 @@ public class RoomController { | |||||||
|     @RequestMapping(value = "/withRoomNumber") |     @RequestMapping(value = "/withRoomNumber") | ||||||
|     public HashMap findRoomByNumber(String roomNumber){ |     public HashMap findRoomByNumber(String roomNumber){ | ||||||
|         HashMap result = new HashMap(); |         HashMap result = new HashMap(); | ||||||
|         result.put(finalString.CODE,20000); |         result.put(StaticString.CODE,20000); | ||||||
|         try{ |         try{ | ||||||
|             result.put(finalString.DATA,roomService.findByNumber(roomNumber)); |             result.put(StaticString.DATA,roomService.findByNumber(roomNumber)); | ||||||
|         }catch (Exception e){ |         }catch (Exception e){ | ||||||
|             result.put(finalString.DATA,-1); |             result.put(StaticString.DATA,-1); | ||||||
|         } |         } | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
| @@ -149,11 +151,11 @@ public class RoomController { | |||||||
|     @RequestMapping(value = "/withStatus") |     @RequestMapping(value = "/withStatus") | ||||||
|     public HashMap findRoomByStatus(String roomStatus){ |     public HashMap findRoomByStatus(String roomStatus){ | ||||||
|         HashMap result = new HashMap(); |         HashMap result = new HashMap(); | ||||||
|         result.put(finalString.CODE,20000); |         result.put(StaticString.CODE,20000); | ||||||
|         try{ |         try{ | ||||||
|             result.put(finalString.DATA,roomService.findByStatus(roomStatus)); |             result.put(StaticString.DATA,roomService.findByStatus(roomStatus)); | ||||||
|         }catch (Exception e){ |         }catch (Exception e){ | ||||||
|             result.put(finalString.DATA,-1); |             result.put(StaticString.DATA,-1); | ||||||
|         } |         } | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
| @@ -166,11 +168,11 @@ public class RoomController { | |||||||
|     @RequestMapping(value = "/withType") |     @RequestMapping(value = "/withType") | ||||||
|     public HashMap findRoomByType(String typeName){ |     public HashMap findRoomByType(String typeName){ | ||||||
|         HashMap result = new HashMap(); |         HashMap result = new HashMap(); | ||||||
|         result.put(finalString.CODE,20000); |         result.put(StaticString.CODE,20000); | ||||||
|         try{ |         try{ | ||||||
|             result.put(finalString.DATA,roomService.findByType(typeName)); |             result.put(StaticString.DATA,roomService.findByType(typeName)); | ||||||
|         }catch (Exception e){ |         }catch (Exception e){ | ||||||
|             result.put(finalString.DATA,-1); |             result.put(StaticString.DATA,-1); | ||||||
|         } |         } | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| package cn.mafangui.hotel.entity; | package cn.mafangui.hotel.entity; | ||||||
|  |  | ||||||
| import java.math.BigDecimal; | import java.math.BigInteger; | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
|  |  | ||||||
| public class Room { | public class Room { | ||||||
| @@ -10,9 +10,7 @@ public class Room { | |||||||
|  |  | ||||||
|     private Integer roomFloor; |     private Integer roomFloor; | ||||||
|  |  | ||||||
|     private Integer roomType; |     private String roomType; | ||||||
|  |  | ||||||
|     private String typeName; |  | ||||||
|  |  | ||||||
|     private Double roomPrice; |     private Double roomPrice; | ||||||
|  |  | ||||||
| @@ -20,6 +18,8 @@ public class Room { | |||||||
|  |  | ||||||
|     private String roomStatus; |     private String roomStatus; | ||||||
|  |  | ||||||
|  |     private String remark; | ||||||
|  |  | ||||||
|     private Date createTime; |     private Date createTime; | ||||||
|  |  | ||||||
|     private Date updateTime; |     private Date updateTime; | ||||||
| @@ -48,22 +48,14 @@ public class Room { | |||||||
|         this.roomFloor = roomFloor; |         this.roomFloor = roomFloor; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public Integer getRoomType() { |     public String getRoomType() { | ||||||
|         return roomType; |         return roomType; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void setRoomType(Integer roomType) { |     public void setRoomType(String roomType) { | ||||||
|         this.roomType = roomType; |         this.roomType = roomType; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public String getTypeName() { |  | ||||||
|         return typeName; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public void setTypeName(String typeName) { |  | ||||||
|         this.typeName = typeName; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public Double getRoomPrice() { |     public Double getRoomPrice() { | ||||||
|         return roomPrice; |         return roomPrice; | ||||||
|     } |     } | ||||||
| @@ -88,6 +80,14 @@ public class Room { | |||||||
|         this.roomStatus = roomStatus == null ? null : roomStatus.trim(); |         this.roomStatus = roomStatus == null ? null : roomStatus.trim(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public String getRemark() { | ||||||
|  |         return remark; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void setRemark(String remark) { | ||||||
|  |         this.remark = remark; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     public Date getCreateTime() { |     public Date getCreateTime() { | ||||||
|         return createTime; |         return createTime; | ||||||
|     } |     } | ||||||
| @@ -107,14 +107,14 @@ public class Room { | |||||||
|     public Room() { |     public Room() { | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public Room(String roomNumber, Integer roomFloor, Integer roomType, String typeName, Double roomPrice, Double roomDiscount, String roomStatus) { |     public Room(String roomNumber, Integer roomFloor, String roomType, Double roomPrice, Double roomDiscount, String roomStatus,String remark) { | ||||||
|         this.roomNumber = roomNumber; |         this.roomNumber = roomNumber; | ||||||
|         this.roomFloor = roomFloor; |         this.roomFloor = roomFloor; | ||||||
|         this.roomType = roomType; |         this.roomType = roomType; | ||||||
|         this.typeName = typeName; |  | ||||||
|         this.roomPrice = roomPrice; |         this.roomPrice = roomPrice; | ||||||
|         this.roomDiscount = roomDiscount; |         this.roomDiscount = roomDiscount; | ||||||
|         this.roomStatus = roomStatus; |         this.roomStatus = roomStatus; | ||||||
|  |         this.remark = remark; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
| @@ -123,8 +123,7 @@ public class Room { | |||||||
|                 "roomId=" + roomId + |                 "roomId=" + roomId + | ||||||
|                 ", roomNumber='" + roomNumber + '\'' + |                 ", roomNumber='" + roomNumber + '\'' + | ||||||
|                 ", roomFloor=" + roomFloor + |                 ", roomFloor=" + roomFloor + | ||||||
|                 ", roomType=" + roomType + |                 ", roomType='" + roomType + '\'' + | ||||||
|                 ", typeName='" + typeName + '\'' + |  | ||||||
|                 ", roomPrice=" + roomPrice + |                 ", roomPrice=" + roomPrice + | ||||||
|                 ", roomDiscount=" + roomDiscount + |                 ", roomDiscount=" + roomDiscount + | ||||||
|                 ", roomStatus='" + roomStatus + '\'' + |                 ", roomStatus='" + roomStatus + '\'' + | ||||||
|   | |||||||
| @@ -1,7 +1,8 @@ | |||||||
| package cn.mafangui.hotel.utils; | package cn.mafangui.hotel.utils; | ||||||
| 
 | 
 | ||||||
| public class finalString { | public class StaticString { | ||||||
|     public static final String CODE = "code"; |     public static final String CODE = "code"; | ||||||
|  |     public static final String STATUS = "status"; | ||||||
|     public static final String DATA = "data"; |     public static final String DATA = "data"; | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| @@ -59,23 +59,26 @@ | |||||||
|         <!-- schema即为数据库名 tableName为对应的数据库表 domainObjectName是要生成的实体类 enable*ByExample |         <!-- schema即为数据库名 tableName为对应的数据库表 domainObjectName是要生成的实体类 enable*ByExample | ||||||
|             是否生成 example类 --> |             是否生成 example类 --> | ||||||
|  |  | ||||||
|         <table schema="hotel" tableName="user" |         <table schema="hotel" tableName="user_info" | ||||||
|                domainObjectName="User" enableCountByExample="false" |                domainObjectName="User" enableCountByExample="true" | ||||||
|                enableDeleteByExample="false" enableSelectByExample="false" |                enableDeleteByExample="true" enableSelectByExample="true" | ||||||
|                enableUpdateByExample="false"> |                enableUpdateByExample="true"> | ||||||
|         </table> |         </table> | ||||||
|  |         <table schema="hotel" tableName="worker_info" | ||||||
|         <table schema="hotel" tableName="worker" |  | ||||||
|                domainObjectName="Worker" enableCountByExample="false" |                domainObjectName="Worker" enableCountByExample="false" | ||||||
|                enableDeleteByExample="false" enableSelectByExample="false" |                enableDeleteByExample="false" enableSelectByExample="false" | ||||||
|                enableUpdateByExample="false"> |                enableUpdateByExample="false"> | ||||||
|         </table> |         </table> | ||||||
|  |  | ||||||
|         <table schema="hotel" tableName="room_type" |         <table schema="hotel" tableName="room_type" | ||||||
|                domainObjectName="RoomType" enableCountByExample="false" |                domainObjectName="RoomType" enableCountByExample="false" | ||||||
|                enableDeleteByExample="false" enableSelectByExample="false" |                enableDeleteByExample="false" enableSelectByExample="false" | ||||||
|                enableUpdateByExample="false"> |                enableUpdateByExample="false"> | ||||||
|         </table> |         </table> | ||||||
|  |         <table schema="hotel" tableName="order_type" | ||||||
|  |                domainObjectName="OrderType" enableCountByExample="false" | ||||||
|  |                enableDeleteByExample="false" enableSelectByExample="false" | ||||||
|  |                enableUpdateByExample="false"> | ||||||
|  |         </table> | ||||||
|         <table schema="hotel" tableName="room_info" |         <table schema="hotel" tableName="room_info" | ||||||
|                domainObjectName="Room" enableCountByExample="false" |                domainObjectName="Room" enableCountByExample="false" | ||||||
|                enableDeleteByExample="false" enableSelectByExample="false" |                enableDeleteByExample="false" enableSelectByExample="false" | ||||||
| @@ -91,15 +94,15 @@ | |||||||
|                enableDeleteByExample="false" enableSelectByExample="false" |                enableDeleteByExample="false" enableSelectByExample="false" | ||||||
|                enableUpdateByExample="false"> |                enableUpdateByExample="false"> | ||||||
|         </table> |         </table> | ||||||
|  |         <table schema="hotel" tableName="department_info" | ||||||
|  |                domainObjectName="Department" enableCountByExample="false" | ||||||
|  |                enableDeleteByExample="false" enableSelectByExample="false" | ||||||
|  |                enableUpdateByExample="false"> | ||||||
|  |         </table> | ||||||
|         <table schema="hotel" tableName="check_in" |         <table schema="hotel" tableName="check_in" | ||||||
|                domainObjectName="CheckIn" enableCountByExample="false" |                domainObjectName="CheckIn" enableCountByExample="false" | ||||||
|                enableDeleteByExample="false" enableSelectByExample="false" |                enableDeleteByExample="false" enableSelectByExample="false" | ||||||
|                enableUpdateByExample="false"> |                enableUpdateByExample="false"> | ||||||
|         </table> |         </table> | ||||||
|         <table schema="hotel" tableName="admin" |  | ||||||
|                domainObjectName="Admin" enableCountByExample="false" |  | ||||||
|                enableDeleteByExample="false" enableSelectByExample="false" |  | ||||||
|                enableUpdateByExample="false"> |  | ||||||
|         </table> |  | ||||||
|     </context> |     </context> | ||||||
| </generatorConfiguration> | </generatorConfiguration> | ||||||
| @@ -43,6 +43,7 @@ | |||||||
|     </settings> |     </settings> | ||||||
|     <typeAliases> |     <typeAliases> | ||||||
|         <typeAlias alias="Integer" type="java.lang.Integer" /> |         <typeAlias alias="Integer" type="java.lang.Integer" /> | ||||||
|  |         <typeAlias alias="String" type="java.lang.String" /> | ||||||
|         <typeAlias alias="Long" type="java.lang.Long" /> |         <typeAlias alias="Long" type="java.lang.Long" /> | ||||||
|         <typeAlias alias="HashMap" type="java.util.HashMap" /> |         <typeAlias alias="HashMap" type="java.util.HashMap" /> | ||||||
|         <typeAlias alias="LinkedHashMap" type="java.util.LinkedHashMap" /> |         <typeAlias alias="LinkedHashMap" type="java.util.LinkedHashMap" /> | ||||||
|   | |||||||
							
								
								
									
										157
									
								
								src/main/resources/schema.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										157
									
								
								src/main/resources/schema.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,157 @@ | |||||||
|  | -- 创建数据库 | ||||||
|  | DROP DATABASE | ||||||
|  | IF EXISTS hotel; | ||||||
|  |  | ||||||
|  | CREATE DATABASE hotel DEFAULT CHARACTER SET utf8; | ||||||
|  | use hotel | ||||||
|  |  | ||||||
|  | -- 1客房类型表 | ||||||
|  | CREATE TABLE | ||||||
|  | IF NOT EXISTS `room_type` ( | ||||||
|  | 	`type_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '类型ID', | ||||||
|  | 	`room_type` VARCHAR(16) not NULL COMMENT '类型名', | ||||||
|  | 	`remark` VARCHAR(128) null COMMENT '房型备注', | ||||||
|  | 	`price` DOUBLE NOT NULL DEFAULT 0 COMMENT '预定价格', | ||||||
|  | 	`discount` DOUBLE NOT NULL COMMENT '预定折扣', | ||||||
|  | 	`area` int not null DEFAULT 12 COMMENT '房间大小:m2', | ||||||
|  | 	`bed_num` int not null DEFAULT 1 COMMENT '床位', | ||||||
|  | 	`bed_size` varchar(16) not null DEFAULT '1.5m*1.8m' COMMENT '床位大小', | ||||||
|  | 	`window` int not null DEFAULT 0 COMMENT '是否有窗:0-无,1-有', | ||||||
|  | 	`create_time` TIMESTAMP not null DEFAULT '0000-00-00 00:00:00' COMMENT '创建时间', | ||||||
|  | 	`update_time` TIMESTAMP null ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||||||
|  | 	PRIMARY KEY (`type_id`), | ||||||
|  | 	UNIQUE KEY `uqe_room_type` (`room_type`) | ||||||
|  |  | ||||||
|  | ) COMMENT '房间类型表'; | ||||||
|  |  | ||||||
|  | -- 2客房信息表 | ||||||
|  | CREATE TABLE | ||||||
|  | IF NOT EXISTS `room_info` ( | ||||||
|  | 	`room_id` INT NOT NULL AUTO_INCREMENT COMMENT '房间id', | ||||||
|  | 	`room_number` VARCHAR (8) NOT NULL COMMENT '房间号码', | ||||||
|  | 	`type_id` int NOT NULL COMMENT '房间类型ID', | ||||||
|  | 	`room_type` VARCHAR(16) NOT NULL COMMENT '房间类型', | ||||||
|  | 	`room_price` DOUBLE NOT NULL DEFAULT 0 COMMENT '房间价格', | ||||||
|  | 	`room_discount` DOUBLE NOT NULL DEFAULT 0 COMMENT '房间折扣', | ||||||
|  | 	`room_status` int NOT NULL DEFAULT 1 COMMENT '房间状态:1-可预订,0-已被预订,-1:已入住,-2:不可用', | ||||||
|  | 	`remark` VARCHAR(255) null COMMENT '备注', | ||||||
|  | 	`create_time` TIMESTAMP not null DEFAULT '0000-00-00 00:00:00' COMMENT '创建时间', | ||||||
|  | 	`update_time` TIMESTAMP null ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||||||
|  | 	PRIMARY KEY (`room_id`), | ||||||
|  | 	UNIQUE KEY `uqe_room_number` (`room_number`) | ||||||
|  | ) COMMENT '房间信息表'; | ||||||
|  |  | ||||||
|  | -- 3入住退房登记信息表 | ||||||
|  | CREATE TABLE | ||||||
|  | IF NOT EXISTS `check_in` ( | ||||||
|  | 	`check_in_id` INT AUTO_INCREMENT COMMENT '入住id', | ||||||
|  | 	`order_id` int NOT NULL COMMENT '订单号', | ||||||
|  | 	`room_number` VARCHAR (8) NOT NULL comment '房间号', | ||||||
|  | 	`room_type` VARCHAR(16) NOT NULL COMMENT '房间类型', | ||||||
|  | 	`peo_count` INT NOT NULL DEFAULT 1 COMMENT '入住人数', | ||||||
|  | 	`persons` VARCHAR (255) NOT NULL COMMENT '入住人', | ||||||
|  | 	`ids` VARCHAR (255) NOT NULL COMMENT '身份证号', | ||||||
|  | 	`check_in_time` TIMESTAMP null DEFAULT '0000-00-00 00:00:00' COMMENT '入住时间', | ||||||
|  | 	`create_time` TIMESTAMP not null DEFAULT '0000-00-00 00:00:00' COMMENT '创建时间', | ||||||
|  | 	`update_time` TIMESTAMP null ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||||||
|  | 	PRIMARY KEY (`check_in_id`), | ||||||
|  | 	UNIQUE KEY `uqe_order_id`(`order_id`) | ||||||
|  | ) comment '入住退房登记表'; | ||||||
|  |  | ||||||
|  | -- 4订单信息表 | ||||||
|  | CREATE TABLE | ||||||
|  | IF NOT EXISTS `order_info` ( | ||||||
|  | 	`order_id` INT AUTO_INCREMENT COMMENT '订单号', | ||||||
|  | 	`order_type` VARCHAR(8) not null COMMENT '预订方式', | ||||||
|  | 	`phone` VARCHAR (16) NOT NULL COMMENT '手机号', | ||||||
|  | 	`room_type` VARCHAR (16) not null COMMENT '房间类型', | ||||||
|  | 	`num_of_room` int not null DEFAULT 1 COMMENT '房间数', | ||||||
|  | 	`order_date` DATE not null COMMENT '预订日期', | ||||||
|  | 	`order_days` INT NOT NULL DEFAULT 1 COMMENT '预定天数', | ||||||
|  | 	`order_status` int not null DEFAULT 0 COMMENT '订单状态:0-已下单,1-已付款,2-已消费,-1-已取消,-2-被删除', | ||||||
|  | 	`order_cost` DOUBLE NOT NULL COMMENT '订单费用', | ||||||
|  | 	`create_time` TIMESTAMP null DEFAULT '0000-00-00 00:00:00' COMMENT '创建时间', | ||||||
|  | 	`update_time` TIMESTAMP null ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||||||
|  | 	PRIMARY KEY (`order_id`) | ||||||
|  | ) COMMENT '订单信息表'; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | -- 5注册用户信息表 | ||||||
|  | CREATE TABLE | ||||||
|  | IF NOT EXISTS `user_info` ( | ||||||
|  | 	`user_id` INT NULL AUTO_INCREMENT COMMENT '用户id', | ||||||
|  | 	`username` VARCHAR (16) NOT NULL COMMENT '用户名', | ||||||
|  | 	`password` VARCHAR (16) NOT NULL COMMENT '密码', | ||||||
|  | 	`name` VARCHAR(16) not NULL COMMENT '姓名', | ||||||
|  | 	`gender` CHAR(2) not null DEFAULT '男' COMMENT '性别', | ||||||
|  | 	`phone` VARCHAR (16) NOT NULL COMMENT '手机号码', | ||||||
|  | 	`email` VARCHAR (16) NULL COMMENT '邮箱地址', | ||||||
|  | 	`address` VARCHAR (32) NULL COMMENT '地址', | ||||||
|  | 	`idcard` VARCHAR (32) NOT NULL COMMENT '身份证号码', | ||||||
|  | 	`create_time` TIMESTAMP not null DEFAULT '0000-00-00 00:00:00' COMMENT '创建时间', | ||||||
|  | 	`update_time` TIMESTAMP null ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||||||
|  | 	PRIMARY KEY (`user_id`), | ||||||
|  | 	UNIQUE KEY `uqe_username` (`username`) | ||||||
|  | ) COMMENT '注册用户信息表'; | ||||||
|  |  | ||||||
|  | -- 6工作人员信息表 | ||||||
|  | CREATE TABLE | ||||||
|  | IF NOT EXISTS `worker_info` ( | ||||||
|  | 	`worker_id` INT NULL AUTO_INCREMENT COMMENT '操作员id', | ||||||
|  | 	`role` VARCHAR(8) NOT NULL DEFAULT 'worker' COMMENT '角色:worker/admin', | ||||||
|  | 	`username` VARCHAR (16) NOT NULL COMMENT '用户名', | ||||||
|  | 	`password` VARCHAR (16) NOT NULL COMMENT '密码', | ||||||
|  | 	`name` VARCHAR (8) NOT NULL comment '姓名', | ||||||
|  | 	`gender` CHAR(2) not null DEFAULT '男' COMMENT '性别', | ||||||
|  | 	`phone` VARCHAR (16) NOT NULL COMMENT '手机号码', | ||||||
|  | 	`department` int null COMMENT '部门', | ||||||
|  | 	`email` VARCHAR (16) NULL COMMENT '邮箱地址', | ||||||
|  | 	`address` VARCHAR (32) NULL COMMENT '地址', | ||||||
|  | 	`create_time` TIMESTAMP not null DEFAULT '0000-00-00 00:00:00' COMMENT '创建时间', | ||||||
|  | 	`update_time` TIMESTAMP null ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||||||
|  | 	PRIMARY KEY (`worker_id`), | ||||||
|  | 	UNIQUE KEY `uqe_username` (`username`) | ||||||
|  |  | ||||||
|  | ) COMMENT '工作人员信息表' | ||||||
|  |  | ||||||
|  | -- 7酒店信息表 | ||||||
|  | CREATE TABLE | ||||||
|  | IF NOT EXISTS `hotel_info` ( | ||||||
|  | 	`hotel_id` int not null auto_increment COMMENT '酒店id', | ||||||
|  | 	`hotel_name` VARCHAR (16) NOT NULL COMMENT '酒店名', | ||||||
|  | 	`phone` VARCHAR (16) NULL COMMENT '手机号', | ||||||
|  | 	`telephone` VARCHAR (16) NOT NULL COMMENT '电话号码', | ||||||
|  | 	`email` VARCHAR (16) NOT NULL COMMENT '电子邮箱', | ||||||
|  | 	`address` VARCHAR (32) NOT NULL COMMENT '地址', | ||||||
|  | 	`website` VARCHAR (16) NOT NULL COMMENT '网站', | ||||||
|  | 	`create_time` TIMESTAMP not null DEFAULT '0000-00-00 00:00:00' COMMENT '创建时间', | ||||||
|  | 	`update_time` TIMESTAMP null ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||||||
|  | 	PRIMARY KEY (`hotel_id`) | ||||||
|  |  | ||||||
|  | ) comment '酒店信息表'; | ||||||
|  |  | ||||||
|  | -- 8部门信息表 | ||||||
|  | CREATE TABLE | ||||||
|  | IF NOT EXISTS `department_info` ( | ||||||
|  | 	`department_id` int not null auto_increment COMMENT '部门id', | ||||||
|  | 	`departmen` VARCHAR(16) not null DEFAULT '可用' COMMENT '部门', | ||||||
|  | 	`remark` VARCHAR(32) null COMMENT '备注', | ||||||
|  | 	`create_time` TIMESTAMP not null DEFAULT '0000-00-00 00:00:00' COMMENT '创建时间', | ||||||
|  | 	`update_time` TIMESTAMP null ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||||||
|  | 	PRIMARY KEY (`department_id`), | ||||||
|  | 	UNIQUE KEY `uqe_status` (`departmen`) | ||||||
|  |  | ||||||
|  | ) COMMENT '部门信息表'; | ||||||
|  |  | ||||||
|  | -- 9预订方式表 | ||||||
|  | CREATE TABLE | ||||||
|  | IF NOT EXISTS `order_type` ( | ||||||
|  | 	`type_id` int not null auto_increment COMMENT 'typeId', | ||||||
|  | 	`type` VARCHAR(16) not null COMMENT '方式', | ||||||
|  | 	`remark` VARCHAR(32) null COMMENT '备注', | ||||||
|  | 	`create_time` TIMESTAMP not null DEFAULT '0000-00-00 00:00:00' COMMENT '创建时间', | ||||||
|  | 	`update_time` TIMESTAMP null ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||||||
|  | 	PRIMARY KEY(`type_id`) | ||||||
|  | ) COMMENT '预订方式表'; | ||||||
|  |  | ||||||
|  |  | ||||||
		Reference in New Issue
	
	Block a user