SpringBoot 企業微信點餐系統實戰一:環境搭建和資料庫設計

`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`)

) 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`),

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 '修改時間',

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) 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 (`detail_id`),

key `idx_order_id` (`order_id`)

) comment '訂單詳情表';

以上就是數據庫設計,直接執行 Sql 語句即可。

強烈推薦:

源碼地址:https://github.com/cachecats/sell


分享到:


相關文章: