text: /*
   Navicat Premium Data Transfer
  
   Source Server         : datalink
   Source Server Type    : MySQL
   Source Server Version : 80015
   Source Host           : localhost:3306
   Source Schema         : datalink
  
   Target Server Type    : MySQL
   Target Server Version : 80015
   File Encoding         : 65001
  
   Date: 04/05/2021 14:48:12
  */
  
  SET NAMES utf8mb4;
  SET FOREIGN_KEY_CHECKS = 0;
  
  -- ----------------------------
  -- Table structure for dbase_user
  -- ----------------------------
  DROP TABLE IF EXISTS `dbase_user`;
  CREATE TABLE `dbase_user`  (
    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '登录名',
    `password` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码',
    `nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '姓名',
    `avatar` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '头像Url',
    `mobile` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号',
    `sex` tinyint(1) NULL DEFAULT NULL COMMENT '性别',
    `enabled` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否启用',
    `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
    `open_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'OpenId',
    `is_delete` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `index_username`(`username`) USING BTREE
  ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户' ROW_FORMAT = Dynamic;
  
  -- ----------------------------
  -- Records of dbase_user
  -- ----------------------------
  INSERT INTO `dbase_user` VALUES (1, 'admin', '$2a$10$TJkwVdlpbHKnV45.nBxbgeFHmQRmyWlshg94lFu2rKxVtT2OMniDO', '超级管理员', 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png', NULL, NULL, 1, '2021-05-04 14:47:09', '2021-05-04 14:47:09', 0);
  
  -- ----------------------------
  -- Table structure for dbase_role
  -- ----------------------------
  DROP TABLE IF EXISTS `dbase_role`;
  CREATE TABLE `dbase_role`  (
    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '角色ID',
    `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色编码',
    `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色名',
    `enabled` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否启用',
    `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
    `tenant_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '租户',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `index_code`(`code`, `tenant_id`) USING BTREE
  ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色' ROW_FORMAT = Dynamic;
  
  -- ----------------------------
  -- Table structure for dbase_role_user
  -- ----------------------------
  DROP TABLE IF EXISTS `dbase_role_user`;
  CREATE TABLE `dbase_role_user`  (
    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '角色用户ID',
    `user_id` int(11) NOT NULL COMMENT '用户ID',
    `role_id` int(11) NOT NULL COMMENT '角色ID',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `index_roleuser`(`user_id`, `role_id`) USING BTREE
  ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户角色关系' ROW_FORMAT = Dynamic;
  
  -- ----------------------------
  -- Table structure for dbase_dict
  -- ----------------------------
  DROP TABLE IF EXISTS `dbase_dict`;
  CREATE TABLE `dbase_dict`  (
    `id` int(11) NOT NULL COMMENT '字典ID',
    `code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典编码',
    `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典名',
    `type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型',
    `note` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '说明',
    `enabled` tinyint(1) NOT NULL DEFAULT 1 COMMENT '启用',
    `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
    `tenant_id` int(11) NOT NULL COMMENT '租户ID',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `index_codetypetenant`(`code`, `type`, `tenant_id`) USING BTREE
  ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '扩展字典' ROW_FORMAT = Dynamic;
  
  -- ----------------------------
  -- Table structure for dbase_menu
  -- ----------------------------
  DROP TABLE IF EXISTS `dbase_menu`;
  CREATE TABLE `dbase_menu`  (
    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '菜单ID',
    `parent_id` int(11) NOT NULL COMMENT '父ID',
    `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称',
    `url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'Url',
    `path` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路由',
    `path_method` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '方法',
    `css` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '样式',
    `sort` int(11) NOT NULL COMMENT '排序',
    `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
    `type` tinyint(1) NOT NULL COMMENT '类型',
    `enabled` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否启用',
    `tenant_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '租户字段',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `index_pnt`(`parent_id`, `name`, `tenant_id`) USING BTREE
  ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '菜单' ROW_FORMAT = Dynamic;
  
  -- ----------------------------
  -- Table structure for dbase_role_menu
  -- ----------------------------
  DROP TABLE IF EXISTS `dbase_role_menu`;
  CREATE TABLE `dbase_role_menu`  (
    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '菜单角色ID',
    `role_id` int(11) NOT NULL COMMENT '角色ID',
    `menu_id` int(11) NOT NULL COMMENT '菜单ID',
    PRIMARY KEY (`id`, `role_id`, `menu_id`) USING BTREE,
    UNIQUE INDEX `index_mr`(`role_id`, `menu_id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '菜单角色关系' ROW_FORMAT = Dynamic;
  
  -- ----------------------------
  -- Table structure for oauth_client_details
  -- ----------------------------
  DROP TABLE IF EXISTS `oauth_client_details`;
  CREATE TABLE `oauth_client_details`  (
    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `client_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '应用标识',
    `client_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '应用名称',
    `resource_ids` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资源限定串(逗号分割)',
    `client_secret` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '应用密钥(bcyt) 加密',
    `client_secret_str` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '应用密钥(明文)',
    `scope` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '范围',
    `authorized_grant_types` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '5种oauth授权方式(authorization_code,password,refresh_token,client_credentials)',
    `web_server_redirect_uri` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '回调地址 ',
    `authorities` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限',
    `access_token_validity` int(11) NULL DEFAULT NULL COMMENT 'access_token有效期',
    `refresh_token_validity` int(11) NULL DEFAULT NULL COMMENT 'refresh_token有效期',
    `additional_information` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '附加信息',
    `autoapprove` char(5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'true' COMMENT '是否自动授权 是-true',
    `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `index_clientid`(`client_id`) USING BTREE
  ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '租户信息' ROW_FORMAT = Dynamic;
  
  INSERT INTO `datalink`.`oauth_client_details`(`id`, `client_id`, `resource_ids`, `client_secret`, `client_secret_str`, `scope`, `authorized_grant_types`, `web_server_redirect_uri`, `authorities`, `access_token_validity`, `refresh_token_validity`, `additional_information`, `autoapprove`, `create_time`, `update_time`, `client_name`) VALUES (1, 'webApp', NULL, '$2a$10$06msMGYRH8nrm4iVnKFNKOoddB8wOwymVhbUzw/d3ZixD7Nq8ot72', 'webApp', 'app', 'authorization_code,password,refresh_token,client_credentials,implicit,password_code,openId,mobile_password', NULL, NULL, 3600, NULL, '{}', 'true', NULL, NULL, 'pc端');
  
  
  SET FOREIGN_KEY_CHECKS = 1;
  