(八)訂單表設計

2021-10-03 06:25:14 字數 1935 閱讀 1998

`id` int unsigned primary key auto_increment comment '主鍵',

`code` varchar(200) not null comment '流水號',

`type` tinyint unsigned not null comment '訂單型別:1實體銷售,2網路銷售',

`shop_id` int unsigned comment '零售店id',

`customer_id` int unsigned comment '會員id',

`amount` decimal(10, 2) unsigned not null comment '總金額',

`status` tinyint unsigned not null comment '狀態:1未付款,2已付款,3已發貨,4已簽收',

`postage` decimal(10, 2) unsigned comment '郵費',

`weight` int unsigned comment '重量(克)',

`voucher_id` int unsigned comment '購物券id',

`create_time` timestamp not null default now() comment '建立時間',

unique index `unq_code`(`code`),

index `idx_code`(`code`),

index `idx_customer_id`(`customer_id`),

index `idx_status`(`status`),

index `idx_create_time`(`create_time`),

index `idx_type`(`type`),

index `idx_shop_id`(`shop_id`)

) comment = '訂單表';

`order_id` int unsigned not null comment '訂單id',

`old_id` int unsigned comment 'sku_old表的id',

`sku_id` int unsigned not null comment '商品id',

`price` decimal(10, 2) unsigned not null comment '原**',

`actual_price` decimal(10, 2) unsigned not null comment '實際購買價',

`num` int unsigned not null comment '購買數量',

primary key (`order_id`, `sku_id`),

index `idx_old_id`(`old_id`)

) comment = '訂單詳情表';

訂單系統訂單表設計方案

一年前,在上一家公司接手了乙個含有訂單系統的專案,業務並不複雜,但是當時令我比較困惑的是訂單表的設計。困惑的點主要是隨著訂單量增加,單錶的儲存能力將達到瓶頸,必然要採用分表的方案,那麼按照什麼維度拆分合適呢?分表之後帶來的最大的挑戰是訂單查詢。如果以使用者為中心,採用userid取模,可以很方便的處...

資料庫訂單表設計

訂單表 order 自動編號 order id,自增長主鍵 訂單單號 order no,唯一值,供客戶查詢 商店編號 shop id,商店表自動編號 訂單狀態 order status,未付款,已付款,已發貨,已簽收,退貨申請,退貨中,已退貨,取消交易 商品數量 product count,商品專案...

電商平台 訂單表的設計

場景分析說明 買家可以在張三家買茄子,李四家買蘿蔔,王五家買白菜,趙六家買豬肉等 那麼買家就應該有個訂單主表,我們稱為訂單表,同時還有 上面所說的具體的訂單明細表,清楚的檢視自己買了什麼菜,多少元一斤,買了多少斤等。1.訂單表的設計 補充說明 交易狀態 存在下了單子沒付款,付款了沒結算等狀態。付款狀...