/*
 Navicat Premium Data Transfer

 Source Server         : test_dankal
 Source Server Type    : MySQL
 Source Server Version : 50722
 Source Host           : db.dankal.cn:3306
 Source Schema         : template

 Target Server Type    : MySQL
 Target Server Version : 50722
 File Encoding         : 65001

 Date: 11/03/2019 09:47:31
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for address
-- ----------------------------
DROP TABLE IF EXISTS `address`;
CREATE TABLE `address` (
  `uuid` char(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '地址表 uuid',
  `user_uuid` char(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户uuid',
  `province` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '省',
  `city` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '市',
  `area` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '区',
  `detail` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '详细地址',
  `is_invalid` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否有效：o:有效；1：无效',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`),
  KEY `IK_ADDRESS_USER_UUID` (`user_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='地址表';

-- ----------------------------
-- Table structure for captcha
-- ----------------------------
DROP TABLE IF EXISTS `captcha`;
CREATE TABLE `captcha` (
  `uuid` char(32) NOT NULL,
  `code` int(6) NOT NULL,
  `create_time` datetime NOT NULL,
  `type` tinyint(4) DEFAULT NULL,
  `mobile` char(11) DEFAULT NULL,
  PRIMARY KEY (`uuid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for carousel
-- ----------------------------
DROP TABLE IF EXISTS `carousel`;
CREATE TABLE `carousel` (
  `uuid` char(32) NOT NULL,
  `images` varchar(255) DEFAULT NULL,
  `sort` int(10) DEFAULT NULL,
  `title` varchar(128) DEFAULT NULL COMMENT '标题',
  `content` text,
  PRIMARY KEY (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for classify
-- ----------------------------
DROP TABLE IF EXISTS `classify`;
CREATE TABLE `classify` (
  `uuid` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '分类 uuid',
  `type` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '类型',
  `operator` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '操作员uuid',
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除：o:未删除；1：已删除',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='分类表';

-- ----------------------------
-- Table structure for evaluate
-- ----------------------------
DROP TABLE IF EXISTS `evaluate`;
CREATE TABLE `evaluate` (
  `uuid` varchar(33) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '评价uuid',
  `user_uuid` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户 uuid',
  `grade` tinyint(1) NOT NULL DEFAULT '1' COMMENT '评分：1-5',
  `content` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '评价',
  `images` json DEFAULT NULL COMMENT '评价图片意见',
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除：o:未删除；1：已删除',
  `is_handle` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否处理：o:未处理；1：已处理',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='评价表';

-- ----------------------------
-- Table structure for feedback
-- ----------------------------
DROP TABLE IF EXISTS `feedback`;
CREATE TABLE `feedback` (
  `uuid` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '意见反馈 uuid',
  `user_uuid` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户 uuid',
  `images` json DEFAULT NULL COMMENT '反馈图片意见',
  `content` text COLLATE utf8mb4_unicode_ci COMMENT '内容',
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除：o:未删除；1：已删除',
  `is_handle` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否处理：o:未处理；1：已处理',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`),
  KEY `IK_FEEDBACK_USER_UUID` (`user_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='意见反馈表';

-- ----------------------------
-- Table structure for push
-- ----------------------------
DROP TABLE IF EXISTS `push`;
CREATE TABLE `push` (
  `uuid` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '推送 uuid',
  `user_uuid` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户uuid',
  `tags` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户所属组',
  `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '推送标题',
  `content` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '推送内容',
  `ico` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '推送图标',
  `attribute` json DEFAULT NULL COMMENT '属性',
  `type` tinyint(1) unsigned DEFAULT '0' COMMENT '推送类型：0:系统消息；1；other',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`),
  KEY `IK_PUSH_USER_UUID` (`user_uuid`),
  KEY `IK_PUSH_TAGS` (`tags`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='推送表';

-- ----------------------------
-- Table structure for questions
-- ----------------------------
DROP TABLE IF EXISTS `questions`;
CREATE TABLE `questions` (
  `uuid` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '常见问题uuid',
  `classify_uuid` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '分类 uuid',
  `title` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '标题',
  `content` text COLLATE utf8mb4_unicode_ci COMMENT '内容',
  `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除：o:未删除；1：已删除',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`),
  KEY `IK_CLASSIFY_UUID` (`classify_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='常见问题表';

-- ----------------------------
-- Table structure for receiver
-- ----------------------------
DROP TABLE IF EXISTS `receiver`;
CREATE TABLE `receiver` (
  `uuid` char(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '收件 uuid',
  `user_uuid` char(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户uuid',
  `address_uuid` char(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '地址uuid',
  `name` char(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '收件人名',
  `mobile` char(15) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '手机号',
  `is_default` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否默认：o:默认；1：非默认',
  `is_invalid` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否有效：o:有效；1：无效',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`),
  KEY `IK_RECEIVER_USER_UUID` (`user_uuid`),
  KEY `IK_RECEIVER_ADDRESS_UUID` (`address_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='收件表';

-- ----------------------------
-- Table structure for search_term
-- ----------------------------
DROP TABLE IF EXISTS `search_term`;
CREATE TABLE `search_term` (
  `uuid` char(32) NOT NULL,
  `search_term` char(32) NOT NULL COMMENT '搜索词',
  `create_time` datetime DEFAULT NULL,
  `search_num` int(11) DEFAULT NULL COMMENT '搜索数量',
  PRIMARY KEY (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for token
-- ----------------------------
DROP TABLE IF EXISTS `token`;
CREATE TABLE `token` (
  `uuid` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'uuid',
  `user_uuid` char(32) NOT NULL COMMENT '用户uuid',
  `create_time` datetime NOT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `access_token` char(32) NOT NULL,
  `refresh_token` char(32) NOT NULL COMMENT '刷新token使用的token',
  `expiry_time` datetime DEFAULT NULL,
  PRIMARY KEY (`uuid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `uuid` char(32) NOT NULL,
  `name` char(32) DEFAULT NULL,
  `mobile` char(11) DEFAULT NULL,
  `avatar` varchar(255) DEFAULT NULL,
  `attribute` json DEFAULT NULL,
  `create_time` datetime NOT NULL,
  `password` varchar(45) DEFAULT NULL COMMENT '密码',
  PRIMARY KEY (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

SET FOREIGN_KEY_CHECKS = 1;
