/*
 Navicat Premium Data Transfer

 Source Server         : 测试
 Source Server Type    : MariaDB
 Source Server Version : 100318
 Source Host           : test.tall.wiki:3306
 Source Schema         : form

 Target Server Type    : MariaDB
 Target Server Version : 100318
 File Encoding         : 65001

 Date: 13/05/2021 15:10:40
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for t_common_file
-- ----------------------------
DROP TABLE IF EXISTS `t_common_file`;
CREATE TABLE `t_common_file`  (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '上传用户ID',
  `file_name` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '文件名',
  `location` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '存储位置',
  `visit_location` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '访问位置',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp COMMENT '创建时间',
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态 0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文件表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_form_basic
-- ----------------------------
DROP TABLE IF EXISTS `t_form_basic`;
CREATE TABLE `t_form_basic`  (
  `id` bigint(20) NOT NULL,
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '标题',
  `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '描述',
  `cover_image` bigint(20) NULL DEFAULT 0 COMMENT '封面图片文件的id',
  `access_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '访问路径',
  `qrcode_path` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '二维码路径',
  `submit_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '提交状态：0否 1是。新建表单默认0',
  `user_id` bigint(20) NULL DEFAULT 0 COMMENT 'tall内的用户id',
  `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '表单基本信息表' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_form_module
-- ----------------------------
DROP TABLE IF EXISTS `t_form_module`;
CREATE TABLE `t_form_module`  (
  `id` bigint(20) NOT NULL,
  `form_id` bigint(20) NULL DEFAULT 0 COMMENT '表单id',
  `module_id` bigint(20) NULL DEFAULT 0 COMMENT '组件id',
  `sequence` int(11) NULL DEFAULT 0 COMMENT '排序',
  `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `form_index`(`form_id`) USING BTREE,
  INDEX `module_index`(`module_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '表单组件关联表' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_form_module_config
-- ----------------------------
DROP TABLE IF EXISTS `t_form_module_config`;
CREATE TABLE `t_form_module_config`  (
  `id` bigint(20) NOT NULL,
  `form_module_id` bigint(20) NULL DEFAULT 0 COMMENT '表单内容id',
  `type` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '类型 0显示 1校验 2统计',
  `config_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '配置类型（title：标题;defaultValue：默认值;placeholder：占位符;...参考金数据）',
  `config_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '配置的内容',
  `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `form_module_index`(`form_module_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '表单内组件配置表' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_form_module_option
-- ----------------------------
DROP TABLE IF EXISTS `t_form_module_option`;
CREATE TABLE `t_form_module_option`  (
  `id` bigint(20) NOT NULL,
  `form_module_id` bigint(20) NULL DEFAULT 0 COMMENT '表单内组件id',
  `parent_id` bigint(20) NULL DEFAULT 0 COMMENT '上级Id',
  `option_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'key',
  `option_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'value',
  `sequence` int(11) NULL DEFAULT 0 COMMENT '排序',
  `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `form_module_index`(`form_module_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '选项表' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_form_user
-- ----------------------------
DROP TABLE IF EXISTS `t_form_user`;
CREATE TABLE `t_form_user`  (
  `id` bigint(20) NOT NULL,
  `form_id` bigint(20) NULL DEFAULT 0 COMMENT '表单id',
  `user_id` bigint(20) NULL DEFAULT 0 COMMENT 'tall内的用户id',
  `user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '用户名',
  `avatar_url` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '头像',
  `submit_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '提交状态：0否 1是',
  `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `form_index`(`form_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户填写表单信息' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_form_write
-- ----------------------------
DROP TABLE IF EXISTS `t_form_write`;
CREATE TABLE `t_form_write`  (
  `id` bigint(20) NOT NULL,
  `form_user_id` bigint(20) NULL DEFAULT 0 COMMENT '用户与表单关联信息',
  `form_module_id` bigint(20) NULL DEFAULT 0 COMMENT '表单内组件id',
  `option_id` bigint(20) NULL DEFAULT 0 COMMENT '选项id',
  `answer` varchar(5000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '答案（填写的内容）',
  `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `form_user_index`(`form_user_id`) USING BTREE,
  INDEX `form_module_index`(`form_module_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户填写内容表' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_module
-- ----------------------------
DROP TABLE IF EXISTS `t_module`;
CREATE TABLE `t_module`  (
  `id` bigint(20) NOT NULL,
  `type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '组件类型 （单选：radio）（多选：checkBox）（下拉菜单：pullDown）（文本：text）（多行文本：textarea）（富文本：richText）（日期：date）',
  `logo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '左边栏展示的组件的图标',
  `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '组件名称',
  `option` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '是否有选项 0否 1是 默认0',
  `hierarchy` tinyint(1) UNSIGNED NULL DEFAULT 1 COMMENT '关联层级数',
  `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '组件模板表' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for t_module_config
-- ----------------------------
DROP TABLE IF EXISTS `t_module_config`;
CREATE TABLE `t_module_config`  (
  `id` bigint(20) NOT NULL,
  `module_id` bigint(20) NULL DEFAULT 0 COMMENT '组件的id',
  `type` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '类型 0显示 1校验 2统计',
  `config_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '配置类型（title：标题;defaultValue：默认值;placeholder：占位符;...参考金数据）',
  `config_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '配置的内容',
  `operator` bigint(20) NULL DEFAULT 0 COMMENT '操作人id',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE CURRENT_TIMESTAMP,
  `rec_status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '状态，0正常 1禁用 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `config_module_index`(`module_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '组件类型配置表(默认)' ROW_FORMAT = Compact;

SET FOREIGN_KEY_CHECKS = 1;


