web前端部分
主要功能
用户登录注册,查看商品,提交订单,然后留言,查看购物车,购买商品等等。管理员添加商品,管理用户,添加类目,管理留言等等。前端技术
HTML+CSS+JavaScript运行界面
核心代码
代码部分由GitHub托管: https://github.com/Bazingaali/elmweb数据库设计
建表语句
``` SET FOREIGN_KEY_CHECKS=0;-- Table structure for address
DROP TABLE IF EXISTS address;
CREATE TABLE address (address_id int(11) NOT NULL,customer_id int(11) NOT NULL,province varchar(50) DEFAULT \'\',town varchar(50) DEFAULT \'\',block varchar(50) DEFAULT \'\',specific_address varchar(50) DEFAULT \'\',contact_name varchar(50) DEFAULT \'\',contact_tel varchar(15) DEFAULT \'\',
PRIMARY KEY (address_id,customer_id),
KEY FK_客户与地址表 (customer_id),
CONSTRAINT FK_客户与地址表 FOREIGN KEY (customer_id) REFERENCES customer_msg (customer_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of address
INSERT INTO address VALUES (\'1\', \'1\', \'浙江省\', \'杭州市\', \'拱墅区\', \'湖州街51号\', \'兰淑敏\', \'19858112232\');
INSERT INTO address VALUES (\'1\', \'2\', \'222\', \'杭州市\', \'拱墅区\', \'湖州街51号\', \'兰淑敏\', \'19858112232\');
INSERT INTO address VALUES (\'2\', \'1\', \'浙江省\', \'丽水市\', \'庆元县\', \'濛洲街道\', \'兰淑敏\', \'19858112232\');
INSERT INTO address VALUES (\'3\', \'1\', \'浙江省\', \'杭州市\', \'拱墅区\', \'湖州街51号\', \'兰淑敏\', \'19858112232\');
INSERT INTO address VALUES (\'4\', \'1\', \'浙江省\', \'杭州市\', \'拱墅区\', \'湖州街51号\', \'兰淑敏\', \'19858112232\');
INSERT INTO address VALUES (\'5\', \'1\', \'浙江省\', \'丽水市\', \'莲都区\', \'花园路\', \'兰淑敏\', \'19858112232\');
-- Table structure for cart
DROP TABLE IF EXISTS cart;
CREATE TABLE cart (shop_id int(11) NOT NULL,class_id int(11) NOT NULL,goods_id int(11) NOT NULL,customer_id int(11) NOT NULL,goods_count int(11) DEFAULT \'0\',
PRIMARY KEY (shop_id,goods_id,customer_id,class_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of cart
-- Table structure for customer_getticket_process
DROP TABLE IF EXISTS customer_getticket_process;
CREATE TABLE customer_getticket_process (customer_id int(11) NOT NULL,shop_id int(11) NOT NULL,ticket_id int(11) NOT NULL,get_ticket_require int(11) DEFAULT NULL,get_ticket_already int(11) DEFAULT NULL,
PRIMARY KEY (customer_id,shop_id,ticket_id),
KEY FK_优惠券与集单过程 (ticket_id),
KEY FK_商店与集单过程 (shop_id),
CONSTRAINT FK_优惠券与集单过程 FOREIGN KEY (ticket_id) REFERENCES ticket (ticket_id),
CONSTRAINT FK_商店与集单过程 FOREIGN KEY (shop_id) REFERENCES shop_msg (shop_id),
CONSTRAINT FK_客户与集单过程 FOREIGN KEY (customer_id) REFERENCES customer_msg (customer_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of customer_getticket_process
INSERT INTO customer_getticket_process VALUES (\'1\', \'3\', \'1\', \'5\', \'2\');
-- Table structure for customer_msg
DROP TABLE IF EXISTS customer_msg;
CREATE TABLE customer_msg (customer_id int(11) NOT NULL,customer_name varchar(50) DEFAULT NULL,customer_sex varchar(1) DEFAULT NULL,customer_pwd varchar(50) DEFAULT NULL,customer_tel varchar(15) DEFAULT NULL,customer_mail varchar(50) DEFAULT NULL,customer_city varchar(50) DEFAULT NULL,customer_register_date datetime DEFAULT NULL,vip varchar(10) DEFAULT \'不是\',vip_deadline varchar(10) DEFAULT \'不是\',
PRIMARY KEY (customer_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of customer_msg
INSERT INTO customer_msg VALUES (\'1\', \'lsm\', \'女\', \'1\', \'198\', \'杭州\', \'31801158@stu.zucc.edu.cn\', \'2020-07-07 23:16:47\', \'是\', \'2020-08-05\');
INSERT INTO customer_msg VALUES (\'2\', \'wyb\', \'男\', \'1\', \'199\', \'111@qq.com\', \'luoyang\', \'2020-07-08 23:54:44\', \'是\', \'2020-08-05\');
INSERT INTO customer_msg VALUES (\'4\', \'c2\', \'女\', \'2\', \'\', \'\', \'\', \'2020-07-12 19:58:49\', \'是\', \'\');
INSERT INTO customer_msg VALUES (\'5\', \'c3\', null, \'1\', null, null, null, \'2020-07-12 20:00:47\', \'不是\', \'不是\');
INSERT INTO customer_msg VALUES (\'6\', \'c4\', \'\', \'4\', \'\', \'\', \'\', \'2020-07-12 20:02:31\', \'不是\', \'\');
INSERT INTO customer_msg VALUES (\'7\', \'c5\', null, \'1\', null, null, null, \'2020-07-12 20:38:50\', \'不是\', \'不是\');
-- Table structure for full_redution
DROP TABLE IF EXISTS full_redution;
CREATE TABLE full_redution (full_redution_id int(11) NOT NULL,full_money int(11) DEFAULT NULL,redution_money int(11) DEFAULT NULL,use_with_ticket tinyint(1) DEFAULT NULL,
PRIMARY KEY (full_redution_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of full_redution
INSERT INTO full_redution VALUES (\'1\', \'85\', \'30\', \'1\');
INSERT INTO full_redution VALUES (\'2\', \'35\', \'15\', \'1\');
INSERT INTO full_redution VALUES (\'3\', \'20\', \'10\', \'1\');
INSERT INTO full_redution VALUES (\'4\', \'50\', \'10\', \'10\');
INSERT INTO full_redution VALUES (\'5\', \'60\', \'6\', \'6\');
INSERT INTO full_redution VALUES (\'6\', \'2\', \'1\', \'1\');
INSERT INTO full_redution VALUES (\'7\', \'3\', \'2\', \'2\');
-- Table structure for goods_comment
DROP TABLE IF EXISTS goods_comment;
CREATE TABLE goods_comment (goods_id int(11) NOT NULL,shop_id int(11) NOT NULL,customer_id int(11) NOT NULL,comment_content varchar(20) DEFAULT \'默认好评\',comment_date datetime NOT NULL,star float DEFAULT NULL,comment_photo longblob,
PRIMARY KEY (goods_id,shop_id,customer_id,comment_date)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of goods_comment
INSERT INTO goods_comment VALUES (\'1\', \'1\', \'1\', \'good\', \'2020-07-15 00:08:28\', \'5\', null);
INSERT INTO goods_comment VALUES (\'2\', \'2\', \'1\', \'1\', \'2020-07-14 18:18:45\', \'5\', null);
INSERT INTO goods_comment VALUES (\'4\', \'2\', \'1\', \'hao\', \'2020-07-15 00:35:37\', \'5\', null);
-- Table structure for goods_msg
DROP TABLE IF EXISTS goods_msg;
CREATE TABLE goods_msg (goods_id int(11) NOT NULL,goods_class_id int(11) DEFAULT NULL,good_name varchar(50) DEFAULT NULL,price float(5,2) DEFAULT NULL,d_price float(5,2) DEFAULT NULL,
PRIMARY KEY (goods_id),
KEY FK_商品类别与商品 (goods_class_id),
CONSTRAINT FK_商品类别与商品 FOREIGN KEY (goods_class_id) REFERENCES good_class (goods_class_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of goods_msg
INSERT INTO goods_msg VALUES (\'1\', \'1\', \'goods1\', \'10.00\', \'8.50\');
INSERT INTO goods_msg VALUES (\'2\', \'1\', \'goods2\', \'20.00\', \'10.00\');
INSERT INTO goods_msg VALUES (\'3\', \'2\', \'goods3\', \'10.00\', \'8.50\');
INSERT INTO goods_msg VALUES (\'4\', \'2\', \'goods4\', \'100.00\', \'85.00\');
INSERT INTO goods_msg VALUES (\'5\', \'1\', \'goods5\', \'10.00\', \'8.50\');
INSERT INTO goods_msg VALUES (\'7\', \'1\', \'goods7\', \'10.00\', \'8.50\');
INSERT INTO goods_msg VALUES (\'8\', \'1\', \'goods8\', \'10.00\', \'8.50\');
INSERT INTO goods_msg VALUES (\'9\', \'2\', \'goods9\', \'4.00\', \'3.00\');
-- Table structure for goods_order
DROP TABLE IF EXISTS goods_order;
CREATE TABLE goods_order (order_id int(11) NOT NULL,shop_id int(11) DEFAULT NULL,customer_id int(11) DEFAULT NULL,rider_id int(11) DEFAULT NULL,original_price float(5,2) DEFAULT NULL,final_price float(5,2) DEFAULT NULL,full_redution_id int(11) DEFAULT NULL,ticket_id int(11) DEFAULT NULL,order_time datetime DEFAULT NULL,require_arrive_time datetime DEFAULT NULL,address_id varchar(50) DEFAULT NULL,order_condition varchar(20) DEFAULT \'正在配送\',ifcomment varchar(20) DEFAULT \'待评价\',
PRIMARY KEY (order_id),
KEY FK_商店与订单 (shop_id),
KEY FK_订单与优惠券 (ticket_id),
KEY FK_订单与满减 (full_redution_id),
CONSTRAINT FK_商店与订单 FOREIGN KEY (shop_id) REFERENCES shop_msg (shop_id),
CONSTRAINT FK_订单与优惠券 FOREIGN KEY (ticket_id) REFERENCES ticket (ticket_id),
CONSTRAINT FK_订单与满减 FOREIGN KEY (full_redution_id) REFERENCES full_redution (full_redution_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of goods_order
INSERT INTO goods_order VALUES (\'1\', \'1\', \'1\', \'1\', \'100.00\', \'85.00\', \'1\', \'1\', \'2020-07-01 08:29:05\', \'2020-07-09 09:29:10\', \'1\', \'已送达\', \'已评价\');
INSERT INTO goods_order VALUES (\'2\', \'1\', \'1\', \'1\', \'100.00\', \'85.00\', \'1\', \'1\', \'2020-07-01 08:29:05\', \'2020-07-09 09:29:10\', \'1\', \'已送达\', \'已评价\');
INSERT INTO goods_order VALUES (\'3\', \'1\', \'2\', \'1\', \'100.00\', \'85.00\', \'1\', \'1\', \'2020-07-01 08:29:05\', \'2020-07-23 09:29:10\', \'1\', \'正在配送\', \'待评价\');
INSERT INTO goods_order VALUES (\'4\', \'1\', \'2\', \'1\', \'100.00\', \'85.00\', \'1\', null, \'2020-07-01 08:29:05\', \'2020-07-23 09:29:10\', \'1\', \'正在配送\', \'待评价\');
INSERT INTO goods_order VALUES (\'5\', \'1\', \'1\', \'1\', \'40.00\', \'12.00\', \'2\', null, \'2020-07-13 17:30:31\', \'2020-07-23 11:11:11\', \'1\', \'已送达\', \'已评价\');
INSERT INTO goods_order VALUES (\'6\', \'1\', \'1\', \'1\', \'40.00\', \'12.00\', \'2\', null, \'2020-07-13 19:35:30\', \'2020-07-23 11:11:11\', \'1\', \'正在配送\', \'待评价\');
INSERT INTO goods_order VALUES (\'8\', \'1\', \'1\', \'1\', \'40.00\', \'12.00\', \'2\', null, \'2020-07-13 22:43:05\', \'2020-07-25 11:11:11\', \'1\', \'已送达\', \'已评价\');
INSERT INTO goods_order VALUES (\'10\', \'1\', \'1\', \'1\', \'30.00\', \'17.50\', null, \'1\', \'2020-07-14 01:09:58\', \'2020-07-25 11:11:11\', \'1\', \'已送达\', \'已评价\');
INSERT INTO goods_order VALUES (\'13\', \'2\', \'1\', \'1\', \'100.00\', \'70.00\', \'2\', null, \'2020-07-14 02:08:06\', \'2020-08-08 11:11:11\', \'2\', \'已送达\', \'已评价\');
INSERT INTO goods_order VALUES (\'14\', \'1\', \'1\', \'1\', \'30.00\', \'17.50\', null, \'1\', \'2020-07-14 02:09:07\', \'2020-08-08 11:11:11\', \'1\', \'正在配送\', \'待评价\');
INSERT INTO goods_order VALUES (\'15\', \'1\', \'1\', \'1\', \'30.00\', \'17.50\', null, \'1\', \'2020-07-14 10:54:47\', \'2020-07-21 11:11:11\', \'1\', \'正在配送\', \'待评价\');
INSERT INTO goods_order VALUES (\'17\', \'1\', \'1\', \'1\', \'110.00\', \'62.50\', \'1\', \'1\', \'2020-07-14 11:00:47\', \'2020-08-08 11:11:11\', \'1\', \'正在配送\', \'待评价\');
INSERT INTO goods_order VALUES (\'20\', \'1\', \'1\', \'2\', \'40.00\', \'12.00\', \'2\', null, \'2020-07-14 12:49:02\', \'2020-07-22 11:11:11\', \'1\', \'正在配送\', \'待评价\');
INSERT INTO goods_order VALUES (\'21\', \'1\', \'1\', \'1\', \'40.00\', \'12.00\', \'2\', null, \'2020-07-14 14:03:11\', \'2020-11-11 11:11:11\', \'1\', \'正在配送\', \'待评价\');
INSERT INTO goods_order VALUES (\'22\', \'1\', \'1\', \'2\', \'60.00\', \'22.00\', \'2\', null, \'2020-07-14 15:06:59\', \'2020-07-22 11:11:11\', \'1\', \'正在配送\', \'待评价\');
INSERT INTO goods_order VALUES (\'23\', \'1\', \'1\', \'1\', \'40.00\', \'12.00\', \'2\', null, \'2020-07-14 15:45:39\', \'2020-07-22 11:11:11\', \'1\', \'已送达\', \'已评价\');
INSERT INTO goods_order VALUES (\'24\', \'1\', \'1\', \'1\', \'50.00\', \'12.50\', \'2\', \'1\', \'2020-07-14 22:51:27\', \'2020-07-22 11:11:11\', \'1\', \'正在配送\', \'待评价\');
INSERT INTO goods_order VALUES (\'25\', \'2\', \'1\', \'3\', \'10.00\', \'7.50\', null, \'2\', \'2020-07-15 00:02:10\', \'2020-07-22 11:11:11\', \'1\', \'正在配送\', \'待评价\');
-- Table structure for good_class
DROP TABLE IF EXISTS good_class;
CREATE TABLE good_class (goods_class_id int(11) NOT NULL,goods_class_name varchar(50) DEFAULT NULL,oneclass_good_count int(11) DEFAULT NULL,
PRIMARY KEY (goods_class_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of good_class
INSERT INTO good_class VALUES (\'1\', \'class1\', \'1\');
INSERT INTO good_class VALUES (\'2\', \'class2\', \'2\');
-- Table structure for have_ticket
DROP TABLE IF EXISTS have_ticket;
CREATE TABLE have_ticket (customer_id int(11) NOT NULL,shop_id int(11) NOT NULL,ticket_id int(11) NOT NULL,ticket_count int(11) DEFAULT NULL,ticket_money float DEFAULT NULL,ticket_deadline datetime DEFAULT NULL,
PRIMARY KEY (customer_id,shop_id,ticket_id),
KEY shop_id (shop_id,ticket_id),
CONSTRAINT FK_拥有 FOREIGN KEY (shop_id) REFERENCES shop_msg (shop_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of have_ticket
INSERT INTO have_ticket VALUES (\'1\', \'1\', \'1\', \'1\', \'5\', \'2020-08-05 01:03:32\');
INSERT INTO have_ticket VALUES (\'1\', \'2\', \'1\', \'1\', \'5\', \'2020-08-05 01:03:32\');
INSERT INTO have_ticket VALUES (\'2\', \'2\', \'1\', \'1\', \'5\', \'2020-08-05 01:03:32\');
-- Table structure for manager_msg
DROP TABLE IF EXISTS manager_msg;
CREATE TABLE manager_msg (m_id int(11) NOT NULL,m_name varchar(50) DEFAULT NULL,m_pwd varchar(50) DEFAULT NULL,
PRIMARY KEY (m_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of manager_msg
INSERT INTO manager_msg VALUES (\'1\', \'manager1\', \'1\');
INSERT INTO manager_msg VALUES (\'2\', \'manager2\', \'2\');
-- Table structure for order_detil
DROP TABLE IF EXISTS order_detil;
CREATE TABLE order_detil (order_id int(11) NOT NULL,goods_id int(11) NOT NULL,order_onegoods_count int(11) DEFAULT NULL,price decimal(5,2) DEFAULT NULL,d_price decimal(5,2) DEFAULT NULL,
PRIMARY KEY (order_id,goods_id),
KEY FK_订单详情与商品详情 (goods_id),
CONSTRAINT FK_订单与订单详情 FOREIGN KEY (order_id) REFERENCES goods_order (order_id),
CONSTRAINT FK_订单详情与商品详情 FOREIGN KEY (goods_id) REFERENCES goods_msg (goods_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of order_detil
INSERT INTO order_detil VALUES (\'1\', \'1\', \'2\', \'20.00\', \'17.00\');
INSERT INTO order_detil VALUES (\'2\', \'1\', \'2\', \'15.00\', \'13.00\');
INSERT INTO order_detil VALUES (\'5\', \'1\', \'4\', \'10.00\', \'10.00\');
INSERT INTO order_detil VALUES (\'5\', \'2\', \'1\', \'20.00\', \'20.00\');
INSERT INTO order_detil VALUES (\'5\', \'3\', \'3\', \'10.00\', \'10.00\');
INSERT INTO order_detil VALUES (\'6\', \'1\', \'4\', \'10.00\', \'10.00\');
INSERT INTO order_detil VALUES (\'6\', \'2\', \'1\', \'20.00\', \'20.00\');
INSERT INTO order_detil VALUES (\'6\', \'3\', \'3\', \'10.00\', \'10.00\');
INSERT INTO order_detil VALUES (\'8\', \'1\', \'1\', \'10.00\', \'10.00\');
INSERT INTO order_detil VALUES (\'8\', \'2\', \'1\', \'20.00\', \'20.00\');
INSERT INTO order_detil VALUES (\'8\', \'3\', \'1\', \'10.00\', \'10.00\');
INSERT INTO order_detil VALUES (\'13\', \'4\', \'1\', \'100.00\', \'100.00\');
INSERT INTO order_detil VALUES (\'14\', \'2\', \'1\', \'20.00\', \'20.00\');
INSERT INTO order_detil VALUES (\'14\', \'3\', \'1\', \'10.00\', \'10.00\');
INSERT INTO order_detil VALUES (\'15\', \'1\', \'1\', \'10.00\', \'10.00\');
INSERT INTO order_detil VALUES (\'15\', \'2\', \'1\', \'20.00\', \'20.00\');
INSERT INTO order_detil VALUES (\'17\', \'1\', \'1\', \'10.00\', \'10.00\');
INSERT INTO order_detil VALUES (\'17\', \'4\', \'1\', \'100.00\', \'100.00\');
INSERT INTO order_detil VALUES (\'21\', \'1\', \'2\', \'10.00\', \'10.00\');
INSERT INTO order_detil VALUES (\'21\', \'2\', \'1\', \'20.00\', \'20.00\');
INSERT INTO order_detil VALUES (\'22\', \'1\', \'2\', \'10.00\', \'10.00\');
INSERT INTO order_detil VALUES (\'22\', \'2\', \'2\', \'20.00\', \'20.00\');
INSERT INTO order_detil VALUES (\'23\', \'1\', \'1\', \'10.00\', \'10.00\');
INSERT INTO order_detil VALUES (\'23\', \'2\', \'1\', \'20.00\', \'20.00\');
INSERT INTO order_detil VALUES (\'23\', \'3\', \'1\', \'10.00\', \'10.00\');
INSERT INTO order_detil VALUES (\'24\', \'1\', \'1\', \'10.00\', \'8.50\');
INSERT INTO order_detil VALUES (\'24\', \'2\', \'2\', \'20.00\', \'10.00\');
INSERT INTO order_detil VALUES (\'25\', \'1\', \'1\', \'10.00\', \'8.50\');
-- Table structure for relation_customer_and_haveticket
DROP TABLE IF EXISTS relation_customer_and_haveticket;
CREATE TABLE relation_customer_and_haveticket (customer_id int(11) NOT NULL,shop_id int(11) NOT NULL,ticket_id int(11) NOT NULL,
PRIMARY KEY (customer_id,shop_id),
KEY FK_拥有 (shop_id,ticket_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of relation_customer_and_haveticket
-- Table structure for relation_haveticket_and_ticket
DROP TABLE IF EXISTS relation_haveticket_and_ticket;
CREATE TABLE relation_haveticket_and_ticket (customer_id int(11) NOT NULL,shop_id int(11) NOT NULL,ticket_id int(11) NOT NULL,
PRIMARY KEY (customer_id,shop_id,ticket_id),
KEY FK_客户拥有优惠券与优惠券2 (ticket_id),
CONSTRAINT FK_客户拥有优惠券与优惠券 FOREIGN KEY (customer_id, shop_id, ticket_id) REFERENCES have_ticket (customer_id, shop_id, ticket_id),
CONSTRAINT FK_客户拥有优惠券与优惠券2 FOREIGN KEY (ticket_id) REFERENCES ticket (ticket_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of relation_haveticket_and_ticket
-- Table structure for relation_shopandgoods
DROP TABLE IF EXISTS relation_shopandgoods;
CREATE TABLE relation_shopandgoods (goods_id int(11) NOT NULL,shop_id int(11) NOT NULL,stock int(11) DEFAULT \'0\',sales int(11) DEFAULT \'0\',
PRIMARY KEY (goods_id,shop_id),
KEY FK_shopandgoods2 (shop_id),
CONSTRAINT FK_shopandgoods FOREIGN KEY (goods_id) REFERENCES goods_msg (goods_id),
CONSTRAINT FK_shopandgoods2 FOREIGN KEY (shop_id) REFERENCES shop_msg (shop_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of relation_shopandgoods
INSERT INTO relation_shopandgoods VALUES (\'1\', \'1\', \'93\', \'10\');
INSERT INTO relation_shopandgoods VALUES (\'1\', \'2\', \'99\', \'5\');
INSERT INTO relation_shopandgoods VALUES (\'2\', \'1\', \'3\', \'5\');
INSERT INTO relation_shopandgoods VALUES (\'2\', \'2\', \'100\', \'5\');
INSERT INTO relation_shopandgoods VALUES (\'3\', \'1\', \'99\', \'5\');
INSERT INTO relation_shopandgoods VALUES (\'4\', \'1\', \'84\', \'5\');
INSERT INTO relation_shopandgoods VALUES (\'5\', \'1\', \'100\', \'100\');
INSERT INTO relation_shopandgoods VALUES (\'7\', \'1\', \'100\', \'0\');
INSERT INTO relation_shopandgoods VALUES (\'8\', \'1\', \'111\', \'0\');
-- Table structure for relation_shopandticket
DROP TABLE IF EXISTS relation_shopandticket;
CREATE TABLE relation_shopandticket (ticket_id int(11) NOT NULL,shop_id int(11) NOT NULL,
PRIMARY KEY (ticket_id,shop_id),
KEY FK_商店与优惠券2 (shop_id),
CONSTRAINT FK_商店与优惠券 FOREIGN KEY (ticket_id) REFERENCES ticket (ticket_id),
CONSTRAINT FK_商店与优惠券2 FOREIGN KEY (shop_id) REFERENCES shop_msg (shop_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of relation_shopandticket
INSERT INTO relation_shopandticket VALUES (\'1\', \'1\');
INSERT INTO relation_shopandticket VALUES (\'4\', \'2\');
INSERT INTO relation_shopandticket VALUES (\'1\', \'3\');
-- Table structure for relation_shop_and_fullredution
DROP TABLE IF EXISTS relation_shop_and_fullredution;
CREATE TABLE relation_shop_and_fullredution (full_redution_id int(11) NOT NULL,shop_id int(11) NOT NULL,
PRIMARY KEY (full_redution_id,shop_id),
KEY FK_商店与满减2 (shop_id),
CONSTRAINT FK_商店与满减 FOREIGN KEY (full_redution_id) REFERENCES full_redution (full_redution_id),
CONSTRAINT FK_商店与满减2 FOREIGN KEY (shop_id) REFERENCES shop_msg (shop_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of relation_shop_and_fullredution
INSERT INTO relation_shop_and_fullredution VALUES (\'1\', \'1\');
INSERT INTO relation_shop_and_fullredution VALUES (\'2\', \'1\');
INSERT INTO relation_shop_and_fullredution VALUES (\'1\', \'2\');
INSERT INTO relation_shop_and_fullredution VALUES (\'2\', \'2\');
-- Table structure for relation_shop_and_haveticket
DROP TABLE IF EXISTS relation_shop_and_haveticket;
CREATE TABLE relation_shop_and_haveticket (customer_id int(11) NOT NULL,shop_id int(11) NOT NULL,ticket_id int(11) NOT NULL,sho_shop_id int(11) NOT NULL,
PRIMARY KEY (customer_id,shop_id,ticket_id,sho_shop_id),
KEY FK_商店与客户拥有的优惠券2 (sho_shop_id),
CONSTRAINT FK_商店与客户拥有的优惠券 FOREIGN KEY (customer_id, shop_id, ticket_id) REFERENCES have_ticket (customer_id, shop_id, ticket_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of relation_shop_and_haveticket
-- Table structure for rider_msg
DROP TABLE IF EXISTS rider_msg;
CREATE TABLE rider_msg (rider_id int(11) NOT NULL,rider_name varchar(50) DEFAULT NULL,entry_date date DEFAULT NULL,rider_rank varchar(20) DEFAULT NULL,rider_all_money float(11,1) DEFAULT \'0.0\',rider_order_count int(11) DEFAULT \'0\',
PRIMARY KEY (rider_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of rider_msg
INSERT INTO rider_msg VALUES (\'1\', \'rider11\', \'2020-03-08\', \'正式员工\', \'83.0\', \'50\');
INSERT INTO rider_msg VALUES (\'2\', \'rider2\', \'2020-06-06\', \'新人\', \'45.0\', \'18\');
INSERT INTO rider_msg VALUES (\'3\', \'rider3\', \'2020-01-01\', \'正式员工\', \'2.0\', \'0\');
INSERT INTO rider_msg VALUES (\'4\', \'rider4\', \'2020-07-14\', \'新人\', \'0.0\', \'0\');
-- Table structure for rider_work
DROP TABLE IF EXISTS rider_work;
CREATE TABLE rider_work (rider_id int(11) NOT NULL,order_id int(11) NOT NULL,get_order_date datetime DEFAULT NULL,riders_comment varchar(20) DEFAULT NULL,single_income decimal(5,2) DEFAULT NULL,
PRIMARY KEY (order_id,rider_id),
KEY FK_骑手与入帐表 (rider_id),
CONSTRAINT FK_订单与骑手入账表 FOREIGN KEY (order_id) REFERENCES goods_order (order_id),
CONSTRAINT FK_骑手与入帐表 FOREIGN KEY (rider_id) REFERENCES rider_msg (rider_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of rider_work
INSERT INTO rider_work VALUES (\'1\', \'1\', \'2020-07-15 00:24:07\', \'好评\', \'3.00\');
INSERT INTO rider_work VALUES (\'1\', \'13\', \'2020-07-14 02:08:06\', \'好评\', \'3.00\');
-- Table structure for shop_msg
DROP TABLE IF EXISTS shop_msg;
CREATE TABLE shop_msg (shop_id int(11) NOT NULL,shop_name varchar(50) DEFAULT NULL,shop_star decimal(2,1) DEFAULT NULL,consume_aver int(11) DEFAULT NULL,sales_volume int(11) DEFAULT NULL,all_comment_count int(11) DEFAULT NULL,
PRIMARY KEY (shop_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of shop_msg
INSERT INTO shop_msg VALUES (\'1\', \'shop1\', \'4.6\', \'10\', \'10\', \'62\');
INSERT INTO shop_msg VALUES (\'2\', \'shop2\', \'4.0\', \'10\', \'100\', \'57\');
INSERT INTO shop_msg VALUES (\'3\', \'shop2\', \'4.0\', \'10\', \'11\', \'54\');
INSERT INTO shop_msg VALUES (\'4\', \'shop4\', \'4.0\', \'10\', \'11\', \'54\');
INSERT INTO shop_msg VALUES (\'5\', \'shop5\', \'4.0\', \'10\', \'12\', \'54\');
INSERT INTO shop_msg VALUES (\'6\', \'shop6\', \'4.0\', \'10\', \'13\', \'54\');
INSERT INTO shop_msg VALUES (\'7\', \'shop7\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'8\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'9\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'10\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'11\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'12\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'13\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'14\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'15\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'16\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'17\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'18\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'19\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'20\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'21\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'22\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'23\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'24\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'25\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'26\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'27\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'28\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'30\', \'shop2\', \'4.0\', \'10\', \'10\', \'54\');
INSERT INTO shop_msg VALUES (\'31\', \'shop31\', \'3.0\', \'0\', \'0\', \'0\');
INSERT INTO shop_msg VALUES (\'32\', \'shop3\', \'3.0\', \'0\', \'0\', \'0\');
-- Table structure for ticket
DROP TABLE IF EXISTS ticket;
CREATE TABLE ticket (ticket_id int(11) NOT NULL,ticket_money float DEFAULT NULL,get_ticket_require int(11) DEFAULT NULL,ticket_start_date datetime DEFAULT NULL,ticket_end_date datetime DEFAULT NULL,
PRIMARY KEY (ticket_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Records of ticket
INSERT INTO ticket VALUES (\'1\', \'3\', \'5\', \'2020-07-01 01:19:37\', \'2020-08-05 01:03:32\');
INSERT INTO ticket VALUES (\'2\', \'5\', \'8\', \'2020-07-11 01:05:36\', \'2020-07-31 01:05:38\');
INSERT INTO ticket VALUES (\'4\', \'3\', \'3\', \'2020-01-01 11:11:11\', \'2020-01-01 11:11:11\');
INSERT INTO ticket VALUES (\'5\', \'4\', \'4\', \'2020-07-01 10:52:38\', \'2020-07-31 10:52:43\');
INSERT INTO ticket VALUES (\'6\', \'5\', \'6\', \'2020-07-07 11:11:11\', \'2020-07-31 11:11:11\');
<h2>ER图</h2>

