mall.sql 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /*
  2. Navicat Premium Data Transfer
  3. Source Server : 127.0.0.1
  4. Source Server Type : MySQL
  5. Source Server Version : 80026
  6. Source Host : localhost:3306
  7. Source Schema : ruoyi-vue-pro
  8. Target Server Type : MySQL
  9. Target Server Version : 80026
  10. File Encoding : 65001
  11. Date: 05/02/2022 00:50:30
  12. */
  13. SET
  14. FOREIGN_KEY_CHECKS = 0;
  15. SET NAMES utf8mb4;
  16. -- ----------------------------
  17. -- Table structure for product_category
  18. -- ----------------------------
  19. -- ----------------------------
  20. -- Table structure for product_brand
  21. -- ----------------------------
  22. -- ----------------------------
  23. -- Table structure for market_activity
  24. -- ----------------------------
  25. DROP TABLE IF EXISTS `market_activity`;
  26. CREATE TABLE `market_activity`
  27. (
  28. `id` bigint NOT NULL AUTO_INCREMENT COMMENT '活动编号',
  29. `title` varchar(50) NOT NULL DEFAULT '' COMMENT '活动标题',
  30. `activity_type` tinyint(4) NOT NULL COMMENT '活动类型',
  31. `status` tinyint(4) NOT NULL DEFAULT '-1' COMMENT '活动状态',
  32. `start_time` datetime NOT NULL COMMENT '开始时间',
  33. `end_time` datetime NOT NULL COMMENT '结束时间',
  34. `invalid_time` datetime DEFAULT NULL COMMENT '失效时间',
  35. `delete_time` datetime DEFAULT NULL COMMENT '删除时间',
  36. `time_limited_discount` varchar(2000) DEFAULT NULL COMMENT '限制折扣字符串,使用 JSON 序列化成字符串存储',
  37. `full_privilege` varchar(2000) DEFAULT NULL COMMENT '限制折扣字符串,使用 JSON 序列化成字符串存储',
  38. `creator` varchar(64) DEFAULT '' COMMENT '创建者',
  39. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  40. `updater` varchar(64) DEFAULT '' COMMENT '更新者',
  41. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  42. `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  43. `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
  44. PRIMARY KEY (`id`) USING BTREE
  45. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='促销活动';
  46. -- 规格菜单 SQL
  47. INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
  48. VALUES ('规格管理', '', 2, 3, 2001, 'property', '', 'mall/product/property/index', 0);
  49. -- 按钮父菜单ID
  50. SELECT @parentId := LAST_INSERT_ID();
  51. -- 按钮 SQL
  52. INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
  53. VALUES ('规格查询', 'product:property:query', 3, 1, @parentId, '', '', '', 0);
  54. INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
  55. VALUES ('规格创建', 'product:property:create', 3, 2, @parentId, '', '', '', 0);
  56. INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
  57. VALUES ('规格更新', 'product:property:update', 3, 3, @parentId, '', '', '', 0);
  58. INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
  59. VALUES ('规格删除', 'product:property:delete', 3, 4, @parentId, '', '', '', 0);
  60. INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
  61. VALUES ('规格导出', 'product:property:export', 3, 5, @parentId, '', '', '', 0);
  62. -- 商品菜单 SQL
  63. INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
  64. VALUES ('商品管理', '', 2, 2, 2001, 'spu', '', 'mall/product/spu/index', 0);
  65. -- 按钮父菜单ID
  66. SELECT @parentId := LAST_INSERT_ID();
  67. -- 按钮 SQL
  68. INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
  69. VALUES ('商品查询', 'product:spu:query', 3, 1, @parentId, '', '', '', 0);
  70. INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
  71. VALUES ('商品创建', 'product:spu:create', 3, 2, @parentId, '', '', '', 0);
  72. INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
  73. VALUES ('商品更新', 'product:spu:update', 3, 3, @parentId, '', '', '', 0);
  74. INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
  75. VALUES ('商品删除', 'product:spu:delete', 3, 4, @parentId, '', '', '', 0);
  76. INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
  77. VALUES ('商品导出', 'product:spu:export', 3, 5, @parentId, '', '', '', 0);
  78. -- 规格名称表
  79. drop table if exists product_property;
  80. create table product_property
  81. (
  82. id bigint NOT NULL AUTO_INCREMENT comment '主键',
  83. name varchar(64) comment '规格名称',
  84. status tinyint comment '状态: 0 开启 ,1 禁用',
  85. create_time datetime default current_timestamp comment '创建时间',
  86. update_time datetime default current_timestamp on update current_timestamp comment '更新时间',
  87. creator varchar(64) comment '创建人',
  88. updater varchar(64) comment '更新人',
  89. tenant_id bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
  90. deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  91. primary key (id),
  92. key idx_name ( name (32)) comment '规格名称索引'
  93. ) comment '规格名称' character set utf8mb4
  94. collate utf8mb4_general_ci;
  95. -- 规格值表
  96. drop table if exists product_property_value;
  97. create table product_property_value
  98. (
  99. id bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  100. property_id bigint comment '规格键id',
  101. name varchar(128) comment '规格值名字',
  102. status tinyint comment '状态: 1 开启 ,2 禁用',
  103. create_time datetime default current_timestamp comment '创建时间',
  104. update_time datetime default current_timestamp on update current_timestamp comment '更新时间',
  105. creator varchar(64) comment '创建人',
  106. updater varchar(64) comment '更新人',
  107. tenant_id bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
  108. deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  109. primary key (id)
  110. ) comment '规格值' character set utf8mb4
  111. collate utf8mb4_general_ci;
  112. -- spu
  113. drop table if exists product_spu;
  114. create table product_spu
  115. (
  116. id bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  117. name varchar(128) comment '商品名称',
  118. sell_point varchar(128) not null comment '卖点',
  119. description text not null comment '描述',
  120. category_id bigint not null comment '分类id',
  121. pic_urls varchar(1024) not null default '' comment '商品主图地址\n *\n * 数组,以逗号分隔\n 最多上传15张',
  122. sort int not null default 0 comment '排序字段',
  123. like_count int comment '点赞初始人数',
  124. price int comment '价格 单位使用:分',
  125. quantity int comment '库存数量',
  126. status bit(1) comment '上下架状态: 0 上架(开启) 1 下架(禁用)',
  127. create_time datetime default current_timestamp comment '创建时间',
  128. update_time datetime default current_timestamp on update current_timestamp comment '更新时间',
  129. creator varchar(64) comment '创建人',
  130. updater varchar(64) comment '更新人',
  131. tenant_id bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
  132. deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  133. primary key (id)
  134. ) comment '商品spu' character set utf8mb4
  135. collate utf8mb4_general_ci;
  136. -- sku
  137. drop table if exists product_sku;
  138. create table product_sku
  139. (
  140. id bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  141. spu_id bigint not null comment 'spu编号',
  142. properties varchar(64) not null comment '规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]',
  143. price int not null DEFAULT -1 comment '销售价格,单位:分',
  144. original_price int not null DEFAULT -1 comment '原价, 单位: 分',
  145. cost_price int not null DEFAULT -1 comment '成本价,单位: 分',
  146. bar_code varchar(64) not null comment '条形码',
  147. pic_url VARCHAR(128) not null comment '图片地址',
  148. status tinyint comment '状态: 0-正常 1-禁用',
  149. create_time datetime default current_timestamp comment '创建时间',
  150. update_time datetime default current_timestamp on update current_timestamp comment '更新时间',
  151. creator varchar(64) comment '创建人',
  152. updater varchar(64) comment '更新人',
  153. tenant_id bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
  154. deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  155. primary key (id)
  156. ) comment '商品sku' character set utf8mb4
  157. collate utf8mb4_general_ci;
  158. ---Market-Banner管理SQL
  159. drop table if exists market_banner;
  160. CREATE TABLE `market_banner` (
  161. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Banner编号',
  162. `title` varchar(64) NOT NULL DEFAULT '' COMMENT 'Banner标题',
  163. `pic_url` varchar(255) NOT NULL COMMENT '图片URL',
  164. `status` tinyint(4) NOT NULL DEFAULT '-1' COMMENT '活动状态',
  165. `url` varchar(255) NOT NULL COMMENT '跳转地址',
  166. `creator` varchar(64) DEFAULT '' COMMENT '创建者',
  167. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  168. `updater` varchar(64) DEFAULT '' COMMENT '更新者',
  169. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  170. `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  171. `tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号',
  172. `sort` tinyint(4) DEFAULT NULL COMMENT '排序',
  173. `memo` varchar(255) DEFAULT NULL COMMENT '描述',
  174. PRIMARY KEY (`id`) USING BTREE
  175. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='Banner管理';
  176. -- 菜单 SQL
  177. INSERT INTO `system_menu`(`id`,`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
  178. VALUES (2002, 'Banner管理', '', 2, 1, 2000, 'brand', '', 'mall/market/banner/index', 0);
  179. -- 按钮父菜单ID
  180. SELECT @parentId := LAST_INSERT_ID();
  181. -- 按钮 SQL
  182. INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
  183. VALUES ('Banner查询', 'market:banner:query', 3, 1, @parentId, '', '', '', 0);
  184. INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
  185. VALUES ('Banner创建', 'market:banner:create', 3, 2, @parentId, '', '', '', 0);
  186. INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
  187. VALUES ('Banner更新', 'market:banner:update', 3, 3, @parentId, '', '', '', 0);
  188. INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
  189. VALUES ('Banner删除', 'market:banner:delete', 3, 4, @parentId, '', '', '', 0);