1.? 數(shù)據(jù)庫的業(yè)務(wù)實體
a.?????? account 用戶
b.?????? admin 用戶
c.?????? 商品分類 category
d.?????? 具體的商品 item
e.?????? 購物車 shoppingCart
f.??????? 訂單 order
g.?????? 購物車中的商品 shoppingCartItem
h.?????? 訂單中的商品 orderItem
2.? 數(shù)據(jù)庫表設(shè)計
數(shù)據(jù)表:
a.?????? adimin 表
b.?????? account 表 ( 主鍵: account_id)
c.?????? 商品分類表 category( 主鍵: category_id)
d.?????? 商品表 item( 主鍵: item_id, 主要鍵值 item_category_id, total_numbers, left_numbers)
e.?????? 訂單 order( 主鍵: order_id, 主要鍵值 order_account_id , status)
f.??????? 訂單中的商品表 orderItem( 主鍵: orderItem_id, 主要鍵值: orderItem_order_id , orderItem_item_id, bookNumbers)
數(shù)據(jù)表解釋:
藍(lán)色的都為外鍵。兩個下折線中間那個為外鍵相關(guān)的表。
至于 item 中的圖書總數(shù)量和剩余數(shù)量,以及訂單的圖書狀態(tài),總覺得這樣設(shè)計不是很好,不知道大家是怎么設(shè)計的?