文章目录
- 一、系统需求分析
- 二、系统设计
- 1. 功能结构设计
- 2、概念设计
- 2.2.1 bill_food表E-R图
- 2.2.2 bills表E-R图
- 2.2.3 categories E-R图
- 2.2.4 discounts表 E-R图
- 2.2.5 emp表E-R图
- 2.2.6 food 表E-R图
- 2.2.7 member表E-R图
- 2.2.8 member_point_bill表E-R图
- 2.2.9 servers表E-R图
- 2.2.10 tables表E-R图
- 2.2.11 user表E-R图
- 3. 逻辑设计(表的设计)
- ①bill_food表
- ②bills表
- ③categories表
- ④discounts表
- ⑤emp表
- ⑥food表
- ⑦member表
- ⑧member_point_bills表
- ⑨servers表
- ⑩tables表
- 11.user表
- 源码获取
一、系统需求分析
需求分析首先要确定研究分析的对象,这里的需求分析对象有两方:买家和卖家。
对于买家,需求是能够进行线上点餐,具体可以细化为:能够在线上获得餐品信息和进行点餐行为。买家作为消费者,都想得到更为优质的服务体验,希望能够通过较为简单顺利的操作就可以吃到满足自己口味的菜肴。这就要求系统界面能够生动形象地有效呈现出点餐的各项信息,菜品的价格,可以选择就坐的餐桌的数目等情况以及加餐时简洁的操作界面。
对于卖家,需求是能够对菜品进行增查删改以及增加会员,具体可以细化为,能够线上获得全部的菜品信息,添加菜品,修改菜品价格,删除菜品,增加会员。卖家即为商家,商家要能够高效地获取这些的信息,当然是图形化界面和几何形式的信息呈现最为直接明了。
二、系统设计
1. 功能结构设计
2、概念设计
2.2.1 bill_food表E-R图
2.2.2 bills表E-R图
2.2.3 categories E-R图
2.2.4 discounts表 E-R图
2.2.5 emp表E-R图
2.2.6 food 表E-R图
2.2.7 member表E-R图
2.2.8 member_point_bill表E-R图
2.2.9 servers表E-R图
2.2.10 tables表E-R图
2.2.11 user表E-R图
3. 逻辑设计(表的设计)
①bill_food表
CREATE TABLE `bill_food` (
`id_food` int NOT NULL,
`id_bill` int NOT NULL,
`num` int NOT NULL,
PRIMARY KEY (`id_food`,`id_bill`),
KEY `FK_bill_food2` (`id_bill`),
CONSTRAINT `FK_bill_food` FOREIGN KEY (`id_food`) REFERENCES `food` (`id_food`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `FK_bill_food2` FOREIGN KEY (`id_bill`) REFERENCES `bills` (`id_bill`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ;
②bills表
CREATE TABLE `bills` (
`id_bill` int NOT NULL,
`id_table` int NOT NULL,
`id_member` int DEFAULT NULL,
`time_order` datetime NOT NULL,
`time_pay` datetime DEFAULT NULL,
`money` int NOT NULL,
PRIMARY KEY (`id_bill`),
KEY `FK_bill_member` (`id_member`),
KEY `FK_table_bill` (`id_table`),
KEY `time_order` (`time_order`),
CONSTRAINT `FK_bill_member` FOREIGN KEY (`id_member`) REFERENCES `member` (`id_member`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `FK_table_bill` FOREIGN KEY (`id_table`) REFERENCES `tables` (`id_table`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ;
③categories表
CREATE TABLE `categories` (
`category` char(20) NOT NULL,
PRIMARY KEY (`category`)
);
④discounts表
CREATE TABLE `discounts` (
`id_discount` int NOT NULL,
`off_price` int NOT NULL,
`require_points` int NOT NULL,
PRIMARY KEY (`id_discount`)
) ;
⑤emp表
CREATE TABLE `emp` (
`id_emp` int NOT NULL,
`id_server` int DEFAULT NULL,
`name_emp` char(20) NOT NULL,
`sex_emp` char(1) DEFAULT NULL,
`phone_num` char(11) DEFAULT NULL,
`position` char(20) DEFAULT NULL,
PRIMARY KEY (`id_emp`)
);
⑥food表
CREATE TABLE `food` (
`id_food` int NOT NULL,
`category` char(20) NOT NULL,
`name_food` char(20) NOT NULL,
`introduction` char(100) DEFAULT NULL,
`price` int NOT NULL,
`url` char(100) DEFAULT NULL,
PRIMARY KEY (`id_food`),
KEY `FK_food_category` (`category`),
CONSTRAINT `FK_food_category` FOREIGN KEY (`category`) REFERENCES `categories` (`category`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ;
⑦member表
CREATE TABLE `member` (
`id_member` int NOT NULL,
`name_member` char(20) DEFAULT NULL,
`points` int NOT NULL,
`sex` char(1) DEFAULT NULL,
`phone_num` char(11) DEFAULT NULL,
PRIMARY KEY (`id_member`)
) ;
⑧member_point_bills表
CREATE TABLE `member_point_bill` (
`id_point_bill` int NOT NULL,
`id_member` int NOT NULL,
`time_point` datetime NOT NULL,
`point` int NOT NULL,
`note` char(20) DEFAULT NULL,
PRIMARY KEY (`id_point_bill`),
KEY `FK_member_point_bill` (`id_member`),
CONSTRAINT `FK_member_point_bill` FOREIGN KEY (`id_member`) REFERENCES `member` (`id_member`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ;
⑨servers表
CREATE TABLE `servers` (
`id_server` int NOT NULL,
`id_emp` int NOT NULL,
PRIMARY KEY (`id_server`),
KEY `FK_to_server` (`id_emp`),
CONSTRAINT `FK_to_server` FOREIGN KEY (`id_emp`) REFERENCES `emp` (`id_emp`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ;
⑩tables表
CREATE TABLE `tables` (
`id_table` int NOT NULL,
`id_server` int NOT NULL,
`num_people` int NOT NULL,
`id_bill` int DEFAULT NULL,
`id_member` int DEFAULT NULL,
PRIMARY KEY (`id_table`),
KEY `FK_server_table` (`id_server`),
CONSTRAINT `FK_server_table` FOREIGN KEY (`id_server`) REFERENCES `servers` (`id_server`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ;
11.user表
CREATE TABLE `user` (
`user_id` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`user_password` varchar(255) NOT NULL,
`user_name` varchar(255) DEFAULT NULL,
`user_position` varchar(255) DEFAULT NULL,
PRIMARY KEY (`user_id`)
);
源码获取
源码获取和python实现在下一篇文章中。
基于python+MySQL的餐厅点餐系统(python代码实现)