/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 50720
 Source Host           : localhost:3306
 Source Schema         : fdkanfang

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

 Date: 12/03/2020 15:20:54
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for tb_house
-- ----------------------------
DROP TABLE IF EXISTS `tb_house`;
CREATE TABLE `tb_house`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT NULL,
  `rec_status` int(11) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT NULL,
  `address` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `area` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `district_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `floor` int(11) NULL DEFAULT NULL,
  `handler` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `num` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `orientation` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `requirement` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `status` int(11) NULL DEFAULT NULL,
  `unit_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `UK_p0jvyarwl7skwgajmcpakead0`(`num`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of tb_house
-- ----------------------------
INSERT INTO `tb_house` VALUES (1, 'string', '2020-03-02 14:03:10', 0, '2020-03-02 14:03:10', '22222', 'string', 'string', 0, 'string', '10001', 'string', 'string', 0, 'string', '9');
INSERT INTO `tb_house` VALUES (7, NULL, '2020-03-03 10:55:26', 0, '2020-03-03 10:55:26', NULL, NULL, '5555', 0, NULL, NULL, NULL, NULL, 0, NULL, '9');
INSERT INTO `tb_house` VALUES (9, NULL, '2020-03-03 11:16:48', 0, '2020-03-03 11:16:48', NULL, NULL, '5555', 0, NULL, NULL, NULL, NULL, 0, NULL, '9');
INSERT INTO `tb_house` VALUES (11, NULL, '2020-03-03 11:30:28', 0, '2020-03-03 11:30:28', NULL, NULL, '5555', 0, NULL, NULL, NULL, NULL, 0, NULL, '9');
INSERT INTO `tb_house` VALUES (12, NULL, '2020-03-03 11:37:48', 0, '2020-03-03 11:37:48', NULL, NULL, '5555', 0, NULL, NULL, NULL, NULL, 0, NULL, '9');
INSERT INTO `tb_house` VALUES (13, NULL, '2020-03-03 12:30:22', 0, '2020-03-03 12:30:22', NULL, NULL, '5555', 0, NULL, NULL, NULL, NULL, 0, NULL, '9');
INSERT INTO `tb_house` VALUES (14, NULL, '2020-03-03 12:42:36', 0, '2020-03-03 12:42:36', NULL, NULL, '5555', 0, NULL, NULL, NULL, NULL, 0, NULL, '9');
INSERT INTO `tb_house` VALUES (17, NULL, '2020-03-12 10:29:58', 0, '2020-03-12 10:29:58', '皇后大道东', NULL, '华发', 1, NULL, NULL, '朝东', '做得漂亮', 0, '3-2-1', '1');
INSERT INTO `tb_house` VALUES (18, NULL, '2020-03-12 10:31:24', 0, '2020-03-12 10:31:24', '皇后大道东', NULL, '华发水岸', 1, NULL, NULL, '朝东', '做得漂亮', 0, '3-2-1', '2');

-- ----------------------------
-- Table structure for tb_image
-- ----------------------------
DROP TABLE IF EXISTS `tb_image`;
CREATE TABLE `tb_image`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT NULL,
  `rec_status` int(11) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT NULL,
  `file_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `house_id` bigint(20) NOT NULL,
  `issue` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `path` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_image_house_id`(`house_id`) USING BTREE,
  CONSTRAINT `fk_image_house_id` FOREIGN KEY (`house_id`) REFERENCES `tb_house` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of tb_image
-- ----------------------------
INSERT INTO `tb_image` VALUES (6, NULL, '2020-03-12 10:31:24', 0, '2020-03-12 10:31:24', 'bb.jpg', 18, NULL, 'F:\\test\\fdkanfang\\20200312_103124\\bb.jpg');
INSERT INTO `tb_image` VALUES (7, NULL, '2020-03-12 10:31:24', 0, '2020-03-12 10:31:24', 'cc.jpg', 18, NULL, 'F:\\test\\fdkanfang\\20200312_103124\\cc.jpg');

-- ----------------------------
-- 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(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资源描述',
  `icon` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图标',
  `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资源名称',
  `url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资源地址',
  `parent_id` bigint(20) NULL DEFAULT NULL COMMENT '父资源id',
  `resource_type` enum('menu','button') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资源类型',
  `resource_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资源key',
  `rec_status` tinyint(2) NULL DEFAULT NULL COMMENT '记录的状态，0: 生效，1: 禁用',
  `sort` tinyint(4) NULL DEFAULT NULL COMMENT '排序',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `FKf5ra2gn0xedeida2op8097sr5`(`parent_id`) USING BTREE,
  CONSTRAINT `FKf5ra2gn0xedeida2op8097sr5` FOREIGN KEY (`parent_id`) REFERENCES `tb_resource` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '资源表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of tb_resource
-- ----------------------------
INSERT INTO `tb_resource` VALUES (1, '2018-05-10 17:18:36', '2018-05-10 17:22:42', NULL, NULL, '系统管理', 'javascript:void(0);', NULL, 'menu', 'system', 0, 1);
INSERT INTO `tb_resource` VALUES (2, '2018-05-11 10:05:41', '2018-12-04 11:22:02', NULL, NULL, '用户管理', 'api/manage/user/list', NULL, 'menu', 'admin:user:list', 0, 2);
INSERT INTO `tb_resource` VALUES (3, '2018-05-14 09:38:43', '2018-05-14 09:38:46', NULL, NULL, '房源上传', '/admin/user/add', NULL, 'menu', 'admin:user:add', 0, 3);
INSERT INTO `tb_resource` VALUES (4, '2018-05-14 10:46:32', '2018-05-14 10:46:36', NULL, NULL, '房源制作', 'api/manage/user/save', NULL, 'menu', 'admin:user:edit', 0, 4);

-- ----------------------------
-- 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(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  `role_desc` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '角色描述',
  `role_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '角色名',
  `role_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '角色key',
  `rec_status` tinyint(2) NULL DEFAULT NULL COMMENT '记录的状态，0: 生效，1: 禁用',
  `sort` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of tb_role
-- ----------------------------
INSERT INTO `tb_role` VALUES (1, '2018-05-11 10:02:27', '2019-04-01 16:07:09', '超级管理员', '超级管理员', 'admin', 0, '1');
INSERT INTO `tb_role` VALUES (2, '2019-11-12 09:10:25', '2019-12-04 15:40:29', '房源上传', '房源上传', 'upload', 0, '2');
INSERT INTO `tb_role` VALUES (3, '2020-02-28 17:54:04', '2020-02-28 17:54:07', '房源制作', '房源制作', 'edit', 0, '3');

-- ----------------------------
-- 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`) USING BTREE,
  INDEX `FK868kc8iic48ilv5npa80ut6qo`(`resource_id`) USING BTREE,
  CONSTRAINT `tb_role_resource_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `tb_role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `tb_role_resource_ibfk_2` FOREIGN KEY (`resource_id`) REFERENCES `tb_resource` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色资源关系表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of tb_role_resource
-- ----------------------------
INSERT INTO `tb_role_resource` VALUES (1, 2);
INSERT INTO `tb_role_resource` VALUES (1, 3);
INSERT INTO `tb_role_resource` VALUES (2, 3);
INSERT INTO `tb_role_resource` VALUES (1, 4);

-- ----------------------------
-- 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(0) NULL DEFAULT NULL COMMENT '创建时间',
  `rec_status` tinyint(4) NULL DEFAULT NULL COMMENT '状态，0：激活，1：禁用',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  `password` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '登录密码',
  `real_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '真实姓名',
  `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱',
  `phone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电话',
  `sex` tinyint(4) NULL DEFAULT NULL COMMENT '性别， 0：男， 1：女',
  `status` int(11) NULL DEFAULT NULL,
  `identity` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `UK_otre5hu4a8l06mv2smplvl0fe`(`identity`) USING BTREE,
  UNIQUE INDEX `UK_dx61ph83p21e9y80scx92i39p`(`user_name`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of tb_user
-- ----------------------------
INSERT INTO `tb_user` VALUES (1, '2020-03-11 18:15:02', 0, '2020-03-11 18:24:40', 'c44b01947c9e6e3f', '超级管理员', 'string', '12345678901', 0, 0, NULL, 'admin');
INSERT INTO `tb_user` VALUES (2, '2020-02-20 12:21:23', 0, '2020-02-20 12:21:23', '2c01ba92b4dab363', '普通用户', 'string', '15012345678', 0, 0, '5536', 'root');
INSERT INTO `tb_user` VALUES (3, '2020-02-20 17:38:38', 0, '2020-02-20 17:38:38', '52c356a463b5d4fc', '普通用户', 'string', '1234567890', 0, 0, '1234', 'owen');

-- ----------------------------
-- 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`) USING BTREE,
  INDEX `role_id`(`role_id`) USING BTREE,
  CONSTRAINT `tb_user_role_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `tb_user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `tb_user_role_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `tb_role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户角色关系表' ROW_FORMAT = Dynamic;

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

SET FOREIGN_KEY_CHECKS = 1;
