/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_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 */;

# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: Contact
# ------------------------------------------------------------

CREATE TABLE IF NOT EXISTS `Contact` (
  `uid` varchar(255) DEFAULT NULL COMMENT '用户id/群id',
  `to_uid` varchar(255) DEFAULT NULL COMMENT '接收人用户id',
  `type` varchar(255) DEFAULT NULL COMMENT '类型,单人/群:one/group',
  `status` varchar(255) DEFAULT NULL COMMENT '状态:已结束/未结束:y/n',
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表自增id',
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: Group
# ------------------------------------------------------------

CREATE TABLE IF NOT EXISTS `Group` (
  `gid` varchar(255) DEFAULT NULL COMMENT '分组id',
  `name` varchar(255) DEFAULT NULL COMMENT '分组名称',
  `to_gid` varchar(255) DEFAULT NULL COMMENT '上级分组id',
  `to_oid` varchar(255) DEFAULT NULL COMMENT '所属组织id',
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表自增id',
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 2 DEFAULT CHARSET = utf8mb4;

# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: Message
# ------------------------------------------------------------

CREATE TABLE IF NOT EXISTS `Message` (
  `uid` varchar(255) DEFAULT NULL COMMENT '发送人用户id',
  `name` varchar(255) DEFAULT NULL COMMENT '发送人名称',
  `avatar` varchar(255) DEFAULT NULL COMMENT '发送人头像',
  `to_uid` varchar(255) DEFAULT NULL COMMENT '接收人用户id',
  `to_name` varchar(255) DEFAULT NULL COMMENT '接收人名称',
  `to_avatar` varchar(255) DEFAULT NULL COMMENT '接收人头像',
  `status` varchar(255) DEFAULT NULL COMMENT '状态:已读/未读:y/n',
  `type` varchar(255) DEFAULT NULL COMMENT '消息类型：file / image / text / event',
  `sendTime` varchar(255) DEFAULT NULL COMMENT '消息发送时间',
  `content` varchar(255) DEFAULT NULL COMMENT '消息内容，如果type=file，此属性表示文件的URL地址',
  `fileSize` varchar(255) DEFAULT NULL COMMENT '文件大小',
  `fileName` varchar(255) DEFAULT NULL COMMENT '文件名称',
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表自增id',
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: Organization
# ------------------------------------------------------------

CREATE TABLE IF NOT EXISTS `Organization` (
  `oid` varchar(255) DEFAULT NULL COMMENT '组织id',
  `name` varchar(255) DEFAULT NULL COMMENT '组织名称',
  `general_management` varchar(255) DEFAULT NULL COMMENT '是否为总管理平台(可以管理所有组织):y/n',
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表自增id',
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: OrganizationSetting
# ------------------------------------------------------------

CREATE TABLE IF NOT EXISTS `OrganizationSetting` (
  `oid` varchar(255) DEFAULT NULL COMMENT '组织id',
  `name` varchar(255) DEFAULT NULL COMMENT '名称',
  `type` varchar(255) DEFAULT NULL COMMENT '类型:string/number/json',
  `code` varchar(255) DEFAULT NULL COMMENT '识别码',
  `value` varchar(255) DEFAULT NULL COMMENT '权限值',
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表自增id',
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: Permission
# ------------------------------------------------------------

CREATE TABLE IF NOT EXISTS `Permission` (
  `pid` varchar(255) DEFAULT NULL COMMENT '权限id',
  `name` varchar(255) DEFAULT NULL COMMENT '权限名称',
  `code` varchar(255) DEFAULT NULL COMMENT '权限识别码',
  `value` varchar(255) DEFAULT NULL COMMENT '权限值',
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表自增id',
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  `type` varchar(255) DEFAULT NULL COMMENT '权限类型:接口/字段/表格/按钮:jk/zd/bg/an',
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: PermissionClass
# ------------------------------------------------------------

CREATE TABLE IF NOT EXISTS `PermissionClass` (
  `name` varchar(255) DEFAULT NULL COMMENT '权限分类名称',
  `pccode` varchar(255) DEFAULT NULL COMMENT '权限分类识别码',
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表自增id',
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: Role
# ------------------------------------------------------------

CREATE TABLE IF NOT EXISTS `Role` (
  `rid` varchar(255) DEFAULT NULL COMMENT '角色id',
  `name` varchar(255) DEFAULT NULL COMMENT '角色名称',
  `to_oid` varchar(255) DEFAULT NULL COMMENT '所属组织id',
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表自增id',
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: RoleToPermission
# ------------------------------------------------------------

CREATE TABLE IF NOT EXISTS `RoleToPermission` (
  `to_rid` varchar(255) DEFAULT NULL COMMENT '角色id',
  `to_pid` varchar(255) DEFAULT NULL COMMENT '权限id',
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表自增id',
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: User
# ------------------------------------------------------------

CREATE TABLE IF NOT EXISTS `User` (
  `uid` varchar(255) DEFAULT NULL COMMENT '用户id',
  `account` varchar(255) DEFAULT NULL COMMENT '用户账号',
  `password` varchar(255) DEFAULT NULL COMMENT '用户加密密码',
  `salt` varchar(255) DEFAULT NULL COMMENT '用户加密随机数',
  `to_oid` varchar(255) DEFAULT NULL COMMENT '所属组织id',
  `to_rid` varchar(255) DEFAULT NULL COMMENT '所属角色id',
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表自增id',
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 1043 DEFAULT CHARSET = utf8mb4;

# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: UserInfo
# ------------------------------------------------------------

CREATE TABLE IF NOT EXISTS `UserInfo` (
  `uid` varchar(255) DEFAULT NULL COMMENT '用户id',
  `account` varchar(255) DEFAULT NULL COMMENT '用户账号',
  `name` varchar(255) DEFAULT NULL COMMENT '名称',
  `avatar` varchar(255) DEFAULT NULL COMMENT '头像',
  `wechat_openid` varchar(255) DEFAULT NULL COMMENT '微信openid',
  `phone_number` varchar(255) DEFAULT NULL COMMENT '手机号',
  `age` varchar(255) DEFAULT NULL COMMENT '年龄',
  `sex` varchar(255) DEFAULT NULL COMMENT '性别',
  `province` varchar(255) DEFAULT NULL COMMENT '省份',
  `city` varchar(255) DEFAULT NULL COMMENT '城市',
  `area` varchar(255) DEFAULT NULL COMMENT '地区',
  `address` varchar(255) DEFAULT NULL COMMENT '详细地址',
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表自增id',
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: autoRes
# ------------------------------------------------------------

CREATE TABLE IF NOT EXISTS `autoRes` (
  `type` varchar(255) DEFAULT NULL COMMENT '类型,自动回复/问候语:auto/hello',
  `status` varchar(255) DEFAULT NULL COMMENT '状态:显示/隐藏:y/n',
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表自增id',
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: role
# ------------------------------------------------------------

CREATE TABLE IF NOT EXISTS `role` (
  `uid` varchar(255) DEFAULT NULL COMMENT '用户id',
  `age` int(11) DEFAULT '0' COMMENT '年龄',
  `age2` int(11) DEFAULT '0' COMMENT '年龄',
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表自增id',
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

# ------------------------------------------------------------
# DATA DUMP FOR TABLE: Contact
# ------------------------------------------------------------


# ------------------------------------------------------------
# DATA DUMP FOR TABLE: Group
# ------------------------------------------------------------

INSERT INTO
  `Group` (
    `gid`,
    `name`,
    `to_gid`,
    `to_oid`,
    `id`,
    `createdAt`,
    `updatedAt`
  )
VALUES
  (
    '1',
    '1',
    NULL,
    NULL,
    1,
    '2022-06-18 03:53:29',
    '2022-06-18 03:53:32'
  );

# ------------------------------------------------------------
# DATA DUMP FOR TABLE: Message
# ------------------------------------------------------------


# ------------------------------------------------------------
# DATA DUMP FOR TABLE: Organization
# ------------------------------------------------------------


# ------------------------------------------------------------
# DATA DUMP FOR TABLE: OrganizationSetting
# ------------------------------------------------------------


# ------------------------------------------------------------
# DATA DUMP FOR TABLE: Permission
# ------------------------------------------------------------


# ------------------------------------------------------------
# DATA DUMP FOR TABLE: PermissionClass
# ------------------------------------------------------------


# ------------------------------------------------------------
# DATA DUMP FOR TABLE: Role
# ------------------------------------------------------------


# ------------------------------------------------------------
# DATA DUMP FOR TABLE: RoleToPermission
# ------------------------------------------------------------


# ------------------------------------------------------------
# DATA DUMP FOR TABLE: User
# ------------------------------------------------------------


# ------------------------------------------------------------
# DATA DUMP FOR TABLE: UserInfo
# ------------------------------------------------------------


# ------------------------------------------------------------
# DATA DUMP FOR TABLE: autoRes
# ------------------------------------------------------------


# ------------------------------------------------------------
# DATA DUMP FOR TABLE: role
# ------------------------------------------------------------


/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
