(一)廖师兄springboot微信点餐SQL建表脚本
数据库设计
数据库表之间的关系
- 类目表(product_category)
- 商品表(product_info)
- 订单主表(order_master)
- 订单详情表(order_detail)
卖家信息表(order_detail)

create table `product_info`(
`product_id` varchar(32) not null, --企业级的用varchar,自己玩的项目可以用自增的但数量大了可能不够用
`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 '更新时间', --MYSQL5.7才可以default current_timestamp
primary key (`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 '更新时间', --MYSQL5.7才可以default current_timestamp
primary key (`category_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新下单',
`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 '更新时间', --MYSQL5.7才可以default current_timestamp
primary key (`order_id`),
key `idx_buyer_openid` (`buyer_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 '更新时间', --MYSQL5.7才可以default current_timestamp
primary key (`detail_id`),
key `idx_order_id`(`order_id`)
) comment '订单详情表';
(一)廖师兄springboot微信点餐SQL建表脚本的更多相关文章
- 廖师兄springboot微信点餐开发中相关注解使用解释
package com.imooc.dataobject;import lombok.Data;import org.hibernate.annotations.DynamicUpdate;impor ...
- (二)廖师兄springboot微信点餐虚拟机说明文档
虚拟机 VirtualBox-5.1.22 系统 CentOS7.3账号 root密码 123456 软件:jdk 1.8.0_111nginx 1.11.7mysql 5.7.17redis 3. ...
- SQL SERVER 生成建表脚本
/****** Object: StoredProcedure [dbo].[GET_TableScript_MSSQL] Script Date: 06/15/2012 11:59:00 ***** ...
- SQL SERVER 生成MYSQL建表脚本
/****** Object: StoredProcedure [dbo].[GET_TableScript_MYSQL] Script Date: 06/15/2012 13:05:14 ***** ...
- SQL SERVER 生成ORACLE建表脚本
/****** Object: StoredProcedure [dbo].[GET_TableScript_ORACLE] Script Date: 06/15/2012 13:07:16 **** ...
- (转)SQL SERVER 生成建表脚本
https://www.cnblogs.com/champaign/p/3492510.html /****** Object: StoredProcedure [dbo].[GET_TableScr ...
- SQL创建表脚本
<1>SQL Server设置主键自增长列 SQL Server设置主键自增长列 1.新建一数据表,里面有字段id,将id设为为主键 www.2cto.com create t ...
- spark sql建表的异常
在使用spark sql创建表的时候提示如下错误: missing EOF at 'from' near ')' 可以看下你的建表语句中是不是create external table .... ...
- sql建表,建索引注意事项
建表注意 .建议字段定义为NOT NULL 搜索引擎 MyISAM InnoDB 区别 InnoDB和MyISAM是许多人在使用MySQL时最常用的两个表类型,这两个表类型各有优劣,视具体应用而定.基 ...
随机推荐
- php 注册器模式 工厂模式
<?php /** * 注册器模式 * 全局共享和交换对象 */ class Register { public static $objects; // 定义全局数组 // 保存对象到全局数组 ...
- 分布式事务说的的2PC、3PC、TCC是啥
目录 2PC(Two Phase Commit) 3PC(Three Phase Commit) TCC(Try-Confirm-Cancel) 2PC(Two Phase Commit) 顾名思义, ...
- windows注册redis为服务,zookeeper为服务
windows注册redis为服务,zkserver为服务 1.redis部分 通过redis内置工具安装 进入redis安装目录 1.shift+鼠标右键打开菜单,点击"在此处打开命令窗口 ...
- 关于node回调函数中同步和异步操作的理解
1.node的回调函数:如果一个方法的参数是另一个函数的名字,则这个参数本身就要回调函数,这个函数就是回调函数 1).同步操作文件(阻塞I/O) 同步就是一个人干完这个再干那个-- 所 ...
- CTF-misc:老板,再来几道misc玩玩
[BJDCTF 2nd]最简单的misc-y1ng 得到一个图片,提示格式损坏,修补一下文件头 然后得到一张图片 直接python16进制转字符串 >>> string = &quo ...
- D. Alyona and Strings 解析(思維、DP)
Codeforce 682 D. Alyona and Strings 解析(思維.DP) 今天我們來看看CF682D 題目連結 題目 略,請直接看原題. 前言 a @copyright petjel ...
- 1. HttpRunner介绍及环境准备
介绍 HttpRunner 是一款面向 HTTP(S) 协议的通用测试框架 只需编写维护一份 YAML/JSON脚本,即可实现自动化测试.性能测试.线上监控.持续集成等多种测试需求 官方文档: htt ...
- ModelSerializer 高级使用
前言 ModelSerializer中还具有一些高级用法,如批量更新.批量删除.批量创建等. 但是批量过来的数据格式都需要与前端做好协商,什么样的数据格式是单条操作,什么样的数据格式是批量操作. 如下 ...
- 基于tensorflow的文本分类总结(数据集是复旦中文语料)
代码已上传到github:https://github.com/taishan1994/tensorflow-text-classification 往期精彩: 利用TfidfVectorizer进行 ...
- Jmeter——ForEach Controller&Loop Controller
今天来分享下Jmeter中的2款循环控制器,ForEach Controller和Loop Controller,在使用上还是有所区别. ForEach Controller ForEach Cont ...