1. create database ec_goods;
    2. /*商品表*/
    3. CREATE TABLE `product` (
    4. `id` INT(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
    5. `name` VARCHAR(20) NOT NULL COMMENT '商品名称',
    6. `description` VARCHAR(1024) DEFAULT NULL COMMENT '商品描述',
    7. `price` FLOAT NOT NULL COMMENT '商品价格',
    8. `stock` INT(10) NOT NULL COMMENT '库存数量',
    9. `level1_id` INT(10) DEFAULT NULL COMMENT '分类1',
    10. `level2_id` INT(10) DEFAULT NULL COMMENT '分类2',
    11. `level3_id` INT(10) DEFAULT NULL COMMENT '分类3',
    12. `main_img` VARCHAR(200) DEFAULT NULL COMMENT '主图名称',
    13. `sub_imgs` TEXT DEFAULT NULL COMMENT '副图地址',
    14. `status` INT(1) DEFAULT '1' COMMENT '状态(1:在售 2:下架 3:已删除)',
    15. `create_time` DATETIME DEFAULT NULL COMMENT '创建时间',
    16. `update_time` DATETIME DEFAULT NULL COMMENT '修改时间',
    17. PRIMARY KEY (`id`)
    18. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
    19. /*商品分类表*/
    20. CREATE TABLE `category` (
    21. `id` INT(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
    22. `name` VARCHAR(20) NOT NULL COMMENT '名称',
    23. `parent_id` INT(10) NOT NULL COMMENT '父级目录id',
    24. `level` INT(11) DEFAULT NULL COMMENT '级别(1:一级 2:二级 3:三级)',
    25. `icon` VARCHAR(255) DEFAULT NULL COMMENT '图标',
    26. `status` INT(1) DEFAULT '1' COMMENT '状态(1:正常 2:删除)',
    27. `create_time` DATETIME DEFAULT NULL COMMENT '创建时间',
    28. `update_time` DATETIME DEFAULT NULL COMMENT '修改时间',
    29. PRIMARY KEY (`id`)
    30. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
    31. INSERT INTO
    32. `product`(`id`,`name`,`description`,`price`,`stock`,`level1_id`,`level2_id`,`level3_id`,`main_img`,`status`,`create_time`,`update_time`)
    33. VALUES
    34. (733,'香奈儿','',152,94,548,654,655,'27A1789ED5764D82A5506DF3DC3933F9.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    35. (734,'洗面奶','',152,995,548,654,655,'D6C9BD438C5643D6B1A6C52E5426FE22.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    36. (735,'啫喱水','',152,998,548,654,655,'1A836D2B3A3348DDAB19807E6CEA8028.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    37. (736,'香水5852','',152,1000,548,654,655,'4D9499BAD92A42D291094E797BA2EA3F.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    38. (737,'香水','',152,111,548,654,655,'A9924F9DB68B4DF99FDBF05902075AF0.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    39. (738,'润肤露','',45,109,548,654,655,'3B059EDB5237407980458CE9EA9D3204.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    40. (739,'洁面装','',156,99,548,654,655,'A62C6DF55116440CA3DE9DB37901ED4F.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    41. (740,'电饭锅','',158,100,628,656,659,'40C3B76BA31246618E3CFC8723D33517.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    42. (741,'婴儿喂奶装','',569,100,632,637,653,'401004B3D47C4C6FB1BC5EF19C21FC77.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    43. (742,'坚果套餐','',158,1000,660,661,662,'E03D74145A034F6D909879829CB99D80.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    44. (743,'超甜蜜崭','',589,1000,660,661,663,'7121E55099FC477680B1229205CE3D29.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    45. (744,'华为2566','',589,1000,670,671,672,'F24B4140A2284B3788A38F3B5AD1809A.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    46. (745,'荣耀3C','',589,100,670,671,672,'F3921E12552A4D0AA3F75467B146A959.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    47. (746,'小米手环','',963,100,670,674,675,'72F75A371B0B4C26A7F72FAAEF96FC68.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    48. (747,'华为2265','',896,1000,670,671,673,'161F355A8A8549BA8F7F4CE3B4F07E40.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    49. (748,'越南坚果','',520,1000,660,661,662,'CBC98D3C9E544830821632F5C313D93E.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    50. (749,'日本进口马桶','',5866,100,628,657,0,'A5AF40825E6940B2A59A040100E181A8.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    51. (750,'联想Y系列','',569,1000,670,690,691,'956DB0BEC41B41B8A06C05C950130E23.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    52. (751,'脑白金1号','',589,1000,676,677,680,'66E96AF9E9714A5C9EA901811173D662.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    53. (752,'莫里斯按','',589,1000,676,678,0,'A7436BC607E74C81B392DCFE69D4AEAB.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    54. (753,'三鹿好奶粉','',859,100,676,679,0,'3C465E7B8A324A8DA2A2EEE202E36166.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    55. (754,'儿童牛奶','',5896,100,676,679,0,'D1AC9AE71ED348FA8D880FD4279D3422.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    56. (755,'软沙发','',8596,99,628,696,0,'ED7921DE40FC47E18365754709A21194.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    57. (756,'收纳盒','',5966,100,628,696,0,'DB86CA25CA4F4B4AA906F46BE542C6A6.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    58. (757,'洗衣液','',58,1000,628,696,0,'E6CCDC343ACC471C908E9748776C6421.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    59. (758,'红短沙发','',596,123,628,696,0,'BD5C77465DC2466BBCE7F95FB9764392.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    60. (759,'新西兰奶粉','',5896,100,676,679,0,'9ED375098D42497B8FC33167E06D0EE8.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    61. (760,'婴儿车','',11000,100,681,682,687,'1DBC0930641D43C29D74A9E1B40FEEBB.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    62. (761,'夏款婴儿车','',963,100,681,682,688,'16290C4DBEAC4F00A636667019621468.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    63. (762,'抗压旅行箱','',569,1000,681,683,685,'272CC434BE7A4469AB0E7882BD1A85FF.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    64. (763,'透明手提箱','',8596,1000,681,683,684,'EAA8E66259BF4239B4A2237B62520EF1.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    65. (764,'婴儿果粉','',5896,1000,660,661,662,'08BE30BF7B5F4930B0093D8CC4056057.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    66. (765,'椰子粉','',5963,1000,660,661,662,'9C006B8BD1AD45398F474A8471ADC50B.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    67. (766,'坚果蛋糕','',200,100,660,661,663,'2E5A16E21E0640E0BAE03E9B995DCD28.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    68. (767,'编制手提箱','',5896,1000,681,682,688,'2E1D2A5E65A94FEEA17C72E47C530057.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    69. (768,'纸箱','',5896,100,681,682,687,'443E5A4122064209AFE89250179A2FF0.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    70. (769,'健胃液','',152,1000,676,679,0,'30B5547CD7384DAA8A2F4F4D8C0BBF89.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13'),
    71. (770,'联想NTC','',8596,100,670,671,673,'48BC371A85A548B7A7589E3F542D911D.jpg',1,'2019-9-12 22:11:13','2019-9-12 22:11:13');
    72. INSERT INTO
    73. `category`(`id`,`name`,`parent_id`,`level`,`icon`,`status`,`create_time`,`update_time`) VALUES
    74. (548,'化妆品',0,1,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    75. (628,'家用商品',0,1,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    76. (654,'面部护理',548,2,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    77. (655,'少女派',654,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    78. (656,'餐具',628,2,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    79. (657,'卫具',628,2,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    80. (658,'叉子',656,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    81. (659,'锅',656,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    82. (660,'进口食品,生鲜',0,1,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    83. (661,'零食/糖果/巧克力',660,2,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    84. (662,'坚果',661,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    85. (663,'蜜饯',661,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    86. (669,'孕期教育',546,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    87. (670,'电子商品',0,1,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    88. (671,'手机',670,2,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    89. (672,'华为手机',671,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    90. (673,'联想手机',671,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    91. (674,'手环',670,2,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    92. (675,'小米手环',674,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    93. (676,'保健食品',0,1,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    94. (677,'老年保健品',676,2,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    95. (678,'中年营养品',676,2,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    96. (679,'儿童保健品',676,2,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    97. (680,'脑白金',677,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    98. (681,'箱包',0,1,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    99. (682,'旅行箱',681,2,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    100. (683,'手提箱',681,2,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    101. (684,'大型',683,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    102. (685,'小型',683,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    103. (686,'中型',683,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    104. (687,'大型',682,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    105. (688,'中型',682,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    106. (689,'小型',682,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    107. (690,'电脑',670,2,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    108. (691,'联想电脑',690,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    109. (692,'刀叉',656,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    110. (693,'碗筷',656,3,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22'),
    111. (696,'客厅专用',628,2,'',1,'2019-9-12 21:22:22','2019-9-12 21:22:22');