SpringBoot 打造外卖项目(一):数据库设计

分为四张表

- 商品表 - 类目表 - 订单表 - 订单详情表

-- 商品表
create table `product_info`(
	`product_id` varchar(32) not null,
	`product_name` varchar(64) not null comment '商品名称', 
	`product_price` decimal(8,2) not null comment '商品金额',
	`product_stock` int not null comment '商品库存',
	`product_description` varchar(64) comment '商品描述',
	`product_icon` varchar(512) comment '商品小图',
	`category_type` int not null comment '类目编号',
	`create_time` timestamp not null default current_timestamp comment '创建时间', -- 在创建该条时自动插入当前时间在这个字段
	`update_time` timestamp not null default current_timestamp on update 
		current_timestamp comment '修改时间', -- 在修改该条目时自动插入当前时间在这个字段
	primary key (`product_id`) -- 设置 product_id 为该表主键
) comment '商品表';

-- 类目表
create table `product_category`(
	`category_id` int not null auto_increment, -- 自增
	`category_name` varchar(64) not null comment '类目名字',
	`category_type` int not null comment '类目标号',
	`create_time` timestamp not null default current_timestamp comment '创建时间', -- 在创建该条时自动插入当前时间在这个字段
	`update_time` timestamp not null default current_timestamp on update 
		current_timestamp comment '修改时间', -- 在修改该条目时自动插入当前时间在这个字段
	primary key (`category_id`), -- 设置 product_id 为该表主键
	unique key `uqe_category_type` (`category_type`) -- 唯一设置
) comment '类目表';


--订单表
create table `order_master`(
	`order_id` varchar(32) not null,
	`buyer_name` varchar(32) not null comment '买家名字',
	`buyer_phone` varchar(32) not null comment '买家电话',
	`buyer_address` varchar(128) not null comment '买家地址',
	`buyer_openid` varchar(64) not null comment '买家微信openid',
	`order_amount` decimal(8,2) not null comment '订单总金额',
	`order_status` tinyint(3) not null default '0' comment '订单状态,默认0新下单', -- tinyint 占用一个字节  取值范围从-128 到 127
	`pay_status` tinyint(3) not null default '0' comment '支付状态,默认0未支付',
	`create_time` timestamp not null default current_timestamp comment '创建时间', -- 在创建该条时自动插入当前时间在这个字段
	`update_time` timestamp not null default current_timestamp on update 
		current_timestamp comment '修改时间', -- 在修改该条目时自动插入当前时间在这个字段
	primary key (`order_id`),
	key `idx_buyer_openid` (`buyer_openid`) -- 加一个索引,根据微信openid查询
) comment '订单表';


-- 订单详情表
create table `order_detail` (
	`detail_id` varchar(32) not null,
	`order_id` varchar(32) not null,
	`product_id` varchar(32) not null,
	`product_name` varchar(64) not null comment '商品名称',
	`product_price` decimal(8,2) not null comment '商品价格',
	`product_quantity` int not null comment '商品数量',
	`product_icon` varchar(512) comment '商品小图',
	`create_time` timestamp not null default current_timestamp comment '创建时间', -- 在创建该条时自动插入当前时间在这个字段
	`update_time` timestamp not null default current_timestamp on update 
		current_timestamp comment '修改时间', -- 在修改该条目时自动插入当前时间在这个字段
	primary key (`detail_id`),
	key `idx_order_id` (`order_id`) -- 加一个索引,根据订单 id 查询
) comment '订单详情表';

 

  • 2
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 9
    评论
地方订餐网站系统 2015 2016 最赚钱的项目,帮您打造本地商业门户,机遇不可错过。网上订餐系统_网络订餐系统_网站建设.订餐网,网源码,带积分商城,商家系统,网站建设! 系统特点: 周密策划、项目为先 "项目指导技术,技术服从项目",这是我们一贯秉承的原则,也是我们与其他系统开发商、网站建设公司的本质区别所在!我们的每个系统作品都要经过周密的市场分析调查、可行性研究、项目策划,对我们来说项目的可行性高于一切! 功能专业、布局严谨 以项目方案为蓝本,以现有成功地方网站为局部参考,并充分结合地方性网站的特点与商业模式进行功能规划。系统以八大主要功能模块与诸多 实用辅助模块组成,专业、强大、实用、易用。在布局上科学严谨,给用户以完美影像! 顶尖设计、赏心悦目 深知“面子”在网站中举足轻重位置,本系统由多名资深网页设计师联合设计,所有页面均经过布局策划-页面与UI设计-美术设计三大环节,结构布局清晰、界面大气美观、干净整洁,并注重每个细节的用户体验。让您的网站在用户面前眼前一亮! 饿了么源码网络订餐系统致力于帮助专业从事餐饮企业或有业务的餐饮企业快速部署订餐系统,拓展网络订餐业务。简洁大方的界面、精准的楼宇定位系统、强大的菜单管理系统,人性化的订单处理系统等等,不仅能够帮助您提升企业形象、还为您提供了一套完整的网络解决方案,配合适当的宣传方式可以获得实实在在的销量和用户黏度的提升。 都来订网络订餐系统区别于同类软件产品的独特性表现在: 1、 简洁大方的界面 简洁的界面,简便的操作,全面提升企业形象,带给您全新的体验。 2、 精准的楼宇定位系统 配送范围、配送价格、配送时间随需变化。 3、 强大的菜单管理系统 单品、套餐均适用,图片展示更直观。 4、 人性化的订单处理系统 订单提示、处理、打印、对账,一站式完成。 5、 快捷流畅的订餐流程 定位→选餐→下单→结算,保证订单准确无误。 6、 及时发布公告信息 将营业状态和促销信息第一时间发布到网站。 都来订网络订餐系统V1.8.6更新内容简介: 1、提高首页点餐速度;

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值