一、 一对多“扁平化处理”, 主表和子表, 子表引用主表的id
二、 字段可选择json对象存储, 不一定都要“扁平化”
三、 酒店类设计不要库存字段, 直接由酒店“接单”、“拒单”两个操作来行使库存的功能:不好超卖
三、 酒店类设计不要库存字段, 直接由酒店“接单”、“拒单”两个操作来行使库存的功能:不好超卖
模仿美图外卖和商户的交互方式;
美团外卖就没有库存,由商家决定是否接单。
分类表 tb_category
tb_category{
id,
parent_id,
type, # 1(产品分类) 2(属性分类) 3(规格分类)
category_name
}
属性表 tb_attribute
tb_attribute{
id,
categoty_id,
categoty_name,
attribute_name
}
规格表 tb_specfication
tb_specficaton{
id,
categoty_id,
categoty_name,
specification_value
}
属性和规格关联表 tb_attribute_specfication_ref
一对多的关系
tb_attribute_specfication_ref{
id,
attribute_id,
specification_id
}
产品表 tb_product
产品是由一堆属性堆积来的
tb_product{
id,
categoty_id,
categoty_name,
...其他绑定信息
product_name
}
给产品绑定属性 tb_product_attribute_ref
属性可以预制, 也可以在创建产品时自定义
tb_product_attribute_ref{
id,
product_id,
attribute_id
}
产品销售单元 tb_product_item
tb_product_item{
id,
product_id,
stock,
price
}
唯一定义产品销售单元 tb_product_item_definition
tb_product_item_definition{
id,
product_item_id,
attribute_specfication_ref_id
}
订单 tb_order{
id,
order_num
}
订单详情 tb_order_details{
id,
order_id,
product_item_id,
...
}
网友评论