/*
Navicat MySQL Data Transfer

Source Server         : localhost_3306
Source Server Version : 50051
Source Host           : localhost:3306
Source Database       : shop_product_db

Target Server Type    : MYSQL
Target Server Version : 50051
File Encoding         : 65001

Date: 2018-07-30 22:10:18
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for `admin`
-- ----------------------------
DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin` (
  `username` varchar(20) NOT NULL default '',
  `password` varchar(32) default NULL,
  PRIMARY KEY  (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of admin
-- ----------------------------
INSERT INTO `admin` VALUES ('a', 'a');

-- ----------------------------
-- Table structure for `t_customer`
-- ----------------------------
DROP TABLE IF EXISTS `t_customer`;
CREATE TABLE `t_customer` (
  `customerId` int(11) NOT NULL auto_increment COMMENT '记录id',
  `customerName` varchar(60) NOT NULL COMMENT '客户名称',
  `customerType` varchar(20) NOT NULL COMMENT '客户类型',
  `telephone` varchar(20) NOT NULL COMMENT '客户电话',
  `customerAddress` varchar(60) NOT NULL COMMENT '客户地址',
  `memo` varchar(5000) default NULL COMMENT '客户备注',
  PRIMARY KEY  (`customerId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of t_customer
-- ----------------------------
INSERT INTO `t_customer` VALUES ('1', '红光电脑销售部', '不常见客户', '13598930834', '四川成都红星路', '<p>偶尔来我们这里进货的客户</p>');
INSERT INTO `t_customer` VALUES ('2', '美丽雅手机销售中心', '大客户', '028-82934234', '成都市太升南路', '<p>大批量进货商</p>');

-- ----------------------------
-- Table structure for `t_product`
-- ----------------------------
DROP TABLE IF EXISTS `t_product`;
CREATE TABLE `t_product` (
  `productId` int(11) NOT NULL auto_increment COMMENT '商品id',
  `productClassObj` int(11) NOT NULL COMMENT '商品类别',
  `productName` varchar(50) NOT NULL COMMENT '商品名称',
  `mainPhoto` varchar(60) NOT NULL COMMENT '商品主图',
  `price` float NOT NULL COMMENT '商品价格',
  `productNum` int(11) NOT NULL COMMENT '商品库存',
  `productDesc` varchar(5000) NOT NULL COMMENT '商品描述',
  `supplierObj` int(11) NOT NULL COMMENT '供应商',
  `addTime` varchar(20) default NULL COMMENT '发布时间',
  PRIMARY KEY  (`productId`),
  KEY `productClassObj` (`productClassObj`),
  KEY `supplierObj` (`supplierObj`),
  CONSTRAINT `t_product_ibfk_1` FOREIGN KEY (`productClassObj`) REFERENCES `t_productclass` (`classId`),
  CONSTRAINT `t_product_ibfk_2` FOREIGN KEY (`supplierObj`) REFERENCES `t_supplier` (`supplierId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of t_product
-- ----------------------------
INSERT INTO `t_product` VALUES ('1', '1', '索尼相机', 'upload/7885c43a-5000-4756-99b0-01462821b421.jpg', '1999', '100', '<p>高清晰，高像素相机</p>', '1', '2018-01-19 23:14:26');
INSERT INTO `t_product` VALUES ('2', '2', 'Apple/苹果 iPhone X', 'upload/5b244755-dd86-486e-a16b-690b983f11e2.jpg', '6500', '50', '<ul style=\"list-style-type: none;\" class=\" list-paddingleft-2\"><li><p>证书编号：2017011606002271</p></li><li><p>证书状态：有效</p></li><li><p>产品名称：TD-LTE 数字移动电话机</p></li><li><p>3C规格型号：A1865(电源适配器可选：A1443 输出：5.0VDC 1A)</p></li><li><p>产品名称：Apple/苹果 iPhone X</p></li><li><p>Apple型号:&nbsp;iPhone X</p></li><li><p>机身颜色:&nbsp;银色&nbsp;深空灰色</p></li><li><p>存储容量:&nbsp;64GB&nbsp;256GB</p></li></ul><p><br/></p>', '2', '2018-07-30 22:05:38');

-- ----------------------------
-- Table structure for `t_productclass`
-- ----------------------------
DROP TABLE IF EXISTS `t_productclass`;
CREATE TABLE `t_productclass` (
  `classId` int(11) NOT NULL auto_increment COMMENT '类别id',
  `className` varchar(40) NOT NULL COMMENT '类别名称',
  `classDesc` varchar(500) NOT NULL COMMENT '类别描述',
  PRIMARY KEY  (`classId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of t_productclass
-- ----------------------------
INSERT INTO `t_productclass` VALUES ('1', '相机', '照相的');
INSERT INTO `t_productclass` VALUES ('2', '手机', '智能通讯娱乐工具');

-- ----------------------------
-- Table structure for `t_purchase`
-- ----------------------------
DROP TABLE IF EXISTS `t_purchase`;
CREATE TABLE `t_purchase` (
  `purchaseId` int(11) NOT NULL auto_increment COMMENT '进货id',
  `productObj` int(11) NOT NULL COMMENT '进货商品',
  `price` float NOT NULL COMMENT '进货单价',
  `purchaseNum` int(11) NOT NULL COMMENT '进货数量',
  `purchaseDate` varchar(20) default NULL COMMENT '进货日期',
  `supplierObj` int(11) NOT NULL COMMENT '供应商',
  `memo` varchar(500) default NULL COMMENT '进货备注',
  PRIMARY KEY  (`purchaseId`),
  KEY `productObj` (`productObj`),
  KEY `supplierObj` (`supplierObj`),
  CONSTRAINT `t_purchase_ibfk_1` FOREIGN KEY (`productObj`) REFERENCES `t_product` (`productId`),
  CONSTRAINT `t_purchase_ibfk_2` FOREIGN KEY (`supplierObj`) REFERENCES `t_supplier` (`supplierId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of t_purchase
-- ----------------------------
INSERT INTO `t_purchase` VALUES ('1', '1', '1688', '20', '2018-01-18', '1', '进货测试');
INSERT INTO `t_purchase` VALUES ('2', '2', '5000', '100', '2018-07-30', '2', '代理商进货');

-- ----------------------------
-- Table structure for `t_sell`
-- ----------------------------
DROP TABLE IF EXISTS `t_sell`;
CREATE TABLE `t_sell` (
  `sellId` int(11) NOT NULL auto_increment COMMENT '销售id',
  `productObj` int(11) NOT NULL COMMENT '销售产品',
  `customerObj` int(11) NOT NULL COMMENT '销售客户',
  `price` float NOT NULL COMMENT '销售单价',
  `sellCount` int(11) NOT NULL COMMENT '销售数量',
  `sellDate` varchar(20) default NULL COMMENT '销售日期',
  `payWay` varchar(20) NOT NULL COMMENT '支付方式',
  `logistics` varchar(20) NOT NULL COMMENT '物流公司',
  `wayNumber` varchar(20) NOT NULL COMMENT '运单号',
  `sellMemo` varchar(500) default NULL COMMENT '销售备注',
  PRIMARY KEY  (`sellId`),
  KEY `productObj` (`productObj`),
  KEY `customerObj` (`customerObj`),
  CONSTRAINT `t_sell_ibfk_1` FOREIGN KEY (`productObj`) REFERENCES `t_product` (`productId`),
  CONSTRAINT `t_sell_ibfk_2` FOREIGN KEY (`customerObj`) REFERENCES `t_customer` (`customerId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of t_sell
-- ----------------------------
INSERT INTO `t_sell` VALUES ('1', '1', '1', '2200', '2', '2018-01-19', '信用卡', '申通快递', '19385899384344', '销售登记测试');
INSERT INTO `t_sell` VALUES ('2', '2', '2', '6000', '10', '2018-07-30', '支付宝', '顺丰', '2948195141491589', 'test');

-- ----------------------------
-- Table structure for `t_supplier`
-- ----------------------------
DROP TABLE IF EXISTS `t_supplier`;
CREATE TABLE `t_supplier` (
  `supplierId` int(11) NOT NULL auto_increment COMMENT '记录id',
  `supplierName` varchar(50) NOT NULL COMMENT '单位全称',
  `fddbr` varchar(20) NOT NULL COMMENT '法定代表人',
  `lxfs` varchar(20) NOT NULL COMMENT '联系方式',
  `address` varchar(80) NOT NULL COMMENT '单位地址',
  PRIMARY KEY  (`supplierId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of t_supplier
-- ----------------------------
INSERT INTO `t_supplier` VALUES ('1', '索尼公司', '王忠强', '010-82939843', '北京市海定区');
INSERT INTO `t_supplier` VALUES ('2', '苹果公司', '库克', '400-666-8800', '美国洛杉矶');
