/*!40101 SET NAMES utf8mb4 */;

/*!40101 SET SQL_MODE=''*/;

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`mall4cloud_flow` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;

USE `mall4cloud_flow`;

/*Table structure for table `form` */

DROP TABLE IF EXISTS `form`;

CREATE TABLE `form` (
    `form_id` BIGINT NOT NULL AUTO_INCREMENT,
    `shop_id` BIGINT DEFAULT NULL COMMENT '店铺Id',
    `form_name` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '报表名称',
    `content` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '推荐报表介绍内容',
    `from_type` TINYINT DEFAULT NULL COMMENT '报表类型 1:店铺报表  2：商品报表',
    `time_type` TINYINT DEFAULT NULL COMMENT '时间类型 1:天 2:周 3:月',
    `time_format` TINYINT DEFAULT NULL COMMENT '时间格式 1:固定时间区间 2:指定时间范围',
    `form_item_ids` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '报表项id数组',
    `start_time` DATETIME DEFAULT NULL COMMENT '开始时间（固定时间区间）',
    `end_time` DATETIME DEFAULT NULL COMMENT '结束时间（固定时间区间）',
    `time_range` INT DEFAULT NULL COMMENT '时间范围 1:近1天  2:近7天  3: 近30天',
    `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `seq` INT DEFAULT NULL COMMENT '序号',
    PRIMARY KEY (`form_id`),
    KEY `shop_idx`(`shop_id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='数据表格';


/*Data for the table `form` */

INSERT  INTO `form`(`form_id`,`shop_id`,`form_name`,`content`,`from_type`,`time_type`,`time_format`,`form_item_ids`,`start_time`,`end_time`,`time_range`,`create_time`,`update_time`,`seq`) VALUES
(1,NULL,'店铺销售周报','店铺经营每周必看数据，提供近8个自然周的流量关键指标、交易关键指标、转化关键指标、服务关键指标，帮助监控店铺运营状况。\n',1,2,2,'1,2,9,11,13,15','2023-02-13 00:00:00','2023-02-13 00:00:00',8,'2023-02-13 10:56:39','2023-02-13 10:56:39',2),
(2,NULL,'店铺销售月报','店铺经营每月必看数据，提供近6个自然月的流量关键指标、交易关键指标、转化关键指标、服务关键指标，帮助监控店铺运营状况。\n',1,3,2,'1,2,9,11,13,15','2023-02-13 00:00:00','2023-02-13 00:00:00',6,'2023-02-13 15:56:51','2023-02-13 15:56:51',3),
(3,NULL,'店铺销售日报','店铺经营每日必看数据，提供近30个自然日的流量关键指标、交易关键指标、转化关键指标、服务关键指标，帮助监控店铺运营状况。\n',1,1,2,'1,2,9,11,13,15','2023-02-13 00:00:00','2023-02-13 00:00:00',30,'2023-02-13 17:04:57','2023-02-13 14:50:52',1),
(4,NULL,'用户下单日报','店铺经营每日必看数据，提供近30个自然日的店铺交易金额关键指标、用户提交订单关键指标、用户提交订单商品关键指标、下单用户关键指标，帮助监控自营店铺运营状况。',1,1,2,'1,2,7,8,9,10','2023-02-13 00:00:00','2023-02-13 00:00:00',30,'2023-02-13 11:00:38','2023-02-13 11:00:38',4),
(5,NULL,'用户下单周报','店铺经营每周必看数据，提供近8个自然周的店铺交易金额关键指标、用户提交订单关键指标、用户提交订单商品关键指标、下单用户关键指标，帮助监控店铺运营状况。',1,2,2,'1,2,7,8,9,10','2023-02-13 00:00:00','2023-02-13 00:00:00',8,'2023-02-13 11:05:25','2023-02-13 11:05:25',5),
(6,NULL,'用户下单月报','店铺经营每月必看数据，提供近6个自然月的店铺交易金额关键指标、用户提交订单关键指标、用户提交订单商品关键指标、下单用户关键指标，帮助监控店铺运营状况。',1,3,2,'1,2,7,8,9,10','2023-02-13 00:00:00','2023-02-13 00:00:00',6,'2023-02-13 11:06:40','2023-02-13 11:06:40',6),
(7,NULL,'店铺交易日报','店铺经营每日必看数据，提供近30个自然日的支付订单关键指标、支付商品关键指标、支付用户数量关键指标，帮助监控店铺运营状况。',1,1,2,'1,11,12,13,14','2023-02-13 00:00:00','2023-02-13 00:00:00',30,'2023-02-13 11:20:46','2023-02-13 11:20:46',7),
(8,NULL,'店铺交易周报','店铺经营每周必看数据，提供近8个自然周的支付订单关键指标、支付商品关键指标、支付用户数量关键指标，帮助监控店铺运营状况。',1,2,2,'1,11,12,13,14','2023-02-13 00:00:00','2023-02-13 00:00:00',8,'2023-02-13 11:22:43','2023-02-13 11:22:43',8),
(9,NULL,'店铺交易月报','店铺经营每月必看数据，提供近6个自然月的支付订单关键指标、支付商品关键指标、支付用户数量关键指标，帮助监控店铺运营状况。',1,3,2,'1,11,12,13,14','2023-02-13 00:00:00','2023-02-13 00:00:00',6,'2023-02-13 11:23:28','2023-02-13 14:13:57',9),
(10,NULL,'店铺订单日报','店铺经营每日必看数据，提供近30个自然日的下单关键指标、下单商品数量关键指标、支付关键指标、支付商品数量关键指标、下单用户关键指标、支付用户关键指标，帮助监控店铺运营状况。',1,1,2,'7,8,9,10,11,12,13,14,17','2023-02-13 00:00:00','2023-02-13 00:00:00',30,'2023-02-13 11:26:48','2023-02-13 11:26:48',10),
(11,NULL,'店铺订单周报','店铺经营每周必看数据，提供近8个自然周的下单关键指标、下单商品数量关键指标、支付关键指标、支付商品数量关键指标、下单用户关键指标、支付用户关键指标，帮助监控店铺运营状况。',1,2,2,'7,8,9,10,11,12,13,14,17','2023-02-13 00:00:00','2023-02-13 00:00:00',8,'2023-02-13 11:27:28','2023-02-13 11:27:28',11),
(12,NULL,'店铺订单月报','店铺经营每月必看数据，提供近8个自然月的下单关键指标、下单商品数量关键指标、支付关键指标、支付商品数量关键指标、下单用户关键指标、支付用户关键指标，帮助监控店铺运营状况。',1,3,2,'7,8,9,10,11,12,13,14,17','2023-02-13 00:00:00','2023-02-13 00:00:00',6,'2023-02-13 14:10:56','2023-02-13 14:13:30',12);



/*Table structure for table `leaf_alloc` */

CREATE TABLE IF NOT EXISTS `leaf_alloc` (
  `biz_tag` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '区分业务',
  `max_id` bigint unsigned NOT NULL DEFAULT '1' COMMENT '该biz_tag目前所被分配的ID号段的最大值',
  `step` int NOT NULL COMMENT '每次分配的号段长度',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `description` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '描述',
  PRIMARY KEY (`biz_tag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

/*Data for the table `leaf_alloc` */

insert into `leaf_alloc` (`biz_tag`, `max_id`, `step`, `description`) values
('mall4cloud-flow-user-id','1','1000','用户操作编号');

/*Table structure for table `undo_log` */

DROP TABLE IF EXISTS `undo_log`;

CREATE TABLE `undo_log` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `branch_id` bigint NOT NULL,
  `xid` varchar(100) NOT NULL,
  `context` varchar(128) NOT NULL,
  `rollback_info` longblob NOT NULL,
  `log_status` int NOT NULL,
  `log_created` datetime NOT NULL,
  `log_modified` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;



/*Data for the table `undo_log` */

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
