text: /*
   Navicat Premium Data Transfer
  
   Source Server         : aa
   Source Server Type    : MySQL
   Source Server Version : 50722
   Source Host           : localhost:3306
   Source Schema         : codetemplate
  
   Target Server Type    : MySQL
   Target Server Version : 50722
   File Encoding         : 65001
  
   Date: 01/07/2018 23:57:46
  */
  
  SET NAMES utf8mb4;
  SET FOREIGN_KEY_CHECKS = 0;
  
  -- ----------------------------
  -- Table structure for sys_dict
  -- ----------------------------
  DROP TABLE IF EXISTS `sys_dict`;
  CREATE TABLE `sys_dict`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `category` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
    `key_name` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `value` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `gmt_create` datetime(0) DEFAULT NULL,
    `gmt_modify` datetime(0) DEFAULT NULL,
    `creator` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `modifier` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `is_deleted` tinyint(1) DEFAULT NULL,
    `sort` int(11) DEFAULT NULL COMMENT '排序',
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
  
  -- ----------------------------
  -- Table structure for sys_org
  -- ----------------------------
  DROP TABLE IF EXISTS `sys_org`;
  CREATE TABLE `sys_org`  (
    `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '部门名称',
    `parent_id` int(16) NOT NULL COMMENT '父节点',
    `gmt_create` datetime(0) DEFAULT NULL COMMENT '创建时间',
    `gmt_modify` datetime(0) DEFAULT NULL COMMENT '修改时间',
    `creator` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '创建人',
    `modifier` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '修改人',
    `is_deleted` tinyint(1) DEFAULT 0 COMMENT '是否已删除',
    `parent_ids` mediumtext CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '所有父节点',
    `ancesstor_id` int(11) DEFAULT NULL COMMENT '根节点',
    `level` int(11) DEFAULT NULL COMMENT '级别',
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
  
  -- ----------------------------
  -- Table structure for sys_resource
  -- ----------------------------
  DROP TABLE IF EXISTS `sys_resource`;
  CREATE TABLE `sys_resource`  (
    `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    `name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '资源名称',
    `uri` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '前端uri',
    `icon` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '前端图标',
    `level` int(11) DEFAULT NULL COMMENT '菜单级别',
    `ancesstor_id` bigint(20) DEFAULT NULL COMMENT '根节点id',
    `parent_id` bigint(20) DEFAULT NULL COMMENT '父节点id',
    `apis` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '菜单对应的后端接口',
    `type` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '类型 菜单 or按钮',
    `gmt_create` datetime(0) DEFAULT NULL,
    `gmt_modify` datetime(0) DEFAULT NULL,
    `creator` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
    `modifier` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
    `is_deleted` tinyint(1) DEFAULT NULL,
    `sort` int(10) DEFAULT NULL COMMENT 'sort',
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
  
  -- ----------------------------
  -- Table structure for sys_role
  -- ----------------------------
  DROP TABLE IF EXISTS `sys_role`;
  CREATE TABLE `sys_role`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `org_id` bigint(45) DEFAULT NULL COMMENT '所属组织id',
    `resource_ids` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '有权限的资源id',
    `gmt_create` datetime(0) DEFAULT NULL,
    `gmt_modify` datetime(0) DEFAULT NULL,
    `creator` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `modifier` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `is_deleted` tinyint(1) DEFAULT NULL,
    `role_name` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `org_ids` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '有权限的org_id',
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
  
  -- ----------------------------
  -- Table structure for sys_user
  -- ----------------------------
  DROP TABLE IF EXISTS `sys_user`;
  CREATE TABLE `sys_user`  (
    `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `user_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
    `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '姓名',
    `password` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '密码',
    `role_id` bigint(11) DEFAULT NULL COMMENT '角色id',
    `avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '头像',
    `mobile` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '手机号码',
    `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '邮箱',
    `gmt_create` datetime(0) DEFAULT NULL COMMENT '创建时间',
    `gmt_modify` datetime(0) DEFAULT NULL COMMENT '修改时间',
    `creator` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '创建人',
    `modifier` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '修改人',
    `is_deleted` tinyint(1) DEFAULT 0 COMMENT '是否已删除',
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
  
  -- ----------------------------
  -- Table structure for sys_user_role
  -- ----------------------------
  DROP TABLE IF EXISTS `sys_user_role`;
  CREATE TABLE `sys_user_role`  (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `user_id` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'user_id',
    `role_id` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '角色id',
    `privilege_org_ids` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '有权限的组织id',
    `gmt_create` datetime(0) DEFAULT NULL,
    `gmt_modify` datetime(0) DEFAULT NULL,
    `creator` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `modifier` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
    `is_deleted` tinyint(1) DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
  
  SET FOREIGN_KEY_CHECKS = 1;
  