```plantuml @startuml ' 设置类图方向为从左到右 left to right direction ' 定义用户表实体 class User { + user_id : INT [PK] username : VARCHAR } ' 定义商品表实体 class Goods { + goods_id : INT [PK] goods_name : VARCHAR unit : VARCHAR unit_price : DECIMAL } ' 定义订单主表实体 class Order { + order_id : VARCHAR [PK] order_date : DATETIME user_id : INT [FK] } ' 定义订单明细表实体 class OrderDetail { + detail_id : INT [PK] order_id : VARCHAR [FK] goods_id : INT [FK] quantity : INT unit_price : DECIMAL } ' 定义关联关系 User "1" --> "0..*" Order : 创建 Order "1" --> "1..*" OrderDetail : 包含 Goods "1" --> "0..*" OrderDetail : 被购买 ' 添加范式说明注释 note top of Goods 第三范式实现: goods_name/unit 独立存储在商品表 通过 goods_id 外键关联消除冗余 end note note top of OrderDetail 第三范式实现: 存储下单时的 unit_price(快照) 总价 = quantity * unit_price 不存储冗余的 goods_name/unit end note @enduml ```