Database Design
1,新建数据库onecms
CREATE DATABASE onecms;
2,新建goods表:
CREATE TABLE goods(
id int(11) not null primary key auto_increment,
goodstypeid int(11) NOT NULL,
goodstypefid int(11) NOT NULL,
goodstypefstr varchar(33) NOT NULL,
title varchar(255) NOT NULL,
flag varchar(33) NOT NULL,
marketprice int(11) NOT NULL,
salesprice int(11) NOT NULL,
housenum int(11) NOT NULL,
content VARCHAR(255) NOT NULL,
picurl varchar(255) NOT NULL,
hits int(11),
orderid int(11),
checkinfo smallint(1),
delstate smallint(1))ENGINE=InnoDB DEFAULT CHARSET=utf8;
3,新建goodstype表
CREATE TABLE goodstype(
id int(11) not null primary key auto_increment,
fid int(11) NOT NULL,
classname varchar(255) NOT NULL,
orderid int(11) NOT NULL,
checkinfo int(11) NOT NULL,
fstr VARCHAR(33) NOT NULL)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
4,插入测试数据
goods表插入数据:
INSERT INTO `goods` VALUES ('1', '2', '0', '0,2,', 'Huawei mobile phone', '', '1000', '800', '1 ', 'Huawei P10Plus', './uploads/c2922d7d93043572a95bd8b5289a41b.png', '18', '1', '1', '0');
INSERT INTO `goods ` VALUES ('2', '4', '3', '0,3,4,', 'Down Jacket', '', '1000', '888', '0', 'Pure Duck Down Jacket', ' ./uploads/1397f1630770e4cc2d407c1911c2ecc.png', '3', '2', '1', '0');
INSERT INTO `goods` VALUES ('3', ' 1', '0', '0,1,', 'Notebook', '', '3800', '3666', '0', 'Lenovo thinkpad notebook', './uploads/fd9ecdaf3ee9a9035f51da6471e3f90.png', ' 2', '3', '1', '0');
Insert data into the goodstype table:
INSERT INTO `goodstype` VALUES ('1', '0', 'Computer', '1', '1', '0,');
INSERT INTO `goodstype ` VALUES ('2', '0', 'mobile phone', '2', '1', '0,');
INSERT INTO `goodstype` VALUES ('3 ', '0', 'clothes', '3', '0', '0,');
INSERT INTO `goodstype` VALUES ('4', '3' , 'Down Jacket', '4', '1', '0,3,');