数据库表 概要设计

vc 端符合直觉,m 端追求快速(TDD BDD) 长期...

 

【缩写】

我们规定 类似 bq = blockquote

cT = create_time  

uT = update_time

id = ${entity}_id

 

【约定大于配置】

`create_time` timestamp not null default current_timestamp comment '创建时间',
`update_time` timestamp not null default current_timestamp on update current_timestamp comment '修改时间',

 

【概要设计规定】

1. constraint 约束先忽略    not null    自增 auto_increment

2. 类型先忽略  int varchar timestamp 

3. 数据字典 先忽略 comment

4. 默认值 DEFAULT 先忽略

5. 违反第三范式 适当数据冗余减少join (遵守第一范式二维表 第二范式 context + 主键) 

  

【Java 几种实体】就是说我们不用外键,让程序去维护几个实体的关联。

DTO (data2obj 作为传输实体存在) = (Entity1 + Entity2)(service 业务驱动) 

XXXForm (表单实体) = 前端表单参数封装( API 驱动 )

VO (作为规定格式实体返回给前端而存在)

 

【几个 Key】Refs

primary key 

foreign key 外键 第三范式 

unique key 插入数据不重复

key 逻辑层加快查询速度 另外不建议 强制索引

  index 物理层

 

实体表

【product_category】 (id,category_name,catagory_type)  & pk(id)

【product_info】(id,product_name,product_price,product_stock,

  product_description,product_icon,product_status,category_type) & pk(id)

【order_master】(id,buyer_name,buyer_phone,buyer_address,buyer_openid,

  order_status,pay_status) & pk(id) & key(buyer_openid)

【order_detail】(detail_id,order_id,product_id,product_name,product_price,

  product_quantity,product_icon)&pk(detail_id)&key(order_id)

【seller_info】(id,username,password,openid) & pk(id)

…………………………………………………………………………………………………………

 

猜你喜欢

转载自www.cnblogs.com/chenhui7373/p/9076608.html