<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                [TOC] ## 步驟 1 : 用戶表t_user 登錄頁面采集用戶的賬號和密碼 ![](https://box.kancloud.cn/f495bafce1ddc3ba56bd10f24233019a_424x493.png) ![](https://box.kancloud.cn/429ffa17c81fbc556eb5a60c5169fa0e_1019x646.png) ## 步驟 2 : 分類表t_category ![](https://box.kancloud.cn/0ea695a51feeddf252122d56df6f740f_328x689.png) ![](https://box.kancloud.cn/779cf31924f68fcf634ad18d4c8d5697_989x537.png) ## 步驟 3 : 屬性表t_property 在產品頁的商品詳情標簽下,顯示本產品對應分類所設置的所有屬性。 ![](https://box.kancloud.cn/acee2f3211179e3c096e222c4aa0210b_996x417.png) ![](https://box.kancloud.cn/71b00c3c384901648338029336a79e73_858x537.png) > 比如衣服分類下的所有產品,都有共同的一系列屬性,像:產地,質地,尺寸等等。 那么“有哪些屬性” 這個信息,就維護在屬性表里,而且是和分類關聯起來的。 另一種分類,比如馬桶,那么它就是另外一系列屬性了,像: 是否自動沖水,是否播放音樂,深度,寬度 等信息。 * 問題:為什么屬性表要指向分類表而不是產品表呢,是一類商品屬性都相同么? > 是的,一類商品屬性都一樣。 > 如果要單獨為每種商品設計屬性,也不是不可以,但是維護起來太辛苦了。 比如演示網站上就有1500種商品,那么每種商品假設有5種屬性好了,那就是7500種屬性,光是做這個演示網站的準備數據,就太復雜了。 ## 步驟 4 : 產品表t_product 產品頁的產品信息里顯示本產品的名稱,小標題,原始價格,促銷價,銷量,庫存等信息 ![](https://box.kancloud.cn/31401053db255e8ea6ce0ab6df8ab8d0_691x408.png) ![](https://box.kancloud.cn/b64c6fbeb1de6c3f0f38155d80b8ce53_858x537.png) > name: 產品名稱 subTitle: 小標題 originalPrice: 原始價格 promotePrice: 優惠價格 stock: 庫存 createDate: 創建日期 ## 步驟 5 : 屬性值表t_property_value 在產品頁的商品詳情標簽下,顯示本產品的所有屬性值 ![](https://box.kancloud.cn/acee2f3211179e3c096e222c4aa0210b_996x417.png) ![](https://box.kancloud.cn/eae863a4d02581e617c9803f6ac422a1_858x537.png) * * * * * * 問題: 為什么有了屬性表還需要一個屬性值表呢? > 因為不同商品的相同屬性,他們的屬性值不一樣呢 比如iphone 有顏色,值是白色 熊貓手機也有顏色,值卻是黑白相間 ## 步驟 6 : 產品圖片表t_product_image 在產品頁顯示5個單個圖片 ![](https://box.kancloud.cn/b876b20f33cbbc27f8f39ac8a67fec6c_526x622.png) ![](https://box.kancloud.cn/36bccae66effa8f4f43cf5599c47aad1_858x537.png) > type表示類型,產品圖片分單個圖片和詳情圖片兩種 * * * * * * 問題:商品圖片表中并沒有圖片地址這一字段,我不清楚怎么獲取指定的商品圖片 > 基于 productImage 表的id值來保存的,保存在固定位置(后面章節會談到)。 ## 步驟 7 : 評價表t_review 產品頁顯示評價信息 ![](https://box.kancloud.cn/7affdd4950a85ce19e69121d913bc64e_1279x229.png) ![](https://box.kancloud.cn/d421516f57617df831f1947bf245d575_858x537.png) ## 步驟 8 : 訂單表t_order 在后臺的訂單管理頁面看到的訂單信息 ![](https://box.kancloud.cn/d02496f1a7d65cef4a72f8a584b55440_1835x185.png) 生成訂單前,結算頁面 ![](https://box.kancloud.cn/45bf50d640b17f33b706fe292f0d7676_1060x320.png) ![](https://box.kancloud.cn/cd26bf3b26b52a562c7e97c2ab233e7b_858x537.png) > orderCode: 訂單號 address:收貨地址 post: 郵編 receiver: 收貨人信息 mobile: 手機號碼 userMessage: 用戶備注信息 createDate: 訂單創建日期 payDate: 支付日期 deliveryDate: 發貨日期 confirmDate:確認收貨日期 status: 訂單狀態 > 要注意order是關鍵字 ## 步驟 9 : 訂單項表t_order_item 在購物車中看到的訂單項信息 ![](https://box.kancloud.cn/a150a21453f9fabcff204ce9428e380c_1304x524.png) ![](https://box.kancloud.cn/fd31f49ca6f9cde02f85a69763cdaa47_858x537.png) > number字段表示購買數量 * * * * * * 問題:訂單項表的user_id有點冗余,畢竟通過訂單項中的訂單id可以確認用戶,這里是怎么考慮的呢? > 在創建了購物車之后,創建訂單之前,這些訂單項是沒有和訂單關聯起來的。 如果不加個uid, 那么這些訂單項屬于哪個用戶的信息就丟失了。 ## 步驟 10:導出SQL語句 1. 把name復制到comment中,運行腳本,選擇Tools菜單--Execute Commands,點擊打開, ![](https://box.kancloud.cn/08f01db5f9343df7ef5b63569c2b2433_214x101.png) 選擇name2comment.vbs 2. 選擇Database菜單—Generate Database,生成數據結構的SQL,注意在format標簽中將字符編碼設置成UTF-8,導出SQL文件。 ## 步驟 11:創建數據庫,導入SQL 1. 在navicat中創建數據庫:tmall_ssm,并且將數據庫的編碼設置為utf8,便于存放中文 2. 運行剛剛導出的SQL腳本 tmall_ssm.sql ~~~ /*==============================================================*/ /* DBMS name: MySQL 5.0 */ /* Created on: 2018/8/25 14:56:03 */ /*==============================================================*/ drop table if exists t_category; drop table if exists t_order; drop table if exists t_order_item; drop table if exists t_product; drop table if exists t_product_image; drop table if exists t_property; drop table if exists t_property_value; drop table if exists t_review; drop table if exists t_user; /*==============================================================*/ /* Table: t_category */ /*==============================================================*/ create table t_category ( id int not null auto_increment comment 'ID', name varchar(255) comment '名稱', primary key (id) ); alter table t_category comment '分類表'; /*==============================================================*/ /* Table: t_order */ /*==============================================================*/ create table t_order ( id int not null auto_increment comment 'ID', order_code varchar(255) comment '訂單編號', address varchar(255) comment '地址', post varchar(255) comment '郵編', receiver varchar(255) comment '收件人', mobile varchar(255) comment '手機號', user_message varchar(255) comment '買家留言', create_date datetime comment '創建時間', pay_date datetime comment '支付時間', delivery_date datetime comment '發貨時間', confirm_date datetime comment '確認收貨時間', status varchar(255) comment '狀態', user_id int comment '所屬用戶', primary key (id) ); alter table t_order comment '訂單表'; /*==============================================================*/ /* Table: t_order_item */ /*==============================================================*/ create table t_order_item ( id int not null auto_increment comment 'ID', number int comment '數量', user_id int comment '所屬用戶', product_id int comment '所屬產品', order_id int comment '所屬訂單', primary key (id) ); alter table t_order_item comment '訂單項'; /*==============================================================*/ /* Table: t_product */ /*==============================================================*/ create table t_product ( id int not null auto_increment comment 'ID', name varchar(255) comment '名稱', sub_title varchar(255) comment '子標題', original_price float comment '原價格', promote_price float comment '促銷價', stock int comment '倉庫', create_date datetime comment '創建時間', category_id int comment '所屬分類', primary key (id) ); alter table t_product comment '產品表'; /*==============================================================*/ /* Table: t_product_image */ /*==============================================================*/ create table t_product_image ( id int not null auto_increment comment 'ID', type varchar(255) comment '類型', product_id int comment '所屬產品', primary key (id) ); alter table t_product_image comment '產品圖片表'; /*==============================================================*/ /* Table: t_property */ /*==============================================================*/ create table t_property ( id int not null auto_increment comment 'ID', name varchar(255) comment '名稱', category_id int comment '所屬分類', primary key (id) ); alter table t_property comment '屬性表'; /*==============================================================*/ /* Table: t_property_value */ /*==============================================================*/ create table t_property_value ( id int not null auto_increment comment 'ID', value varchar(255) comment '屬性值', product_id int comment '所屬產品', property_id int comment '所屬屬性', primary key (id) ); alter table t_property_value comment '屬性值表'; /*==============================================================*/ /* Table: t_review */ /*==============================================================*/ create table t_review ( id int not null auto_increment comment 'ID', content varchar(4000) comment '內容', create_date datetime comment '創建時間', product_id int comment '所屬產品', user_id int comment '所屬用戶', primary key (id) ); alter table t_review comment '評價表'; /*==============================================================*/ /* Table: t_user */ /*==============================================================*/ create table t_user ( ID int not null auto_increment comment 'ID', name varchar(255) comment '名稱', password varchar(255) comment '密碼', primary key (ID) ); alter table t_user comment '用戶表'; ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看