/*!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*/`tmerclub_biz` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;

USE `tmerclub_biz`;

/*Table structure for table `attach_file` */

DROP TABLE IF EXISTS `attach_file`;

CREATE TABLE `attach_file` (
  `file_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `file_path` varchar(255) DEFAULT NULL COMMENT '文件路径',
  `file_type` varchar(20) DEFAULT NULL COMMENT '文件类型',
  `file_name` varchar(255) DEFAULT NULL COMMENT '文件名',
  `file_size` int(11) DEFAULT NULL COMMENT '文件大小',
  `shop_id` bigint(20) DEFAULT NULL COMMENT '店铺id',
  `uid` bigint UNSIGNED NULL DEFAULT NULL COMMENT '用户uid',
  `type` tinyint(4) DEFAULT NULL COMMENT '文件 1:图片 2:视频 3:文件',
  `attach_file_group_id` bigint(20) DEFAULT '0' COMMENT '文件分组id',
  `sys_type` tinyint DEFAULT '0' COMMENT '关联系统类型 1.店铺 2.平台端 3.供应商',
  PRIMARY KEY (`file_id`),
  KEY `group_idx`(`attach_file_group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='上传文件记录表';

/*Data for the table `attach_file` */

/*Table structure for table `attach_file_group` */

DROP TABLE IF EXISTS `attach_file_group`;

CREATE TABLE `attach_file_group` (
  `attach_file_group_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `shop_id` bigint(20) NOT NULL COMMENT '店铺id',
  `uid` bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '用户uid',
  `name` varchar(30) NOT NULL COMMENT '分组名称',
  `type` tinyint(4) NOT NULL COMMENT '1:图片 2:视频 3:文件',
  `sys_type` tinyint DEFAULT NULL COMMENT '用户类型见SysTypeEnum 0.普通用户系统 1.商家端 2平台端 3供应商端',
  PRIMARY KEY (`attach_file_group_id`),
  KEY `shop_idx`(`shop_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

/*Data for the table `attach_file_group` */

/*Table structure for table `notify_log` */

DROP TABLE IF EXISTS `notify_log`;

CREATE TABLE `notify_log` (
  `log_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '消息记录表',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `nick_name` varchar(255) DEFAULT NULL COMMENT '用户昵称or手机号',
  `user_mobile` varchar(36) DEFAULT NULL COMMENT '发送手机号',
  `remind_id` varchar(36) DEFAULT NULL COMMENT '通知的用户id',
  `shop_id` bigint(20) DEFAULT NULL COMMENT '选择发送的店铺id',
  `shop_name` varchar(50) DEFAULT NULL COMMENT '店铺名称',
  `biz_id` bigint(20) DEFAULT NULL COMMENT '关联的订单id(等级)',
  `spu_id` bigint  DEFAULT NULL COMMENT '关联的商品id' ,
  `activity_id` bigint   DEFAULT NULL COMMENT '关联的营销活动id',
  `remind_type` tinyint(4) DEFAULT NULL COMMENT '通知类型 1.短信发送 2.公众号订阅消息 3.站内消息',
  `template_id` bigint(20) DEFAULT NULL COMMENT '通知模板',
  `send_type` int(11) DEFAULT NULL COMMENT '1.订单催付 2.付款成功通知 3.商家同意退款 4.商家拒绝退款 5.核销提醒 6.发货提醒 7.拼团失败提醒 8.拼团成功提醒 9.拼团开团提醒 10.会员升级提醒 101.退款临近超时提醒 102.确认收货提醒 103.买家发起退款提醒 104.买家已退货提醒',
  `message` varchar(255) DEFAULT NULL COMMENT '通知内容',
  `status` tinyint(4) DEFAULT NULL COMMENT '是否阅读 1已读 0未读',
  PRIMARY KEY (`log_id`),
  KEY `shop_idx`(`shop_id`),
  KEY `remind_idx`(`remind_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

/*Data for the table `notify_log` */

/*Table structure for table `notify_template` */

DROP TABLE IF EXISTS `notify_template`;

CREATE TABLE `notify_template` (
  `template_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '消息模板表',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `send_type` int(11) DEFAULT NULL COMMENT '1.订单催付 2.付款成功通知 3.商家同意退款 4.商家拒绝退款 5.核销提醒  6.发货提醒  7.拼团失败提醒 8.拼团成功提醒 9.拼团开团提醒 10.会员升级提醒\r\n11.退款临近超时提醒 102.确认收货提醒 103.买家发起退款提醒 104.买家已退货提醒',
  `message` varchar(255) DEFAULT NULL COMMENT '短信（站内信）通知内容',
  `notify_types` varchar(20) DEFAULT NULL COMMENT '通知方式集合用逗号分隔 1.短信 2.公众号 3.站内消息',
  `template_code` varchar(255) DEFAULT NULL COMMENT '短信模板code',
  `mp_code` varchar(255)  DEFAULT NULL COMMENT '公众号消息模板code',
  `msg_type` tinyint(4) DEFAULT '2' COMMENT '0.自定义消息 1.为全部发送给用户消息，2.为发送给商家的 3发送给供应商',
  `status` tinyint(4) DEFAULT '1' COMMENT '1启用 0禁用',
  PRIMARY KEY (`template_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

/*Data for the table `notify_template` */

insert  into `notify_template`(`template_id`,`create_time`,`update_time`,`send_type`,`message`,`notify_types`,`template_code`,`mp_code`,`msg_type`,`status`) values
(1,'2020-07-01 16:43:54','2021-07-03 11:27:18',1,'嗨！你要购买的${prodName}还没付款哦，店家为你预留到${cancelTime}，再不付款宝贝就被别人买走啦。','3,2,1','SMS_194640235','yHu6t_qVIMQ_JPcRP2CULk1WIvW2oLn0CX7Rf5H0lHw',1,1),
(2,'2020-07-01 16:45:57','2021-07-03 11:27:19',2,'支付成功通知，你在${shopName}购买的订单:${orderNumber}已支付成功。','1,3,2','SMS_194026865','71wZEJCZ3LbOArCbbAbvUZ-yiO6dH_RbJqBTWhLRnmQ',1,1),
(3,'2020-07-01 16:46:22','2021-07-03 11:27:20',3,'您的退款申请已被同意，订单编号${orderNumber}，请您在${day}天内进行退款操作，逾期未操作申请将被撤销。','1,2,3','SMS_194610244','U25RS8jhr9eWXxgKXO3SlPogCSFbTQx9F7gI9XU708w',1,1),
(4,'2020-07-01 16:46:52','2021-07-03 11:27:21',4,'很抱歉，你的退款申请未被同意，订单编号${orderNumber}，请你在${day}天内联系商家并修改申请。','1,2,3','SMS_194640242','fE88xr9ww5Qk605AyqoUPbxTwfz2QRyJqR7pZf1Or98',1,1),
(5,'2020-07-01 16:47:06','2021-07-03 11:27:21',5,'尊敬的客户，您的订单${orderNumber}已在${stationName}提货成功。谢谢支持！','1,2,3','SMS_199773902','4MX1pGyi2wKhz0raIK-3Nux0RdEB5PUH_dVBsHTVhHk',1,1),
(6,'2020-07-01 16:48:02','2021-07-03 11:27:22',6,'您购买的订单编号为${orderNumber}已于${dvyTime}，使用${dvyName}发货啦！快递单${dvyFlowId}。','1,3,2','SMS_194640192','-67OdGrVPTSY8Kh51HbANWvth_SJDGTnf8XoiVWfT4k',1,1),
(7,'2020-07-01 16:48:53','2021-07-03 11:27:22',7,'你购买的${prodName}，有效期内未成团，订单自动关闭并退款。请登录小程序查看订单。','1,2,3','SMS_194635380','NeU6YMtkGMtWmdSU6LZDOSy5e4sD26BhwtS8i62Maas',1,1),
(8,'2020-07-01 16:49:25','2021-07-03 11:27:23',8,'你购买的拼团商品${prodName}，已成团，卖家将尽快发货。快去小程序查看订单吧。','1,2,3','SMS_194650371','h-W1VVj4FRJxtUlDbdbSCjFO5YymSLNi5tslb63s_Wo',1,1),
(9,'2020-07-01 16:51:16','2021-07-03 11:27:24',9,'你购买的${prodName}，实付金额：${price}元。已支付成功！快去小程序将参团链接分享给好友进行参团吧。','1,2,3','SMS_194635385','amLX4r_hO-yLAXtzdqMcuiXFK5FJALIv6Tm4IAM3abg',1,1),
(10,'2020-07-01 16:52:28','2021-07-03 11:27:27',11,'订单编号${orderNumber}，因商家退款长时间未处理，系统将于${hour}小时后退款关闭。请尽快联系商家处理。','2,3,1','SMS_199773811','MH8e-NlAJx9veec2rRS-58YFTL2vdW9DAuK5M-pVGGM',1,1),
(11,'2020-07-01 16:53:01','2021-07-03 11:27:28',102,'订单号${orderNumber}用户${nickName}已经确认收货，资金已经到您的店铺钱包中，登录后台即可进行提现。','1','SMS_194610214','yEKgVqDzWurRH7tl1zFVyh89vrkWWw_DOpWIVX6zvi4',2,1),
(12,'2020-07-01 16:53:29','2021-07-03 11:27:30',103,'有买家发起退款，订单编号${orderNumber}，请你在${day}天内处理，过时退款关闭，请尽快登录商家后台操作。','1','SMS_205617700','CeEckiHGhVo9ckv0AKFmuSUiNyphuySZQluuLZ34NEY',2,1),
(13,'2020-07-01 16:53:56','2021-07-03 11:27:32',104,'您的买家已退货，订单编号${orderNumber}，请你在${day}天内核实处理，逾期未处理，系统将操作退款买家。','1','SMS_194610281','rrwK0idNoaIxoqHcuuDqnEP9GMO2n6ERFU4_QSYL3gY',2,1),
(14,'2020-10-23 15:14:25','2021-07-03 11:27:33',12,'验证码${code}，您正在注册成为新用户，感谢您的支持！','1','SMS_151810562',NULL,1,1),
(15,'2020-10-23 15:14:59','2021-07-03 11:27:36',13,'验证码${code}，您正在登录，若非本人操作，请勿泄露。','1','SMS_151810564',NULL,1,1),
(16,'2020-10-23 15:16:47','2021-07-03 11:27:40',14,'验证码${code}，您正在尝试修改登录密码，请妥善保管账户信息。','1','SMS_151810561',NULL,1,1),
(17,'2020-10-23 15:17:03','2021-07-03 11:27:42',15,'验证码${code}，您正在进行身份验证，打死不要告诉别人哦！','1','SMS_151810565',NULL,1,1),
(18,'2021-05-14 16:05:02','2021-07-03 11:27:43',10,'恭喜你成为商城${levelName}！打开小程序点击会员中心，立即查看会员专属权益吧。','1,2,3','SMS_194610411','zRs2GQmWfMC8OlCrC0J8XbYOdOzPEYw00NjUo0FXZ1s',1,1),
(19,'2022-01-11 17:40:46','2022-01-11 17:40:46',16,'您的分销员申请已通过，立刻查看分销中心进行分销吧','3','','',1,1),
(20,'2022-06-17 11:32:02','2022-06-17 11:32:02',105,'用户${nickName}已经支付成功，订单号为${orderNumber}，请及时处理。','1','SMS_243186065','',2,1),
(21,'2022-06-17 11:32:02','2022-06-17 11:32:02',1005,'用户${nickName}已经支付成功，订单号为${orderNumber}，请及时处理。','1','SMS_243186065','',3,1),
(22,'2020-07-01 16:53:01','2021-07-03 11:27:28',1002,'订单号${orderNumber}用户${nickName}已经确认收货，资金已经到您的店铺钱包中，登录后台即可进行提现。','1','SMS_194610214','yEKgVqDzWurRH7tl1zFVyh89vrkWWw_DOpWIVX6zvi4',3,1),
(23,'2020-07-01 16:53:29','2021-07-03 11:27:30',1003,'有买家发起退款，订单编号${orderNumber}，请你在${day}天内处理，过时退款关闭，请尽快登录商家后台操作。','1','SMS_205617700','CeEckiHGhVo9ckv0AKFmuSUiNyphuySZQluuLZ34NEY',3,1),
(24,'2020-07-01 16:53:56','2021-07-03 11:27:32',1004,'您的买家已退货，订单编号${orderNumber}，请你在${day}天内核实处理，逾期未处理，系统将操作退款买家。','1','SMS_194610281','rrwK0idNoaIxoqHcuuDqnEP9GMO2n6ERFU4_QSYL3gY',3,1),
(25,'2020-07-01 16:53:56','2021-07-03 11:27:32',1006,'商品${spuName}已被平台下架，点击去查看。','3','','',3,1),
(26,'2020-07-01 16:53:56','2021-07-03 11:27:32',1007,'商品${spuName}审核成功，点击去查看。','3','','',3,1),
(27,'2020-07-01 16:53:56','2021-07-03 11:27:32',106,'商品${spuName}已被平台或供应商下架，点击去查看。','3','','',2,1),
(28,'2020-07-01 16:53:56','2021-07-03 11:27:32',107,'商品${spuName}审核成功，点击去查看。','3','','',2,1),
(29,'2020-07-01 16:53:56','2021-07-03 11:27:32',108,'供应商${supplierName}的商品${spuName}信息发生变更，点击去查看。','3','','',2,1),
(30,'2020-07-01 16:53:56','2021-07-03 11:27:32',110,'您有一笔订单待采购，订单编号${orderNumber}，请及时处理。','3','','',2,1),
(31,'2020-07-01 16:53:56','2021-07-03 11:27:32',112,'活动${activityName}已被平台下架，点击去查看。','3','','',2,1),
(32,'2020-07-01 16:53:56','2021-07-03 11:27:32',113,'活动${activityName}审核成功，点击去查看。','3','','',2,1);


/*Table structure for table `notify_template_tag` */

DROP TABLE IF EXISTS `notify_template_tag`;

CREATE TABLE `notify_template_tag` (
  `notify_tag_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '标签消息通知关联表',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `user_tag_id` bigint(20) DEFAULT NULL COMMENT '标签id',
  `template_id` bigint(20) DEFAULT NULL COMMENT '模板id',
  PRIMARY KEY (`notify_tag_id`),
  KEY `template_tag_idx`(`template_id`, `user_tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

/*Data for the table `notify_template_tag` */

DROP TABLE IF EXISTS `notify_template_remind`;
CREATE TABLE `notify_template_remind` (
 `notify_template_remind_id` bigint NOT NULL AUTO_INCREMENT,
 `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
 `template_id` bigint DEFAULT NULL COMMENT '消息模板id',
 `shop_id` bigint DEFAULT NULL COMMENT '店铺id',
 `is_remind` tinyint DEFAULT NULL COMMENT '是否开启提醒 1开启  0关闭',
 `sys_type` tinyint NULL DEFAULT 0 COMMENT '关联系统类型 1.店铺 2.平台端 3.供应商',
 PRIMARY KEY (`notify_template_remind_id`),
 KEY `shop_idx`(`shop_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='消息提醒设置表';
/*Table structure for table `qrcode_ticket` */

DROP TABLE IF EXISTS `qrcode_ticket`;

CREATE TABLE `qrcode_ticket` (
 `ticket_id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '二维码ticket id',
 `ticket` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '二维码ticket',
 `create_time` datetime DEFAULT NULL COMMENT '创建时间',
 `expire_time` datetime DEFAULT NULL COMMENT '过期时间',
 `type` tinyint DEFAULT NULL COMMENT '二维码类型（1. 小程序团购页面）',
 `content` varchar(2000) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '二维码实际内容',
 `ticket_url` varchar(1000) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '这个二维码要跳转的url',
 PRIMARY KEY (`ticket_id`),
 KEY `ticket` (`ticket`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='二维码数据信息';

/*Table structure for table `sms_log` */

DROP TABLE IF EXISTS `sms_log`;

CREATE TABLE `sms_log` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `user_id` bigint(20) DEFAULT NULL COMMENT '用户id',
  `user_phone` varchar(20)  NOT NULL DEFAULT '' COMMENT '手机号码',
  `content` varchar(100)  NOT NULL DEFAULT '' COMMENT '短信内容',
  `mobile_code` varchar(50)  NOT NULL DEFAULT '' COMMENT '手机验证码',
  `type` int(11) NOT NULL DEFAULT '0' COMMENT '短信类型  1:注册  2:验证',
  `response_code` varchar(50)  DEFAULT NULL COMMENT '发送短信返回码',
  `status` int(11) NOT NULL DEFAULT '0' COMMENT '状态  1:有效  0：失效',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='短信记录表';

/*Data for the table `sms_log` */

/*Table structure for table `undo_log` */

DROP TABLE IF EXISTS `undo_log`;

CREATE TABLE `undo_log` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) NOT NULL,
  `xid` varchar(100) NOT NULL,
  `context` varchar(128) NOT NULL,
  `rollback_info` longblob NOT NULL,
  `log_status` int(11) 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 */;
