-- ./product_category.json -- 建库时请用以下语句,支持emoji字符 -- CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; drop table if exists product_category; CREATE TABLE product_category ( `id` VARCHAR(32) NOT NULL comment '主键ID', `parent_id` VARCHAR(32) DEFAULT '0' comment '父类别ID', `name` VARCHAR(255) NOT NULL comment '类别名称', `description` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '类别描述', `has_product` CHAR(1) DEFAULT '0' comment '是否可挂产品', `product_type` VARCHAR(64) comment '产品类型标识', `product_type_title` VARCHAR(255) comment '产品类型显示名', `sort_order` int DEFAULT '0' comment '排序序号', `icon` VARCHAR(255) comment '图标', `status` CHAR(1) DEFAULT '1' comment '状态', `org_id` VARCHAR(32) DEFAULT '0' comment '所属机构ID', `created_by` VARCHAR(32) comment '创建人', `created_at` datetime NOT NULL comment '创建时间', `updated_at` datetime NOT NULL comment '更新时间' ,primary key(id) ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci engine=innodb comment '产品类别树' ; CREATE INDEX product_category_idx_pc_org_parent ON product_category(org_id,parent_id); CREATE INDEX product_category_idx_pc_org_status ON product_category(org_id,status); CREATE INDEX product_category_idx_pc_org_type ON product_category(org_id,product_type); -- ./product.json -- 建库时请用以下语句,支持emoji字符 -- CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; drop table if exists product; CREATE TABLE product ( `id` VARCHAR(32) NOT NULL comment '主键ID', `category_id` VARCHAR(32) NOT NULL comment '类别ID', `product_code` VARCHAR(64) NOT NULL comment '产品编码', `product_name` VARCHAR(255) NOT NULL comment '产品名称', `product_type` VARCHAR(64) NOT NULL comment '产品类型标识', `brief_intro` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '产品简介', `detail_intro` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '产品详情', `extra_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '扩展属性', `enabled_date` date comment '启用日期', `expired_date` date comment '失效日期', `status` CHAR(1) DEFAULT '1' comment '状态', `price_type` CHAR(1) DEFAULT '1' comment '价格类型', `price` double(15,2) DEFAULT '0.00' comment '价格', `currency` CHAR(8) DEFAULT 'CNY' comment '货币', `sort_order` int DEFAULT '0' comment '排序序号', `org_id` VARCHAR(32) DEFAULT '0' comment '所属机构ID', `created_by` VARCHAR(32) comment '创建人', `created_at` datetime NOT NULL comment '创建时间', `updated_at` datetime NOT NULL comment '更新时间' ,primary key(id) ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci engine=innodb comment '产品注册表' ; CREATE INDEX product_idx_product_org_category ON product(org_id,category_id); CREATE UNIQUE INDEX product_idx_product_org_code ON product(org_id,product_code); CREATE INDEX product_idx_product_org_type ON product(org_id,product_type); CREATE INDEX product_idx_product_status ON product(status); CREATE INDEX product_idx_product_enabled_expired ON product(enabled_date,expired_date); -- ./product_type_config.json -- 建库时请用以下语句,支持emoji字符 -- CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; drop table if exists product_type_config; CREATE TABLE product_type_config ( `id` VARCHAR(32) NOT NULL comment '主键ID', `operator_id` VARCHAR(32) NOT NULL comment '运营商用户ID', `org_id` VARCHAR(32) NOT NULL comment '所属机构ID', `category_id` VARCHAR(32) NOT NULL comment '产品类别ID', `config_name` VARCHAR(255) NOT NULL comment '配置名称', `config_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '配置内容', `enabled_flg` CHAR(1) DEFAULT '1' comment '是否启用', `created_by` VARCHAR(32) comment '创建人', `created_at` datetime NOT NULL comment '创建时间', `updated_at` datetime NOT NULL comment '更新时间' ,primary key(id) ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci engine=innodb comment '运营商产品类型配置' ; CREATE INDEX product_type_config_idx_ptc_org_opr ON product_type_config(org_id,operator_id); CREATE UNIQUE INDEX product_type_config_idx_ptc_org_cat ON product_type_config(org_id,operator_id,category_id,config_name); CREATE INDEX product_type_config_idx_ptc_enabled ON product_type_config(enabled_flg);