/*
Navicat MySQL Data Transfer

Source Server         : localhost
Source Server Version : 50720
Source Host           : localhost:3306
Source Database       : mood-wall

Target Server Type    : MYSQL
Target Server Version : 50720
File Encoding         : 65001

Date: 2018-12-04 11:25:29
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for tb_data_dictionary
-- ----------------------------
DROP TABLE IF EXISTS `tb_data_dictionary`;
CREATE TABLE `tb_data_dictionary` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `rec_status` varchar(2) DEFAULT NULL COMMENT '记录的状态，A: 生效，I: 禁用',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `code` varchar(24) DEFAULT NULL COMMENT '数据字典code',
  `data_key` varchar(255) DEFAULT NULL COMMENT '数据字典key',
  `data_value` varchar(255) DEFAULT NULL COMMENT '数据字典value',
  `description` varchar(255) DEFAULT NULL COMMENT '描述',
  `param1` varchar(255) DEFAULT NULL COMMENT '备用，参数1',
  `param2` varchar(255) DEFAULT NULL COMMENT '备用，参数2',
  `param3` varchar(255) DEFAULT NULL COMMENT '备用，参数3',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据字典表';

-- ----------------------------
-- Records of tb_data_dictionary
-- ----------------------------

-- ----------------------------
-- Table structure for tb_resource
-- ----------------------------
DROP TABLE IF EXISTS `tb_resource`;
CREATE TABLE `tb_resource` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `description` varchar(255) DEFAULT NULL COMMENT '资源描述',
  `icon` varchar(10) DEFAULT NULL COMMENT '图标',
  `name` varchar(50) DEFAULT NULL COMMENT '资源名称',
  `url` varchar(255) DEFAULT NULL COMMENT '资源地址',
  `parent_id` bigint(20) DEFAULT NULL COMMENT '父资源id',
  `resource_type` enum('menu','button') DEFAULT NULL COMMENT '资源类型',
  `resource_key` varchar(255) DEFAULT NULL COMMENT '资源key',
  `rec_status` varchar(2) DEFAULT NULL COMMENT '记录的状态，A: 生效，I: 禁用',
  `sort` tinyint(4) DEFAULT NULL COMMENT '排序',
  PRIMARY KEY (`id`),
  KEY `FKf5ra2gn0xedeida2op8097sr5` (`parent_id`),
  CONSTRAINT `FKf5ra2gn0xedeida2op8097sr5` FOREIGN KEY (`parent_id`) REFERENCES `tb_resource` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COMMENT='资源表';

-- ----------------------------
-- Records of tb_resource
-- ----------------------------
INSERT INTO `tb_resource` VALUES ('1', '2018-05-10 17:18:36', '2018-05-10 17:22:42', null, '&#xe716', '系统管理', 'javascript:void(0);', null, 'menu', 'system', 'A', '1');
INSERT INTO `tb_resource` VALUES ('2', '2018-05-11 10:05:41', '2018-12-04 11:22:02', null, '&#xe66f', '用户管理', '/admin/user/list', '1', 'menu', 'admin:user:list', 'A', '2');
INSERT INTO `tb_resource` VALUES ('3', '2018-05-14 09:38:43', '2018-05-14 09:38:46', null, '&#xe66f', '用户添加', '/admin/user/add', '2', 'button', 'admin:user:add', 'A', '3');
INSERT INTO `tb_resource` VALUES ('4', '2018-05-14 10:46:32', '2018-05-14 10:46:36', null, '&#xe66f', '用户编辑', '/admin/user/edit', '2', 'button', 'admin:user:edit', 'A', '4');
INSERT INTO `tb_resource` VALUES ('5', '2018-05-14 12:03:20', '2018-05-14 12:03:30', null, '&#xe66f', '用户重置密码', '/admin/user/resetPass', '2', 'button', 'admin:user:resetPass', 'A', '5');
INSERT INTO `tb_resource` VALUES ('6', '2018-05-14 14:08:16', '2018-05-14 14:08:20', null, '&#xe66f', '用户删除', '/admin/user/remove', '2', 'button', 'admin:user:remove', 'A', '6');
INSERT INTO `tb_resource` VALUES ('7', '2018-05-14 14:09:07', '2018-05-14 14:09:10', null, '&#xe770', '角色管理', '/admin/role/list', '1', 'menu', 'admin:role:list', 'A', '7');
INSERT INTO `tb_resource` VALUES ('8', '2018-05-14 15:06:59', '2018-05-14 15:07:01', null, '&#xe770', '角色添加', '/admin/role/add', '7', 'button', 'admin:role:add', 'A', '8');
INSERT INTO `tb_resource` VALUES ('9', '2018-05-14 15:06:59', '2018-05-14 15:07:01', null, '&#xe770', '角色编辑', '/admin/role/edit', '7', 'button', 'admin:role:edit', 'A', '9');
INSERT INTO `tb_resource` VALUES ('10', '2018-05-14 15:08:06', '2018-05-14 15:08:08', null, '&#xe770', '角色删除', '/admin/role/remove', '7', 'button', 'admin:role:remove', 'A', '10');
INSERT INTO `tb_resource` VALUES ('11', '2018-05-14 15:08:06', '2018-05-14 15:08:08', null, '&#xe671', '资源管理', '/admin/resource/list', '1', 'menu', 'admin:resource:list', 'A', '11');
INSERT INTO `tb_resource` VALUES ('12', '2018-05-15 09:51:49', '2018-05-15 09:51:51', null, '&#xe671', '资源添加', '/admin/resource/add', '11', 'button', 'admin:resource:add', 'A', '12');
INSERT INTO `tb_resource` VALUES ('13', '2018-05-15 09:51:49', '2018-05-15 09:51:51', null, '&#xe671', '资源编辑', '/admin/resource/edit', '11', 'button', 'admin:resource:edit', 'A', '13');
INSERT INTO `tb_resource` VALUES ('14', '2018-05-15 09:51:49', '2018-12-04 11:20:29', null, '&#xe671', '资源删除', '/admin/resource/remove', '11', 'button', 'admin:resource:remove', 'A', '14');
INSERT INTO `tb_resource` VALUES ('15', '2018-07-27 16:30:51', '2018-07-27 16:30:51', null, '&#xe66e', '数据字典管理', '/admin/dataDictionary/list', '1', 'menu', 'admin:dataDictionary:list', 'A', '40');
INSERT INTO `tb_resource` VALUES ('16', '2018-07-27 16:31:57', '2018-07-27 16:31:57', null, '&#xe66e', '数据字典添加', '/admin/dataDictionary/add', '15', 'button', 'admin:dataDictionary:add', 'A', '41');
INSERT INTO `tb_resource` VALUES ('17', '2018-07-27 16:35:59', '2018-07-27 16:35:59', null, '&#xe66e', '数据字典编辑', '/admin/dataDictionary/edit', '15', 'button', 'admin:dataDictionary:edit', 'A', '42');
INSERT INTO `tb_resource` VALUES ('18', '2018-07-27 16:36:56', '2018-07-27 16:36:56', null, '&#xe66e', '数据字典删除', '/admin/dataDictionary/remove', '15', 'button', 'admin:dataDictionary:remove', 'A', '43');

-- ----------------------------
-- Table structure for tb_role
-- ----------------------------
DROP TABLE IF EXISTS `tb_role`;
CREATE TABLE `tb_role` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `role_desc` varchar(255) DEFAULT NULL COMMENT '角色描述',
  `role_name` varchar(50) DEFAULT NULL COMMENT '角色名',
  `role_key` varchar(255) DEFAULT NULL COMMENT '角色key',
  `rec_status` varchar(2) DEFAULT NULL COMMENT '记录的状态，A: 生效，I: 禁用',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='角色表';

-- ----------------------------
-- Records of tb_role
-- ----------------------------
INSERT INTO `tb_role` VALUES ('1', '2018-05-11 10:02:27', '2018-12-04 10:50:43', '超级管理员', '超级管理员', 'administrator', 'A');

-- ----------------------------
-- Table structure for tb_role_resource
-- ----------------------------
DROP TABLE IF EXISTS `tb_role_resource`;
CREATE TABLE `tb_role_resource` (
  `role_id` bigint(20) NOT NULL COMMENT '角色表id',
  `resource_id` bigint(20) NOT NULL COMMENT '资源表id',
  PRIMARY KEY (`role_id`,`resource_id`),
  KEY `FK868kc8iic48ilv5npa80ut6qo` (`resource_id`),
  CONSTRAINT `FK7ffc7h6obqxflhj1aq1mk20jk` FOREIGN KEY (`role_id`) REFERENCES `tb_role` (`id`),
  CONSTRAINT `FK868kc8iic48ilv5npa80ut6qo` FOREIGN KEY (`resource_id`) REFERENCES `tb_resource` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色资源关系表';

-- ----------------------------
-- Records of tb_role_resource
-- ----------------------------
INSERT INTO `tb_role_resource` VALUES ('1', '1');
INSERT INTO `tb_role_resource` VALUES ('1', '2');
INSERT INTO `tb_role_resource` VALUES ('1', '3');
INSERT INTO `tb_role_resource` VALUES ('1', '4');
INSERT INTO `tb_role_resource` VALUES ('1', '5');
INSERT INTO `tb_role_resource` VALUES ('1', '6');
INSERT INTO `tb_role_resource` VALUES ('1', '7');
INSERT INTO `tb_role_resource` VALUES ('1', '8');
INSERT INTO `tb_role_resource` VALUES ('1', '9');
INSERT INTO `tb_role_resource` VALUES ('1', '10');
INSERT INTO `tb_role_resource` VALUES ('1', '11');
INSERT INTO `tb_role_resource` VALUES ('1', '12');
INSERT INTO `tb_role_resource` VALUES ('1', '13');
INSERT INTO `tb_role_resource` VALUES ('1', '14');
INSERT INTO `tb_role_resource` VALUES ('1', '15');
INSERT INTO `tb_role_resource` VALUES ('1', '16');
INSERT INTO `tb_role_resource` VALUES ('1', '17');
INSERT INTO `tb_role_resource` VALUES ('1', '18');

-- ----------------------------
-- Table structure for tb_user
-- ----------------------------
DROP TABLE IF EXISTS `tb_user`;
CREATE TABLE `tb_user` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `rec_status` varchar(2) DEFAULT NULL COMMENT '记录的状态，A: 生效，I: 禁用',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `password` varchar(100) DEFAULT NULL COMMENT '登录密码',
  `real_name` varchar(50) DEFAULT NULL COMMENT '真实姓名',
  `user_name` varchar(50) DEFAULT NULL COMMENT '用户名',
  `avatar` varchar(255) DEFAULT NULL COMMENT '头像地址',
  `status` tinyint(4) DEFAULT NULL COMMENT '状态，0：激活，1：禁用',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='用户表';

-- ----------------------------
-- Records of tb_user
-- ----------------------------
INSERT INTO `tb_user` VALUES ('1', '2018-05-10 15:12:42', 'A', '2018-12-04 10:58:51', '8ca1e641c2bc5040', '超级管理员', 'admin', '/img/avater.jpg', '0');

-- ----------------------------
-- Table structure for tb_user_role
-- ----------------------------
DROP TABLE IF EXISTS `tb_user_role`;
CREATE TABLE `tb_user_role` (
  `user_id` bigint(20) NOT NULL COMMENT '用户表id',
  `role_id` bigint(20) NOT NULL COMMENT '角色表id',
  PRIMARY KEY (`user_id`,`role_id`),
  KEY `FKea2ootw6b6bb0xt3ptl28bymv` (`role_id`),
  CONSTRAINT `FK7vn3h53d0tqdimm8cp45gc0kl` FOREIGN KEY (`user_id`) REFERENCES `tb_user` (`id`),
  CONSTRAINT `FKea2ootw6b6bb0xt3ptl28bymv` FOREIGN KEY (`role_id`) REFERENCES `tb_role` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户角色关系表';

-- ----------------------------
-- Records of tb_user_role
-- ----------------------------
INSERT INTO `tb_user_role` VALUES ('1', '1');
