

# 订单表
* * * * *
~~~
DROP TABLE IF EXISTS `shop_order`;
CREATE TABLE IF NOT EXISTS `shop_order`(
`orderid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`userid` BIGINT UNSIGNED NOT NULL DEFAULT '0',
`addressid` BIGINT UNSIGNED NOT NULL DEFAULT '0',
`amount` DECIMAL(10,2) NOT NULL DEFAULT '0.00',
`status` INT UNSIGNED NOT NULL DEFAULT '0',
`expressid` INT UNSIGNED NOT NULL DEFAULT '0',
`expressno` VARCHAR(50) NOT NULL DEFAULT '',
`createtime` INT UNSIGNED NOT NULL DEFAULT '0',
`updatetime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
KEY shop_order_userid(`userid`),
KEY shop_order_addressid(`addressid`),
KEY shop_order_expressid(`expressid`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
~~~
# 订单详情表
*****
~~~
DROP TABLE IF EXISTS `shop_order_detail`;
CREATE TABLE IF NOT EXISTS `shop_order_detail`(
`detailid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`productid` BIGINT UNSIGNED NOT NULL DEFAULT '0',
`price` DECIMAL(10,2) NOT NULL DEFAULT '0.00',
`productnum` INT UNSIGNED NOT NULL DEFAULT '0',
`orderid` BIGINT UNSIGNED NOT NULL DEFAULT '0',
`createtime` INT UNSIGNED NOT NULL DEFAULT '0',
KEY shop_order_detail_productid(`productid`),
KEY shop_order_detail_orderid(`orderid`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
~~~
# 收货地址表
* * * * *
~~~
DROP TABLE IF EXISTS `shop_address`;
CREATE TABLE IF NOT EXISTS `shop_address`(
`addressid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`firstname` VARCHAR(32) NOT NULL DEFAULT '',
`lastname` VARCHAR(32) NOT NULL DEFAULT '',
`company` VARCHAR(100) NOT NULL DEFAULT '',
`address` TEXT,
`postcode` CHAR(6) NOT NULL DEFAULT '',
`email` VARCHAR(100) NOT NULL DEFAULT '',
`telephone` VARCHAR(20) NOT NULL DEFAULT '',
`userid` BIGINT UNSIGNED NOT NULL DEFAULT '0',
`createtime` INT UNSIGNED NOT NULL DEFAULT '0',
KEY shop_address_userid(`userid`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
~~~