項目設計:
角色划分:
買家(手機端) 賣家(PC端)
功能模塊划分:
架構部署:
項目支持分布式應用,即tomcat為多個服務器,下面圖是微服務簡介
數據庫設計:
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) ) comment '商品表'; /*這里商品id不使用自增是因為在大型項目中,如果使用自增的話,將會導致溢出,即商品id號不夠用,當然小項目無所謂夠用*/
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_table(
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) 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 '訂單詳情表';