小型酒店管理系统采用Vue前端框架、SpringBoot框架实现项目前后端分离,并通过Mysql存储数据。本系统实现针对不同用户的登录验证;客户信息、前台管理员以及超级管理员等信息存取;客户信息登记、预约、入住、消费等功能;前台管理员对客户操作的管理;超级管理员对客户以及前台管理员操作进行控制等的功能,系统功能基本实现,测试良好。
本系统采用界面化设计,简单易用,各项数据都用表格形式显示出来,酒店营业情况一目了然。并且提供了大量的操作提示以及出错信息,大大的方便用户的使用,同时也减少了出错的可能,确保了数据的正确性、完整性和一致性。
本系统一共设计8个数据库表,数据库表设计如下,数据库文件见附件
避坑——数据库表在设计过程发现时间戳(timestamp)类型在数据库5.5版本和5.5以上版本的表示有所区别,建议小伙伴导入数据库过程自行查询它们在数据库表中的表示
------------------------------------
-- Table structure for background --
-- ---------------------------------
DROP TABLE IF EXISTS `background`;
CREATE TABLE `background` (
`back_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '后台管理的工号',
`password` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '后台登录密码',
PRIMARY KEY (`back_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
----------------------------------
-- Table structure for book_msg --
----------------------------------
DROP TABLE IF EXISTS `book_msg`;
CREATE TABLE `book_msg` (
`id` int(50) NOT NULL AUTO_INCREMENT COMMENT '预定信息id',
`guest_id_card` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户的身份证号',
`from_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '预计入住时间',
`to_time` timestamp(0) NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '预计退房时间',
`rank` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '预定的级别,分A,B,C,D级,级别一次降低',
`state` int(10) NOT NULL DEFAULT 0 COMMENT '预定处理状态,0代表未处理,1代表已处理,11代表已入住(失效)',
`result_room` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '预定到的房间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `type_id`(`rank`) USING BTREE,
INDEX `guest_id_card`(`guest_id_card`) USING BTREE,
INDEX `result_room`(`result_room`) USING BTREE,
CONSTRAINT `book_msg_ibfk_1` FOREIGN KEY (`guest_id_card`) REFERENCES `guest` (`id_card`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
----------------------------------
-- Table structure for check_in --
----------------------------------
DROP TABLE IF EXISTS `check_in`;
CREATE TABLE `check_in` (
`id` int(20) NOT NULL AUTO_INCREMENT COMMENT '入住情况的id',
`guest_id_card` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '客户的身份证号',
`room_id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '房间号',
`from_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '入住日期',
`to_time` timestamp(0) NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '预计退房时间',
`state` int(10) NOT NULL COMMENT '状态,0代表已退房,1代表正在入住',
PRIMARY KEY (`id`) USING BTREE,
INDEX `guest_id_card`(`guest_id_card`) USING BTREE,
INDEX `room_id`(`room_id`) USING BTREE,
CONSTRAINT `check_in_ibfk_1` FOREIGN KEY (`guest_id_card`) REFERENCES `guest` (`id_card`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `check_in_ibfk_2` FOREIGN KEY (`room_id`) REFERENCES `room` (`room_id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
------------------------------
-- Table structure for cost --
------------------------------
DROP TABLE IF EXISTS `cost`;
CREATE TABLE `cost` (
`id` int(20) NOT NULL AUTO_INCREMENT COMMENT '消费信息的id',
`cost_type_id` int(20) NOT NULL COMMENT '消费的名称',
`room_id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '房间的id',
`num` int(10) NOT NULL DEFAULT 1 COMMENT '数量',
`state` int(20) NOT NULL DEFAULT 0 COMMENT '状态,0表示未结算,1表示已结算,11表示该次入住的用户全部结算',
PRIMARY KEY (`id`) USING BTREE,
INDEX `cost_type_id`(`cost_type_id`) USING BTREE,
INDEX `room_id`(`room_id`) USING BTREE,
CONSTRAINT `cost_ibfk_2` FOREIGN KEY (`cost_type_id`) REFERENCES `cost_type` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `cost_ibfk_3` FOREIGN KEY (`room_id`) REFERENCES `room` (`room_id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 72 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-----------------------------------
-- Table structure for cost_type --
-----------------------------------
DROP TABLE IF EXISTS `cost_type`;
CREATE TABLE `cost_type` (
`id` int(50) NOT NULL AUTO_INCREMENT COMMENT '消费类型的id',
`name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '消费项目的名称',
`money` float NOT NULL COMMENT '金额',
PRIMARY KEY (`id`, `name`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 39 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-------------------------------
-- Table structure for front --
-------------------------------
DROP TABLE IF EXISTS `front`;
CREATE TABLE `front` (
`front_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '前台管理员的工号',
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '前台管理员的姓名',
`password` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '前台管理的登录密码',
`phone` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '前台管理员的电话',
PRIMARY KEY (`front_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-------------------------------
-- Table structure for guest --
-------------------------------
DROP TABLE IF EXISTS `guest`;
CREATE TABLE `guest` (
`id_card` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '客户的身份证号',
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '客户的姓名',
`contact` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '客户的联系方式',
PRIMARY KEY (`id_card`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
------------------------------
-- Table structure for room --
------------------------------
DROP TABLE IF EXISTS `room`;
CREATE TABLE `room` (
`room_id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '房间编号',
`size` double NOT NULL COMMENT '房间大小,以平方米为单位',
`rank` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '级别,分A,B,C,D级,级别一次降低',
`rent` double NOT NULL COMMENT '租金,单位是人民币元',
`earnest` double NOT NULL COMMENT '入住定金,单位是人民币元',
`max_num` int(5) NOT NULL COMMENT '最大人数',
`position` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地理位置',
PRIMARY KEY (`room_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
submitForm () {
// console.log(this.param.username);
let state = this.param.username;
if (state === 'admin') {
this.$http.post('http://localhost:8081/backgroundLogin?backId=' + this.param.username + '&password=' + this.param.password).then(res => {
console.log(res);
if (res.data.code === 200) {
console.log(res.data.data);
this.$message.success('登录成功');
// 将用户token保存到vuex中
localStorage.setItem('token', res.data.data);
localStorage.setItem('ms_username', this.param.username);
this.$router.push('/');
} else {
this.$message.error('请输入正确的账号和密码');
console.log('error submit!!');
return false;
}
});
} else {
this.$http.post('http://localhost:8081/frontLogin?frontId=' + this.param.username + '&password=' + this.param.password).then(res => {
// console.log(res);
if (res.data.code === 200) {
console.log(res.data.data);
this.$message.success('登录成功');
// 将用户token保存到vuex中
localStorage.setItem('token', res.data.data);
localStorage.setItem('ms_username', this.param.username);
this.$router.push('/');
} else {
this.$message.error('请输入正确的账号和密码');
console.log('error submit!!');
return false;
}
});
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。