cyywl_server/sql/mall.sql

288 lines
16 KiB
Java
Raw Normal View History

2022-04-24 14:42:51 +08:00
/*
Navicat Premium Data Transfer
Source Server : 127.0.0.1
Source Server Type : MySQL
Source Server Version : 80026
Source Host : localhost:3306
Source Schema : ruoyi-vue-pro
Target Server Type : MySQL
Target Server Version : 80026
File Encoding : 65001
Date: 05/02/2022 00:50:30
*/
SET
FOREIGN_KEY_CHECKS = 0;
SET NAMES utf8mb4;
-- ----------------------------
-- Table structure for product_category
-- ----------------------------
DROP TABLE IF EXISTS `product_category`;
CREATE TABLE `product_category`
(
2022-05-18 16:53:55 +08:00
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '',
`parent_id` bigint NOT NULL COMMENT '',
`name` varchar(255) NOT NULL COMMENT '',
`icon` varchar(100) NOT NULL DEFAULT '#' COMMENT '',
`banner_url` varchar(255) NOT NULL COMMENT '',
`sort` int DEFAULT '0' COMMENT '',
`description` varchar(1024) DEFAULT NULL COMMENT '',
`status` tinyint NOT NULL COMMENT '',
`creator` varchar(64) DEFAULT '' COMMENT '',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updater` varchar(64) DEFAULT '' COMMENT '',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '',
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '',
2022-04-24 14:42:51 +08:00
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='';
2022-04-25 16:11:30 +08:00
-- ----------------------------
-- Table structure for product_brand
-- ----------------------------
DROP TABLE IF EXISTS `product_brand`;
CREATE TABLE `product_brand`
(
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '',
`category_id` bigint NOT NULL COMMENT '',
`name` varchar(255) NOT NULL COMMENT '',
`banner_url` varchar(255) NOT NULL COMMENT '',
`sort` int DEFAULT '0' COMMENT '',
`description` varchar(1024) DEFAULT NULL COMMENT '',
`status` tinyint NOT NULL COMMENT '',
`creator` varchar(64) DEFAULT '' COMMENT '',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updater` varchar(64) DEFAULT '' COMMENT '',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '',
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='';
2022-05-12 16:57:33 +08:00
-- TODO id : 2000 2001
2022-05-18 16:53:55 +08:00
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES (2000, '', '', 1, 1, 0, '/mall', 'merchant', NULL, 0);
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES (2001, '', '', 1, 1, 2000, 'product', 'dict', NULL, 0);
2022-04-25 16:11:30 +08:00
-- SQL
2022-05-18 16:53:55 +08:00
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('', '', 2, 0, 2001, 'category', '', 'mall/product/category/index', 0);
2022-04-24 14:42:51 +08:00
-- ID
SELECT @parentId := LAST_INSERT_ID();
-- SQL
2022-05-18 16:53:55 +08:00
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('', 'product:category:query', 3, 1, @parentId, '', '', '', 0);
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('', 'product:category:create', 3, 2, @parentId, '', '', '', 0);
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('', 'product:category:update', 3, 3, @parentId, '', '', '', 0);
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('', 'product:category:delete', 3, 4, @parentId, '', '', '', 0);
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('', 'product:category:export', 3, 5, @parentId, '', '', '', 0);
2022-04-25 16:11:30 +08:00
-- SQL
2022-05-18 16:53:55 +08:00
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('', '', 2, 1, 2001, 'brand', '', 'mall/product/brand/index', 0);
2022-04-25 16:11:30 +08:00
-- ID
SELECT @parentId := LAST_INSERT_ID();
-- SQL
2022-05-18 16:53:55 +08:00
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('', 'product:brand:query', 3, 1, @parentId, '', '', '', 0);
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('', 'product:brand:create', 3, 2, @parentId, '', '', '', 0);
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('', 'product:brand:update', 3, 3, @parentId, '', '', '', 0);
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('', 'product:brand:delete', 3, 4, @parentId, '', '', '', 0);
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('', 'product:brand:export', 3, 5, @parentId, '', '', '', 0);
2022-04-28 16:18:57 +08:00
-- ----------------------------
-- Table structure for market_activity
-- ----------------------------
DROP TABLE IF EXISTS `market_activity`;
2022-05-18 16:53:55 +08:00
CREATE TABLE `market_activity`
(
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '',
`title` varchar(50) NOT NULL DEFAULT '' COMMENT '',
`activity_type` tinyint(4) NOT NULL COMMENT '',
`status` tinyint(4) NOT NULL DEFAULT '-1' COMMENT '',
`start_time` datetime NOT NULL COMMENT '',
`end_time` datetime NOT NULL COMMENT '',
`invalid_time` datetime DEFAULT NULL COMMENT '',
`delete_time` datetime DEFAULT NULL COMMENT '',
`time_limited_discount` varchar(2000) DEFAULT NULL COMMENT '使 JSON ',
`full_privilege` varchar(2000) DEFAULT NULL COMMENT '使 JSON ',
`creator` varchar(64) DEFAULT '' COMMENT '',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updater` varchar(64) DEFAULT '' COMMENT '',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '',
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '',
PRIMARY KEY (`id`) USING BTREE
2022-05-17 21:18:56 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='';
2022-05-18 16:53:55 +08:00
-- SQL
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
2022-05-18 17:12:03 +08:00
VALUES ('', '', 2, 3, 2001, 'property', '', 'mall/product/property/index', 0);
2022-05-18 16:53:55 +08:00
-- ID
SELECT @parentId := LAST_INSERT_ID();
-- SQL
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('', 'product:property:query', 3, 1, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('', 'product:property:create', 3, 2, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('', 'product:property:update', 3, 3, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('', 'product:property:delete', 3, 4, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('', 'product:property:export', 3, 5, @parentId, '', '', '', 0);
-- SQL
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
2022-05-18 17:12:03 +08:00
VALUES ('', '', 2, 2, 2001, 'spu', '', 'mall/product/spu/index', 0);
2022-05-18 16:53:55 +08:00
-- ID
SELECT @parentId := LAST_INSERT_ID();
-- SQL
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('', 'product:spu:query', 3, 1, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('', 'product:spu:create', 3, 2, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('', 'product:spu:update', 3, 3, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('', 'product:spu:delete', 3, 4, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('', 'product:spu:export', 3, 5, @parentId, '', '', '', 0);
2022-05-17 22:16:48 +08:00
2022-05-17 21:18:56 +08:00
--
2022-05-17 22:16:48 +08:00
drop table if exists product_property;
create table product_property
2022-05-17 21:18:56 +08:00
(
id bigint NOT NULL AUTO_INCREMENT comment '',
2022-05-17 22:16:48 +08:00
name varchar(64) comment '',
status tinyint comment ' 0 1 ',
create_time datetime default current_timestamp comment '',
update_time datetime default current_timestamp on update current_timestamp comment '',
2022-05-17 21:18:56 +08:00
creator varchar(64) comment '',
updater varchar(64) comment '',
2022-05-17 22:16:48 +08:00
tenant_id bigint NOT NULL DEFAULT '0' COMMENT '',
deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '',
2022-05-17 21:18:56 +08:00
primary key (id),
2022-05-18 16:53:55 +08:00
key idx_name ( name (32)) comment ''
2022-05-17 21:18:56 +08:00
) comment '' character set utf8mb4
collate utf8mb4_general_ci;
--
2022-05-17 22:16:48 +08:00
drop table if exists product_property_value;
create table product_property_value
2022-05-17 21:18:56 +08:00
(
id bigint NOT NULL AUTO_INCREMENT COMMENT '',
2022-05-17 22:16:48 +08:00
property_id bigint comment 'id',
name varchar(128) comment '',
status tinyint comment ' 1 2 ',
create_time datetime default current_timestamp comment '',
update_time datetime default current_timestamp on update current_timestamp comment '',
creator varchar(64) comment '',
updater varchar(64) comment '',
tenant_id bigint NOT NULL DEFAULT '0' COMMENT '',
deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '',
2022-05-17 21:18:56 +08:00
primary key (id)
) comment '' character set utf8mb4
collate utf8mb4_general_ci;
-- spu
drop table if exists product_spu;
create table product_spu
(
id bigint NOT NULL AUTO_INCREMENT COMMENT '',
2022-05-17 22:16:48 +08:00
name varchar(128) comment '',
sell_point varchar(128) not null comment '',
description text not null comment '',
category_id bigint not null comment 'id',
pic_urls varchar(1024) not null default '' comment '\n *\n * \n 15',
sort int not null default 0 comment '',
like_count int comment '',
price int comment ' 使',
quantity int comment '',
status bit(1) comment ' 0 1 ',
create_time datetime default current_timestamp comment '',
update_time datetime default current_timestamp on update current_timestamp comment '',
creator varchar(64) comment '',
updater varchar(64) comment '',
tenant_id bigint NOT NULL DEFAULT '0' COMMENT '',
deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '',
2022-05-17 21:18:56 +08:00
primary key (id)
) comment 'spu' character set utf8mb4
collate utf8mb4_general_ci;
-- sku
drop table if exists product_sku;
create table product_sku
(
id bigint NOT NULL AUTO_INCREMENT COMMENT '',
2022-05-17 22:16:48 +08:00
spu_id bigint not null comment 'spu',
properties varchar(64) not null comment '-json [{propertId: , valueId: }, {propertId: , valueId: }]',
2022-05-17 21:18:56 +08:00
price int not null DEFAULT -1 comment '',
original_price int not null DEFAULT -1 comment ' ',
cost_price int not null DEFAULT -1 comment ' ',
bar_code varchar(64) not null comment '',
pic_url VARCHAR(128) not null comment '',
2022-05-17 22:16:48 +08:00
status tinyint comment ' 0- 1-',
create_time datetime default current_timestamp comment '',
update_time datetime default current_timestamp on update current_timestamp comment '',
creator varchar(64) comment '',
updater varchar(64) comment '',
tenant_id bigint NOT NULL DEFAULT '0' COMMENT '',
deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '',
2022-05-17 21:18:56 +08:00
primary key (id)
) comment 'sku' character set utf8mb4
2022-05-17 22:16:48 +08:00
collate utf8mb4_general_ci;
2022-05-31 16:08:10 +08:00
---Market-BannerSQL
drop table if exists market_banner;
CREATE TABLE `market_banner` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Banner',
`title` varchar(64) NOT NULL DEFAULT '' COMMENT 'Banner',
`pic_url` varchar(255) NOT NULL COMMENT 'URL',
`status` tinyint(4) NOT NULL DEFAULT '-1' COMMENT '',
`url` varchar(255) NOT NULL COMMENT '',
`creator` varchar(64) DEFAULT '' COMMENT '',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updater` varchar(64) DEFAULT '' COMMENT '',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '',
`tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '',
`sort` tinyint(4) DEFAULT NULL COMMENT '',
`memo` varchar(255) DEFAULT NULL COMMENT '',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='Banner';
-- SQL
INSERT INTO `system_menu`(`id`,`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES (2002, 'Banner', '', 2, 1, 2000, 'brand', '', 'mall/market/banner/index', 0);
-- ID
SELECT @parentId := LAST_INSERT_ID();
-- SQL
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('Banner', 'market:banner:query', 3, 1, @parentId, '', '', '', 0);
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('Banner', 'market:banner:create', 3, 2, @parentId, '', '', '', 0);
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('Banner', 'market:banner:update', 3, 3, @parentId, '', '', '', 0);
INSERT INTO `system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`)
VALUES ('Banner', 'market:banner:delete', 3, 4, @parentId, '', '', '', 0);