1 微信點餐系統之資料庫設計

2021-10-20 12:18:11 字數 4426 閱讀 4972

----

----商品**

----

create

table

`product_info`

(`product_id`

varchar(32

)not

null

comment

'商品id'

,`product_name`

varchar(64

)not

null

comment

'商品名稱'

,`product_price`

varchar(64

)not

null

comment

'商品**'

,`product_stock`

intnot

null

default

0comment

'庫存'

,`product_description`

varchar(64

)not

null

default

'0'comment

'描述'

,`product_icon`

varchar

(512

)not

null

default

'0'comment

'小圖'

,`category_type`

intnot

null

default

0comment

'類目編號'

,`create_time`

timestamp

notnull

default

current_timestamp()

comment

'建立時間'

,`update_time`

timestamp

notnull

default

current_timestamp()

onupdate

current_timestamp()

comment

'更新時間'

,primary

key(

`product_id`))

comment

='商品表'

collate

='utf8_general_ci'

;#這裡的mysql版本是5.7如果是其他版本可能給建立時間和更新時間設定的預設值會報錯,系統不允許這麼做(我的是8版本到時候需要注意一下)

----

----類目**

----

create

table

'product_category'

('category_id'

intnot

null

auto_increment

,'category_name'

varchar(64

)not

null

comment

'類目名稱'

,'category_type'

intnot

null

comment

'類目編號'

,'create_time'

timestamp

notnull

default

current_timestamp

comment

'建立時間'

,'update_time'

timestamp

notnull

default

current_timestamp

on update_time current_timestamp

comment

'更新時間'

,primary

key(

'category_id'),

unique

key'uqe_category_type'

('category_type'))

comment

'類目表'

;----

----訂單**

----

create

table

'order_master'

('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

,'order_amount'

decimal(8

,2)not

null

comment

'訂單總金額'

,'order_statue'

tinyint(3

)not

null

default

'0'comment

'訂單狀態,預設0 新下單'

,'pay_statue'

tinyint(3

)not

null

default

'0'comment

'支付狀態,預設0是未支付'

,'create_time'

timestamp

notnull

default

current_timestamp

comment

'建立時間'

,'update_time'

timestamp

notnull

default

current_timestamp

on update_time 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'

intnot

null

comment

'商品數量'

,'product_icon'

varchar

(512

)comment

'商品小圖'

,'create_time'

timestamp

notnull

default

current_timestamp

comment

'建立時間'

,'update_time'

timestamp

notnull

default

current_timestamp

on update_time current_timestamp

comment

'更新時間'

,primary

key(

'detail_id'),

key'idx_order_id'

('order_id'))

comment

'訂單詳情表'

;#利用訂單id來查詢詳情,為order_id建立乙個索引

微信點餐小程式 1

本專案日誌用logback 1.日誌的使用 runwith springrunner.class springboottest public class loggertest password name password logger.error error.2.logback的配置 logging...

SpringBoot微信點餐專案 資料庫設計1

專案中一共設計到五張表 1 商品表 prodcut name varchar 64 not null comment 商品名稱 product price decimal 8,2 not null comment 單價 product stock int not null comment 庫存 pr...

Springboot企業微信點餐系統筆記

lombok外掛程式的使用 do dto vo do 對應資料庫的實體物件,和資料庫字段一一對應 dto 資料傳輸物件,dto本身並不是業務物件 vo 用於封裝傳遞到前端需要展示的字段,不需要展示的字段不要包含 使用分層處理非常有必要,使用beanutils如何實現資料拷貝 junit test 在...