訂單模塊數據庫表解析(一)

SpringBoot實戰電商項目mall(18k+star)地址:github.com/macrozheng/…git

摘要

本文主要對訂單及訂單設置功能的表進行解析,採用數據庫表與功能對照的形式。github

訂單

相關表結構

訂單表

訂單表,須要注意的是訂單狀態:0->待付款;1->待發貨;2->已發貨;3->已完成;4->已關閉;5->無效訂單。sql

create table oms_order
(
   id                   bigint not null auto_increment comment '訂單id',
   member_id            bigint not null comment '會員id',
   coupon_id            bigint comment '優惠券id',
   order_sn             varchar(64) comment '訂單編號',
   create_time          datetime comment '提交時間',
   member_username      varchar(64) comment '用戶賬號',
   total_amount         decimal(10,2) comment '訂單總金額',
   pay_amount           decimal(10,2) comment '應付金額(實際支付金額)',
   freight_amount       decimal(10,2) comment '運費金額',
   promotion_amount     decimal(10,2) comment '促銷優化金額(促銷價、滿減、階梯價)',
   integration_amount   decimal(10,2) comment '積分抵扣金額',
   coupon_amount        decimal(10,2) comment '優惠券抵扣金額',
   discount_amount      decimal(10,2) comment '管理員後臺調整訂單使用的折扣金額',
   pay_type             int(1) comment '支付方式:0->未支付;1->支付寶;2->微信',
   source_type          int(1) comment '訂單來源:0->PC訂單;1->app訂單',
   status               int(1) comment '訂單狀態:0->待付款;1->待發貨;2->已發貨;3->已完成;4->已關閉;5->無效訂單',
   order_type           int(1) comment '訂單類型:0->正常訂單;1->秒殺訂單',
   delivery_company     varchar(64) comment '物流公司(配送方式)',
   delivery_sn          varchar(64) comment '物流單號',
   auto_confirm_day     int comment '自動確認時間(天)',
   integration          int comment '能夠得到的積分',
   growth               int comment '能夠活動的成長值',
   promotion_info       varchar(100) comment '活動信息',
   bill_type            int(1) comment '發票類型:0->不開發票;1->電子發票;2->紙質發票',
   bill_header          varchar(200) comment '發票擡頭',
   bill_content         varchar(200) comment '發票內容',
   bill_receiver_phone  varchar(32) comment '收票人電話',
   bill_receiver_email  varchar(64) comment '收票人郵箱',
   receiver_name        varchar(100) not null comment '收貨人姓名',
   receiver_phone       varchar(32) not null comment '收貨人電話',
   receiver_post_code   varchar(32) comment '收貨人郵編',
   receiver_province    varchar(32) comment '省份/直轄市',
   receiver_city        varchar(32) comment '城市',
   receiver_region      varchar(32) comment '區',
   receiver_detail_address varchar(200) comment '詳細地址',
   note                 varchar(500) comment '訂單備註',
   confirm_status       int(1) comment '確認收貨狀態:0->未確認;1->已確認',
   delete_status        int(1) not null default 0 comment '刪除狀態:0->未刪除;1->已刪除',
   use_integration      int comment '下單時使用的積分',
   payment_time         datetime comment '支付時間',
   delivery_time        datetime comment '發貨時間',
   receive_time         datetime comment '確認收貨時間',
   comment_time         datetime comment '評價時間',
   modify_time          datetime comment '修改時間',
   primary key (id)
);
複製代碼

訂單商品信息表

訂單中包含的商品信息,一個訂單中會有多個訂單商品信息。數據庫

create table oms_order_item
(
   id                   bigint not null auto_increment,
   order_id             bigint comment '訂單id',
   order_sn             varchar(64) comment '訂單編號',
   product_id           bigint comment '商品id',
   product_pic          varchar(500) comment '商品圖片',
   product_name         varchar(200) comment '商品名稱',
   product_brand        varchar(200) comment '商品品牌',
   product_sn           varchar(64) comment '商品條碼',
   product_price        decimal(10,2) comment '銷售價格',
   product_quantity     int comment '購買數量',
   product_sku_id       bigint comment '商品sku編號',
   product_sku_code     varchar(50) comment '商品sku條碼',
   product_category_id  bigint comment '商品分類id',
   sp1                  varchar(100) comment '商品的銷售屬性1',
   sp2                  varchar(100) comment '商品的銷售屬性2',
   sp3                  varchar(100) comment '商品的銷售屬性3',
   promotion_name       varchar(200) comment '商品促銷名稱',
   promotion_amount     decimal(10,2) comment '商品促銷分解金額',
   coupon_amount        decimal(10,2) comment '優惠券優惠分解金額',
   integration_amount   decimal(10,2) comment '積分優惠分解金額',
   real_amount          decimal(10,2) comment '該商品通過優惠後的分解金額',
   gift_integration     int not null default 0 comment '商品贈送積分',
   gift_growth          int not null default 0 comment '商品贈送成長值',
   product_attr         varchar(500) comment '商品銷售屬性:[{"key":"顏色","value":"顏色"},{"key":"容量","value":"4G"}]',
   primary key (id)
);
複製代碼

訂單操做記錄表

當訂單狀態發生改變時,用於記錄訂單的操做信息。微信

create table oms_order_operate_history
(
   id                   bigint not null auto_increment,
   order_id             bigint comment '訂單id',
   operate_man          varchar(100) comment '操做人:用戶;系統;後臺管理員',
   create_time          datetime comment '操做時間',
   order_status         int(1) comment '訂單狀態:0->待付款;1->待發貨;2->已發貨;3->已完成;4->已關閉;5->無效訂單',
   note                 varchar(500) comment '備註',
   primary key (id)
);
複製代碼

管理端展示

訂單列表

展現圖片

查看訂單

展現圖片
展現圖片
展現圖片

訂單發貨

展現圖片

移動端展示

不一樣狀態下的訂單

展現圖片
展現圖片
展現圖片

訂單詳情

展現圖片
展現圖片

訂單設置

相關表結構

訂單設置表

用於對訂單的一些超時操做進行設置。app

create table oms_order_setting
(
   id                   bigint not null auto_increment,
   flash_order_overtime int comment '秒殺訂單超時關閉時間(分)',
   normal_order_overtime int comment '正常訂單超時時間(分)',
   confirm_overtime     int comment '發貨後自動確認收貨時間(天)',
   finish_overtime      int comment '自動完成交易時間,不能申請售後(天)',
   comment_overtime     int comment '訂單完成後自動好評時間(天)',
   primary key (id)
);
複製代碼

管理端展示

展現圖片

公衆號

mall項目全套學習教程連載中,關注公衆號第一時間獲取。post

公衆號圖片
相關文章
相關標籤/搜索