4891 lines
294 KiB
SQL
4891 lines
294 KiB
SQL
/*
|
||
Navicat Premium Dump SQL
|
||
|
||
Source Server : 121.43.228.102 hn02le.34lkdLKD
|
||
Source Server Type : MySQL
|
||
Source Server Version : 50736 (5.7.36)
|
||
Source Host : 121.43.228.102:3306
|
||
Source Schema : sx
|
||
|
||
Target Server Type : MySQL
|
||
Target Server Version : 50736 (5.7.36)
|
||
File Encoding : 65001
|
||
|
||
Date: 30/05/2026 13:56:15
|
||
*/
|
||
|
||
SET NAMES utf8mb4;
|
||
SET FOREIGN_KEY_CHECKS = 0;
|
||
|
||
-- ----------------------------
|
||
-- Table structure for bx_advance_apply
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `bx_advance_apply`;
|
||
CREATE TABLE `bx_advance_apply` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`apply_code` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '申请单号(如 BYJ20260424001)',
|
||
`applicant_id` bigint(20) NOT NULL COMMENT '申请人用户ID',
|
||
`applicant_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '申请人姓名(冗余)',
|
||
`reason` varchar(1024) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '申请原因',
|
||
`purpose` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '申请目的',
|
||
`expense_item_id` bigint(20) DEFAULT NULL COMMENT '费用项目ID',
|
||
`amount` decimal(14,2) NOT NULL COMMENT '申请金额',
|
||
`status` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'draft' COMMENT '状态:draft-草稿 pending-待审批 approved-审批通过 rejected-审批驳回 issued-已发放',
|
||
`current_node` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '当前审批节点名称',
|
||
`wf_id` bigint(20) DEFAULT NULL COMMENT '关联工作流定义ID',
|
||
`issue_status` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '发放状态:unissued-未发放 issued-已发放',
|
||
`issue_time` datetime DEFAULT NULL COMMENT '发放时间',
|
||
`issue_user_id` bigint(20) DEFAULT NULL COMMENT '发放操作人ID',
|
||
`issue_user_name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '发放操作人姓名',
|
||
`issue_remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '发放备注',
|
||
`actual_amount` decimal(14,2) DEFAULT NULL COMMENT '实际发放金额',
|
||
`remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
|
||
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
|
||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
|
||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_apply_code` (`apply_code`) USING BTREE,
|
||
KEY `idx_applicant_id` (`applicant_id`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='备用金申请单';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for bx_advance_approval
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `bx_advance_approval`;
|
||
CREATE TABLE `bx_advance_approval` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`apply_id` bigint(20) NOT NULL COMMENT '备用金申请单ID',
|
||
`node_order` int(11) NOT NULL COMMENT '节点顺序',
|
||
`node_name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '节点名称',
|
||
`approver_id` bigint(20) NOT NULL COMMENT '审批人用户ID',
|
||
`approver_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '审批人姓名',
|
||
`approval_status` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '审批结果:approved-通过 rejected-驳回',
|
||
`approval_opinion` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '审批意见',
|
||
`approval_time` datetime NOT NULL COMMENT '审批时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_apply_id` (`apply_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='备用金审批记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for bx_attachment
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `bx_attachment`;
|
||
CREATE TABLE `bx_attachment` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`biz_type` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '业务类型:advance-备用金 reimburse-报销 advance_issue-备用金发放',
|
||
`biz_id` bigint(20) NOT NULL COMMENT '业务单据ID',
|
||
`file_name` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件名',
|
||
`file_path` varchar(512) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件存储路径',
|
||
`file_type` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||
`file_size` bigint(20) DEFAULT NULL COMMENT '文件大小(字节)',
|
||
`attach_type` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT 'attachment' COMMENT '附件类型:invoice-发票 attachment-普通附件 issue_proof-发放截图',
|
||
`sort_order` int(11) NOT NULL DEFAULT '0' COMMENT '排序号',
|
||
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
|
||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_biz` (`biz_type`,`biz_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=150 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='附件表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for bx_expense_item
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `bx_expense_item`;
|
||
CREATE TABLE `bx_expense_item` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`parent_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '父级项目ID(0为一级项目)',
|
||
`item_name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '项目名称',
|
||
`item_code` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '项目编码',
|
||
`level` tinyint(4) NOT NULL DEFAULT '1' COMMENT '层级:1-一级 2-二级',
|
||
`sort_order` int(11) NOT NULL DEFAULT '0' COMMENT '排序号',
|
||
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态:1-启用 0-禁用',
|
||
`remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
|
||
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
|
||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
|
||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_parent_id` (`parent_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='费用项目表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for bx_menu
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `bx_menu`;
|
||
CREATE TABLE `bx_menu` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`parent_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '父级菜单ID(0为顶级)',
|
||
`menu_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '菜单名称',
|
||
`menu_code` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '菜单编码(前端路由标识)',
|
||
`menu_type` tinyint(4) NOT NULL COMMENT '菜单类型:1-目录 2-菜单页 3-按钮/操作',
|
||
`path` varchar(256) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '路由路径',
|
||
`icon` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '菜单图标',
|
||
`sort_order` int(11) NOT NULL DEFAULT '0' COMMENT '排序号',
|
||
`visible` tinyint(4) NOT NULL DEFAULT '1' COMMENT '是否可见:1-可见 0-隐藏',
|
||
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态:1-启用 0-禁用',
|
||
`remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
|
||
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
|
||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
|
||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_parent_id` (`parent_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=405 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='报销系统菜单表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for bx_menu_role
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `bx_menu_role`;
|
||
CREATE TABLE `bx_menu_role` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`menu_id` bigint(20) NOT NULL COMMENT '菜单ID',
|
||
`role_id` bigint(20) NOT NULL COMMENT '角色ID',
|
||
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
|
||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_menu_role` (`menu_id`,`role_id`) USING BTREE,
|
||
KEY `idx_role_id` (`role_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=108 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='菜单-角色关联表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for bx_reimburse_apply
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `bx_reimburse_apply`;
|
||
CREATE TABLE `bx_reimburse_apply` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`apply_code` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '报销单号(如 BX20260424001)',
|
||
`title` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '报销标题',
|
||
`applicant_id` bigint(20) NOT NULL COMMENT '申请人用户ID',
|
||
`applicant_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '申请人姓名(冗余)',
|
||
`expense_id` bigint(20) NOT NULL COMMENT '费用项目ID(二级项目)',
|
||
`expense_name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '费用项目名称(冗余)',
|
||
`amount` decimal(14,2) NOT NULL COMMENT '报销金额',
|
||
`invoice_count` int(11) NOT NULL DEFAULT '0' COMMENT '发票数量',
|
||
`attach_count` int(11) NOT NULL DEFAULT '0' COMMENT '附件数量',
|
||
`status` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'draft' COMMENT '状态:draft-草稿 pending-待审批 approved-审批通过 rejected-审批驳回 paid-已发放 offset-已冲抵',
|
||
`current_node` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '当前审批节点名称',
|
||
`wf_id` bigint(20) DEFAULT NULL COMMENT '关联工作流定义ID',
|
||
`pay_status` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付状态:unpaid-未支付 paid-已发放 offset-已冲抵',
|
||
`pay_time` datetime DEFAULT NULL COMMENT '支付时间',
|
||
`pay_user_id` bigint(20) DEFAULT NULL COMMENT '支付操作人ID',
|
||
`pay_user_name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付操作人姓名',
|
||
`actual_amount` decimal(14,2) DEFAULT NULL COMMENT '实际发放金额',
|
||
`offset_advance_id` bigint(20) DEFAULT NULL COMMENT '冲抵关联的备用金单ID',
|
||
`offset_amount` decimal(14,2) DEFAULT NULL COMMENT '冲抵金额',
|
||
`remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注说明',
|
||
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
|
||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
|
||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_apply_code` (`apply_code`) USING BTREE,
|
||
KEY `idx_applicant_id` (`applicant_id`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_expense_id` (`expense_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='报销申请单';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for bx_reimburse_approval
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `bx_reimburse_approval`;
|
||
CREATE TABLE `bx_reimburse_approval` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`apply_id` bigint(20) NOT NULL COMMENT '报销申请单ID',
|
||
`node_order` int(11) NOT NULL COMMENT '节点顺序',
|
||
`node_name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '节点名称',
|
||
`approver_id` bigint(20) NOT NULL COMMENT '审批人用户ID',
|
||
`approver_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '审批人姓名',
|
||
`approval_status` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '审批结果:approved-通过 rejected-驳回',
|
||
`approval_opinion` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '审批意见',
|
||
`approval_time` datetime NOT NULL COMMENT '审批时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_apply_id` (`apply_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='报销审批记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for bx_reimburse_detail
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `bx_reimburse_detail`;
|
||
CREATE TABLE `bx_reimburse_detail` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||
`reimburse_id` bigint(20) NOT NULL COMMENT '报销单ID',
|
||
`expense_id` bigint(20) NOT NULL COMMENT '费用项目ID',
|
||
`expense_name` varchar(128) NOT NULL COMMENT '费用项目名称',
|
||
`amount` decimal(14,2) NOT NULL COMMENT '报销金额',
|
||
`remark` varchar(512) DEFAULT NULL COMMENT '备注',
|
||
`del_flag` smallint(6) NOT NULL DEFAULT '0',
|
||
`create_by` varchar(64) DEFAULT NULL,
|
||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
`update_by` varchar(64) DEFAULT NULL,
|
||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_reimburse_id` (`reimburse_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8mb4 COMMENT='报销明细';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for bx_reimburse_offset
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `bx_reimburse_offset`;
|
||
CREATE TABLE `bx_reimburse_offset` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`reimburse_id` bigint(20) NOT NULL COMMENT '报销申请单ID',
|
||
`advance_id` bigint(20) NOT NULL COMMENT '备用金申请单ID',
|
||
`offset_amount` decimal(14,2) NOT NULL COMMENT '冲抵金额',
|
||
`remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
|
||
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
|
||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_reimburse_id` (`reimburse_id`) USING BTREE,
|
||
KEY `idx_advance_id` (`advance_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='报销单-备用金冲抵关联表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for bx_role
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `bx_role`;
|
||
CREATE TABLE `bx_role` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`role_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '角色名称',
|
||
`role_code` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '角色编码(如 ADMIN、FINANCE、EMPLOYEE)',
|
||
`sort_order` int(11) NOT NULL DEFAULT '0' COMMENT '排序号',
|
||
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态:1-启用 0-禁用',
|
||
`remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
|
||
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
|
||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
|
||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_role_code` (`role_code`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='角色表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for bx_role_user
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `bx_role_user`;
|
||
CREATE TABLE `bx_role_user` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`role_id` bigint(20) NOT NULL COMMENT '角色ID',
|
||
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
|
||
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
|
||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_role_user` (`role_id`,`user_id`) USING BTREE,
|
||
KEY `idx_user_id` (`user_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='角色-用户关联表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for bx_user
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `bx_user`;
|
||
CREATE TABLE `bx_user` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`username` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户名(登录账号)',
|
||
`password` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '密码(加密存储)',
|
||
`real_name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '真实姓名',
|
||
`phone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '手机号',
|
||
`email` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '邮箱',
|
||
`avatar` varchar(256) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '头像URL',
|
||
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态:1-启用 0-禁用',
|
||
`remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
|
||
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
|
||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
|
||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_username` (`username`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for bx_workflow_def
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `bx_workflow_def`;
|
||
CREATE TABLE `bx_workflow_def` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`biz_type` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '业务类型:advance-备用金 reimburse-报销单',
|
||
`wf_name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '工作流名称',
|
||
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态:1-启用 0-禁用',
|
||
`remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
|
||
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
|
||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
|
||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标记:0-正常 1-已删除',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_biz_type` (`biz_type`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='工作流定义表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for bx_workflow_node
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `bx_workflow_node`;
|
||
CREATE TABLE `bx_workflow_node` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`wf_id` bigint(20) NOT NULL COMMENT '工作流定义ID',
|
||
`node_name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '节点名称(如:主管审批、财务复核)',
|
||
`node_order` int(11) NOT NULL DEFAULT '0' COMMENT '节点顺序(从小到大执行)',
|
||
`approver_id` bigint(20) DEFAULT NULL COMMENT '审批人用户ID',
|
||
`approver_name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '审批人姓名(冗余)',
|
||
`create_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
|
||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
|
||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_wf_id` (`wf_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='工作流节点表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_clue
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_clue`;
|
||
CREATE TABLE `crm_clue` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`clue_name` varchar(100) NOT NULL COMMENT '线索姓名',
|
||
`mobile` varchar(20) NOT NULL COMMENT '手机号',
|
||
`company` varchar(200) DEFAULT NULL COMMENT '公司名称',
|
||
`customer_type` varchar(20) DEFAULT NULL COMMENT '客户类型(company-企业/person-个人)',
|
||
`telephone` varchar(30) DEFAULT NULL COMMENT '固定电话',
|
||
`email` varchar(100) DEFAULT NULL COMMENT '邮箱',
|
||
`title` varchar(10) DEFAULT NULL COMMENT '称呼(先生/女士/其他)',
|
||
`position` varchar(50) DEFAULT NULL COMMENT '职位',
|
||
`source` varchar(20) NOT NULL COMMENT '线索来源(网站留言/电话咨询/展会/市场活动/老客户推荐/广告投放/社交媒体/其他)',
|
||
`level` varchar(10) DEFAULT 'unrated' COMMENT '线索等级(A/B/C/unrated)',
|
||
`industry` varchar(50) DEFAULT NULL COMMENT '所属行业',
|
||
`park_area` varchar(100) DEFAULT NULL COMMENT '所在园区',
|
||
`province` varchar(50) DEFAULT NULL COMMENT '省',
|
||
`city` varchar(50) DEFAULT NULL COMMENT '市',
|
||
`district` varchar(50) DEFAULT NULL COMMENT '区',
|
||
`address` varchar(255) DEFAULT NULL COMMENT '详细地址',
|
||
`website` varchar(500) DEFAULT NULL COMMENT '客户网站',
|
||
`intent_products` varchar(500) DEFAULT NULL COMMENT '意向产品(多个用逗号分隔)',
|
||
`expect_time` date DEFAULT NULL COMMENT '预计购买时间',
|
||
`budget` varchar(20) DEFAULT NULL COMMENT '预算范围(1万以下/1-5万/5-10万/10-50万/50万以上/未知)',
|
||
`requirement` text COMMENT '需求描述',
|
||
`status` varchar(20) DEFAULT 'new' COMMENT '线索状态(new-新线索/follow-跟进中/invalid-无效/converted-已转化)',
|
||
`owner_user_id` bigint(20) DEFAULT NULL COMMENT '负责人ID',
|
||
`owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
|
||
`last_time` datetime DEFAULT NULL COMMENT '最后跟进时间',
|
||
`next_time` datetime DEFAULT NULL COMMENT '下次联系时间',
|
||
`follow_count` int(11) DEFAULT '0' COMMENT '跟进次数',
|
||
`is_converted` tinyint(1) DEFAULT '0' COMMENT '是否已转化(0-否 1-是)',
|
||
`converted_time` datetime DEFAULT NULL COMMENT '转化时间',
|
||
`customer_id` bigint(20) DEFAULT NULL COMMENT '转化的客户ID',
|
||
`converted_by` bigint(20) DEFAULT NULL COMMENT '转化操作人',
|
||
`assign_time` datetime DEFAULT NULL COMMENT '分配时间',
|
||
`assign_by` bigint(20) DEFAULT NULL COMMENT '分配人',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_mobile` (`mobile`) USING BTREE,
|
||
KEY `idx_owner` (`owner_user_id`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_level` (`level`) USING BTREE,
|
||
KEY `idx_source` (`source`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||
KEY `idx_next_time` (`next_time`) USING BTREE,
|
||
KEY `idx_tenant` (`tenant_id`) USING BTREE,
|
||
KEY `idx_park_area` (`park_area`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-线索主表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_clue_follow
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_clue_follow`;
|
||
CREATE TABLE `crm_clue_follow` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`clue_id` bigint(20) NOT NULL COMMENT '线索ID',
|
||
`clue_name` varchar(100) DEFAULT NULL COMMENT '线索姓名(冗余)',
|
||
`follow_type` varchar(20) NOT NULL COMMENT '跟进方式(电话/微信/邮件/拜访/其他)',
|
||
`follow_content` text NOT NULL COMMENT '跟进内容',
|
||
`next_time` datetime DEFAULT NULL COMMENT '下次联系时间',
|
||
`attachments` varchar(1000) DEFAULT NULL COMMENT '附件(多个用逗号分隔)',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者(跟进人)',
|
||
`create_by_name` varchar(50) DEFAULT NULL COMMENT '跟进人姓名(冗余)',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(跟进时间)',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_clue_id` (`clue_id`) USING BTREE,
|
||
KEY `idx_create_by` (`create_by`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||
KEY `idx_next_time` (`next_time`) USING BTREE,
|
||
KEY `idx_tenant` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-线索跟进记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_contact
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_contact`;
|
||
CREATE TABLE `crm_contact` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
|
||
`customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余)',
|
||
`contact_name` varchar(100) NOT NULL COMMENT '联系人姓名',
|
||
`gender` varchar(10) DEFAULT NULL COMMENT '性别(male-男/female-女)',
|
||
`mobile` varchar(20) DEFAULT NULL COMMENT '手机号',
|
||
`telephone` varchar(30) DEFAULT NULL COMMENT '固定电话',
|
||
`email` varchar(100) DEFAULT NULL COMMENT '邮箱',
|
||
`wechat` varchar(100) DEFAULT NULL COMMENT '微信号',
|
||
`qq` varchar(20) DEFAULT NULL COMMENT 'QQ号',
|
||
`department` varchar(100) DEFAULT NULL COMMENT '部门',
|
||
`position` varchar(50) DEFAULT NULL COMMENT '职位',
|
||
`role` varchar(20) DEFAULT NULL COMMENT '角色(decision-决策人/manager-管理者/user-使用者/other-其他)',
|
||
`birthday` date DEFAULT NULL COMMENT '生日',
|
||
`address` varchar(255) DEFAULT NULL COMMENT '住址',
|
||
`is_key` tinyint(1) DEFAULT '0' COMMENT '是否关键决策人(0-否 1-是)',
|
||
`is_primary` tinyint(1) DEFAULT '0' COMMENT '是否主要联系人(0-否 1-是)',
|
||
`status` varchar(20) DEFAULT 'active' COMMENT '状态(active-在职/leave-离职)',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_customer_id` (`customer_id`) USING BTREE,
|
||
KEY `idx_mobile` (`mobile`) USING BTREE,
|
||
KEY `idx_is_key` (`is_key`) USING BTREE,
|
||
KEY `idx_tenant` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=2060210419503165443 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-联系人表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_contract
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_contract`;
|
||
CREATE TABLE `crm_contract` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`contract_no` varchar(50) NOT NULL COMMENT '合同编号(CON+yyyyMMdd+4位流水号)',
|
||
`contract_name` varchar(200) NOT NULL COMMENT '合同名称',
|
||
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
|
||
`customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
|
||
`opportunity_id` bigint(20) DEFAULT NULL COMMENT '商机ID',
|
||
`quote_id` bigint(20) DEFAULT NULL COMMENT '报价单ID',
|
||
`parent_contract_id` bigint(20) DEFAULT NULL COMMENT '原合同ID(续签时关联)',
|
||
`renewal_count` int(11) DEFAULT '0' COMMENT '续签次数',
|
||
`template_id` bigint(20) DEFAULT NULL COMMENT '合同模板ID',
|
||
`contract_template` varchar(50) DEFAULT 'shanxia' COMMENT '合同模版(shanxia-山峡模版/customer-客户模版)',
|
||
`contact_id` bigint(20) DEFAULT NULL COMMENT '联系人ID',
|
||
`contact_name` varchar(50) DEFAULT NULL COMMENT '联系人姓名(冗余字段)',
|
||
`contact_mobile` varchar(20) DEFAULT NULL COMMENT '联系人手机(冗余字段)',
|
||
`contract_type` varchar(20) NOT NULL DEFAULT 'sale' COMMENT '合同类型(sale-销售合同/service-服务合同/lease-租赁合同/other-其他)',
|
||
`contract_nature` varchar(20) DEFAULT 'new' COMMENT '合同性质(new-新签/renewal-续签/change-变更)',
|
||
`amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '合同金额',
|
||
`currency` varchar(10) DEFAULT 'CNY' COMMENT '币种(CNY-人民币/USD-美元/EUR-欧元)',
|
||
`tax_rate` decimal(5,2) DEFAULT '6.00' COMMENT '税率(%)',
|
||
`amount_with_tax` decimal(15,2) DEFAULT '0.00' COMMENT '含税金额',
|
||
`sign_date` date DEFAULT NULL COMMENT '签订日期',
|
||
`actual_sign_date` date DEFAULT NULL COMMENT '实际签订日期',
|
||
`start_date` date DEFAULT NULL COMMENT '开始日期',
|
||
`end_date` date DEFAULT NULL COMMENT '结束日期',
|
||
`contract_period` int(11) DEFAULT NULL COMMENT '合同期限(月)',
|
||
`status` varchar(20) NOT NULL DEFAULT 'draft' COMMENT '合同状态(draft-草稿/approving-审批中/approved-已审批/executing-执行中/finished-已完成/invalid-已作废)',
|
||
`performance_status` varchar(20) DEFAULT 'normal' COMMENT '履约状态(normal-正常/delayed-延期/abnormal-异常/completed-已完成)',
|
||
`performance_rate` decimal(5,2) DEFAULT '0.00' COMMENT '履约完成度(%)',
|
||
`customer_satisfaction` int(11) DEFAULT NULL COMMENT '客户满意度(1-5星)',
|
||
`approval_status` varchar(20) DEFAULT NULL COMMENT '审批状态(pending-待审批/approved-已通过/rejected-已驳回)',
|
||
`approval_flow_id` bigint(20) DEFAULT NULL COMMENT '审批流程ID(关联工作流)',
|
||
`contract_file` varchar(500) DEFAULT NULL COMMENT '合同文件路径(扫描件或电子版)',
|
||
`attachment_files` varchar(1000) DEFAULT NULL COMMENT '附件文件(多个文件用逗号分隔)',
|
||
`owner_user_id` bigint(20) NOT NULL COMMENT '负责人ID',
|
||
`owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
|
||
`received_amount` decimal(15,2) DEFAULT '0.00' COMMENT '已回款金额',
|
||
`unreceived_amount` decimal(15,2) DEFAULT '0.00' COMMENT '未回款金额',
|
||
`invoice_amount` decimal(15,2) DEFAULT '0.00' COMMENT '已开票金额',
|
||
`uninvoice_amount` decimal(15,2) DEFAULT '0.00' COMMENT '未开票金额',
|
||
`party_a` varchar(200) DEFAULT NULL COMMENT '甲方(客户方)',
|
||
`party_a_address` varchar(255) DEFAULT NULL COMMENT '甲方地址',
|
||
`party_a_contact` varchar(50) DEFAULT NULL COMMENT '甲方联系人',
|
||
`party_a_mobile` varchar(20) DEFAULT NULL COMMENT '甲方联系电话',
|
||
`party_a_legal_person` varchar(50) DEFAULT NULL COMMENT '甲方法定代表人',
|
||
`party_a_agent` varchar(50) DEFAULT NULL COMMENT '甲方代理人',
|
||
`party_a_phone_fax` varchar(50) DEFAULT NULL COMMENT '甲方电话/传真',
|
||
`party_a_bank` varchar(100) DEFAULT NULL COMMENT '甲方开户银行',
|
||
`party_a_account` varchar(50) DEFAULT NULL COMMENT '甲方银行账号',
|
||
`party_b` varchar(200) DEFAULT NULL COMMENT '乙方(我方)',
|
||
`party_b_address` varchar(255) DEFAULT NULL COMMENT '乙方地址',
|
||
`party_b_contact` varchar(50) DEFAULT NULL COMMENT '乙方联系人',
|
||
`party_b_mobile` varchar(20) DEFAULT NULL COMMENT '乙方联系电话',
|
||
`party_b_legal_person` varchar(100) DEFAULT NULL COMMENT '乙方法定代表人',
|
||
`party_b_agent` varchar(100) DEFAULT NULL COMMENT '乙方代理人',
|
||
`party_b_phone_fax` varchar(100) DEFAULT NULL COMMENT '乙方电话/传真',
|
||
`party_b_bank` varchar(200) DEFAULT NULL COMMENT '乙方开户银行',
|
||
`party_b_account` varchar(100) DEFAULT NULL COMMENT '乙方银行账号',
|
||
`payment_terms` text COMMENT '付款条款',
|
||
`delivery_terms` text COMMENT '交付条款',
|
||
`contract_terms` text COMMENT '合同条款',
|
||
`invalid_reason` varchar(500) DEFAULT NULL COMMENT '作废原因',
|
||
`invalid_time` datetime DEFAULT NULL COMMENT '作废时间',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
`template_content` longtext COMMENT '合同模板内容(富文本HTML)',
|
||
`settlement_clause_drafts` longtext COMMENT '第五条结算方式草稿(按结算方式区分的JSON)',
|
||
`supplier_id` bigint(20) DEFAULT NULL COMMENT '供方主体ID(关联crm_supplier_info表)',
|
||
`settlement_method` varchar(50) DEFAULT NULL COMMENT '结算方式(arrive_payment-货到付款,advance_payment-款到发货)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_contract_no_del_flag` (`contract_no`,`del_flag`) USING BTREE,
|
||
KEY `idx_customer_id` (`customer_id`) USING BTREE,
|
||
KEY `idx_opportunity_id` (`opportunity_id`) USING BTREE,
|
||
KEY `idx_quote_id` (`quote_id`) USING BTREE,
|
||
KEY `idx_owner_user_id` (`owner_user_id`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_approval_status` (`approval_status`) USING BTREE,
|
||
KEY `idx_sign_date` (`sign_date`) USING BTREE,
|
||
KEY `idx_end_date` (`end_date`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||
KEY `idx_contract_nature` (`contract_nature`) USING BTREE,
|
||
KEY `idx_parent_contract_id` (`parent_contract_id`) USING BTREE,
|
||
KEY `idx_performance_status` (`performance_status`) USING BTREE,
|
||
KEY `idx_supplier_id` (`supplier_id`)
|
||
) ENGINE=InnoDB AUTO_INCREMENT=2060286352016764930 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-合同主表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_contract_approval
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_contract_approval`;
|
||
CREATE TABLE `crm_contract_approval` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`contract_id` bigint(20) NOT NULL COMMENT '合同ID',
|
||
`flow_id` bigint(20) DEFAULT NULL COMMENT '审批流程ID(关联工作流)',
|
||
`step` int(11) NOT NULL DEFAULT '1' COMMENT '审批步骤(第几步)',
|
||
`step_name` varchar(100) DEFAULT NULL COMMENT '步骤名称',
|
||
`approver_id` bigint(20) NOT NULL COMMENT '审批人ID',
|
||
`approver_name` varchar(50) DEFAULT NULL COMMENT '审批人姓名',
|
||
`approver_dept` varchar(100) DEFAULT NULL COMMENT '审批人部门',
|
||
`approval_result` varchar(20) DEFAULT 'pending' COMMENT '审批结果(pending-待审批/approved-已通过/rejected-已驳回)',
|
||
`approval_opinion` text COMMENT '审批意见',
|
||
`approval_time` datetime DEFAULT NULL COMMENT '审批时间',
|
||
`approval_duration` int(11) DEFAULT NULL COMMENT '审批耗时(小时)',
|
||
`attachments` varchar(1000) DEFAULT NULL COMMENT '附件',
|
||
`is_current` tinyint(1) DEFAULT '1' COMMENT '是否当前步骤(0否 1是)',
|
||
`sort` int(11) DEFAULT '0' COMMENT '排序号',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_contract_id` (`contract_id`) USING BTREE,
|
||
KEY `idx_approver_id` (`approver_id`) USING BTREE,
|
||
KEY `idx_approval_result` (`approval_result`) USING BTREE,
|
||
KEY `idx_is_current` (`is_current`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=2056245436624879618 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-合同审批记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_contract_change
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_contract_change`;
|
||
CREATE TABLE `crm_contract_change` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`contract_id` bigint(20) NOT NULL COMMENT '合同ID',
|
||
`contract_no` varchar(50) DEFAULT NULL COMMENT '合同编号(冗余)',
|
||
`change_type` varchar(50) NOT NULL COMMENT '变更类型(amount-金额变更/period-期限变更/product-产品变更/terms-条款变更/other-其他)',
|
||
`change_reason` varchar(500) NOT NULL COMMENT '变更原因',
|
||
`change_content` text COMMENT '变更内容描述',
|
||
`old_value` text COMMENT '变更前值(JSON格式)',
|
||
`new_value` text COMMENT '变更后值(JSON格式)',
|
||
`change_amount` decimal(15,2) DEFAULT NULL COMMENT '变更金额(用于金额变更)',
|
||
`approval_status` varchar(20) DEFAULT 'pending' COMMENT '审批状态(pending-待审批/approved-已通过/rejected-已驳回)',
|
||
`approver_id` bigint(20) DEFAULT NULL COMMENT '审批人ID',
|
||
`approver_name` varchar(50) DEFAULT NULL COMMENT '审批人姓名',
|
||
`approval_time` datetime DEFAULT NULL COMMENT '审批时间',
|
||
`approval_opinion` varchar(500) DEFAULT NULL COMMENT '审批意见',
|
||
`attachment_files` varchar(1000) DEFAULT NULL COMMENT '附件文件(变更协议等)',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_contract_id` (`contract_id`) USING BTREE,
|
||
KEY `idx_change_type` (`change_type`) USING BTREE,
|
||
KEY `idx_approval_status` (`approval_status`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-合同变更记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_contract_product
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_contract_product`;
|
||
CREATE TABLE `crm_contract_product` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`contract_id` bigint(20) NOT NULL COMMENT '合同ID',
|
||
`product_id` bigint(20) NOT NULL COMMENT '产品ID',
|
||
`product_name` varchar(200) NOT NULL COMMENT '产品名称',
|
||
`product_no` varchar(50) DEFAULT NULL COMMENT '产品编号',
|
||
`category_id` bigint(20) DEFAULT NULL COMMENT '产品分类ID',
|
||
`category_name` varchar(100) DEFAULT NULL COMMENT '产品分类名称',
|
||
`model` varchar(100) DEFAULT NULL COMMENT '规格型号',
|
||
`unit` varchar(20) DEFAULT '件' COMMENT '单位',
|
||
`quantity` decimal(20,4) NOT NULL COMMENT '数量',
|
||
`price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '单价',
|
||
`discount` decimal(5,2) DEFAULT '0.00' COMMENT '折扣(百分比)',
|
||
`tax_rate` decimal(5,2) DEFAULT '6.00' COMMENT '税率(%)',
|
||
`tax_amount` decimal(15,2) DEFAULT '0.00' COMMENT '税费金额',
|
||
`subtotal` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '小计金额',
|
||
`delivery_date` date DEFAULT NULL COMMENT '交付日期',
|
||
`delivery_status` varchar(20) DEFAULT 'pending' COMMENT '交付状态(pending-待交付/partial-部分交付/delivered-已交付)',
|
||
`delivered_quantity` decimal(20,4) DEFAULT '0.0000' COMMENT '已交付数量',
|
||
`description` varchar(1000) DEFAULT NULL COMMENT '产品描述',
|
||
`package_spec` varchar(200) DEFAULT NULL COMMENT '包装规格',
|
||
`delivery_method` varchar(100) DEFAULT NULL COMMENT '送货方式',
|
||
`sort` int(11) DEFAULT '0' COMMENT '排序号',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_contract_id` (`contract_id`) USING BTREE,
|
||
KEY `idx_product_id` (`product_id`) USING BTREE,
|
||
KEY `idx_delivery_status` (`delivery_status`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=2060288831366328322 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-合同产品明细表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_contract_product_price_tier
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_contract_product_price_tier`;
|
||
CREATE TABLE `crm_contract_product_price_tier` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`contract_id` bigint(20) NOT NULL COMMENT '合同ID',
|
||
`contract_product_id` bigint(20) NOT NULL COMMENT '合同产品明细ID',
|
||
`start_date` date NOT NULL COMMENT '区间开始日期',
|
||
`end_date` date NOT NULL COMMENT '区间结束日期',
|
||
`price` decimal(15,2) NOT NULL COMMENT '含税单价',
|
||
`letter_oss_ids` varchar(4000) DEFAULT NULL COMMENT '调价函OSS ID列表(JSON字符串数组,如["id1","id2"])',
|
||
`letter_oss_id` bigint(20) DEFAULT NULL COMMENT '调价函单附件OSS ID(废弃,请使用 letter_oss_ids)',
|
||
`sort` int(11) DEFAULT '0' COMMENT '排序号',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
PRIMARY KEY (`id`),
|
||
KEY `idx_contract_id` (`contract_id`),
|
||
KEY `idx_contract_product_id` (`contract_product_id`)
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-框架合同产品调价区间';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_contract_template
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_contract_template`;
|
||
CREATE TABLE `crm_contract_template` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`template_no` varchar(50) NOT NULL COMMENT '模板编号',
|
||
`template_name` varchar(200) NOT NULL COMMENT '模板名称',
|
||
`contract_type` varchar(20) DEFAULT NULL COMMENT '适用合同类型(sale-销售/service-服务等)',
|
||
`template_content` text COMMENT '模板内容(富文本)',
|
||
`payment_terms` text COMMENT '付款条款模板',
|
||
`delivery_terms` text COMMENT '交付条款模板',
|
||
`contract_terms` text COMMENT '合同条款模板',
|
||
`party_b` varchar(200) DEFAULT NULL COMMENT '乙方(我方)默认名称',
|
||
`party_b_address` varchar(255) DEFAULT NULL COMMENT '乙方地址',
|
||
`party_b_contact` varchar(50) DEFAULT NULL COMMENT '乙方联系人',
|
||
`party_b_mobile` varchar(20) DEFAULT NULL COMMENT '乙方联系电话',
|
||
`default_currency` varchar(10) DEFAULT 'CNY' COMMENT '默认币种',
|
||
`default_tax_rate` decimal(5,2) DEFAULT '6.00' COMMENT '默认税率(%)',
|
||
`default_period` int(11) DEFAULT '12' COMMENT '默认合同期限(月)',
|
||
`is_active` tinyint(1) DEFAULT '1' COMMENT '是否启用(0-停用 1-启用)',
|
||
`usage_count` int(11) DEFAULT '0' COMMENT '使用次数',
|
||
`sort` int(11) DEFAULT '0' COMMENT '排序号',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_template_no` (`template_no`) USING BTREE,
|
||
KEY `idx_contract_type` (`contract_type`) USING BTREE,
|
||
KEY `idx_is_active` (`is_active`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-合同模板表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_customer
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_customer`;
|
||
CREATE TABLE `crm_customer` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`customer_no` varchar(50) NOT NULL COMMENT '客户编号(唯一)',
|
||
`customer_name` varchar(200) NOT NULL COMMENT '客户名称',
|
||
`short_name` varchar(100) DEFAULT NULL COMMENT '客户简称',
|
||
`customer_type` varchar(20) DEFAULT 'company' COMMENT '客户类型(company-企业/person-个人)',
|
||
`mobile` varchar(20) DEFAULT NULL COMMENT '手机号',
|
||
`telephone` varchar(30) DEFAULT NULL COMMENT '固定电话',
|
||
`email` varchar(100) DEFAULT NULL COMMENT '邮箱',
|
||
`website` varchar(500) DEFAULT NULL COMMENT '客户网站',
|
||
`level` varchar(20) DEFAULT 'normal' COMMENT '客户级别(key-重点/normal-普通/potential-潜在)',
|
||
`source` varchar(20) DEFAULT NULL COMMENT '客户来源',
|
||
`industry` varchar(50) DEFAULT NULL COMMENT '所属行业',
|
||
`park_area` varchar(100) DEFAULT NULL COMMENT '所在园区',
|
||
`payment_terms` varchar(500) DEFAULT NULL COMMENT '收付款条件(如:预付30%、账期30天等)',
|
||
`scale` varchar(20) DEFAULT NULL COMMENT '企业规模(1-50人/50-200人/200-500人/500人以上)',
|
||
`province` varchar(50) DEFAULT NULL COMMENT '省',
|
||
`city` varchar(50) DEFAULT NULL COMMENT '市',
|
||
`district` varchar(50) DEFAULT NULL COMMENT '区',
|
||
`address` varchar(255) DEFAULT NULL COMMENT '详细地址',
|
||
`status` varchar(20) DEFAULT 'normal' COMMENT '客户状态(normal-正常/pool-公海/invalid-无效)',
|
||
`deal_status` varchar(20) DEFAULT 'not_deal' COMMENT '成交状态(not_deal-未成交/dealed-已成交/lost-已流失)',
|
||
`owner_user_id` bigint(20) DEFAULT NULL COMMENT '负责人ID',
|
||
`owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余)',
|
||
`last_time` datetime DEFAULT NULL COMMENT '最后跟进时间',
|
||
`next_time` datetime DEFAULT NULL COMMENT '下次联系时间',
|
||
`follow_count` int(11) DEFAULT '0' COMMENT '跟进次数',
|
||
`deal_time` datetime DEFAULT NULL COMMENT '成交时间',
|
||
`deal_amount` decimal(15,2) DEFAULT '0.00' COMMENT '累计成交金额',
|
||
`contact_count` int(11) DEFAULT '0' COMMENT '联系人数量',
|
||
`opportunity_count` int(11) DEFAULT '0' COMMENT '商机数量',
|
||
`contract_count` int(11) DEFAULT '0' COMMENT '合同数量',
|
||
`into_pool_time` datetime DEFAULT NULL COMMENT '进入公海时间',
|
||
`into_pool_by` bigint(20) DEFAULT NULL COMMENT '进入公海操作人ID',
|
||
`into_pool_reason` varchar(500) DEFAULT NULL COMMENT '进入公海原因',
|
||
`claim_time` datetime DEFAULT NULL COMMENT '领取时间',
|
||
`assign_time` datetime DEFAULT NULL COMMENT '分配时间',
|
||
`assign_by` bigint(20) DEFAULT NULL COMMENT '分配人ID',
|
||
`protect_time` datetime DEFAULT NULL COMMENT '保护到期时间',
|
||
`clue_id` bigint(20) DEFAULT NULL COMMENT '关联线索ID(从线索转化)',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
`business_license_images` varchar(1000) DEFAULT NULL COMMENT '营业执照图片OSS ID(多个用逗号分隔)',
|
||
`business_permit_images` varchar(1000) DEFAULT NULL COMMENT '经营许可证图片OSS ID(多个用逗号分隔)',
|
||
`other_cert_images` varchar(1000) DEFAULT NULL COMMENT '其他证件图片OSS ID(多个用逗号分隔)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_customer_no_del_flag` (`customer_no`,`del_flag`) USING BTREE,
|
||
KEY `idx_mobile` (`mobile`) USING BTREE,
|
||
KEY `idx_owner` (`owner_user_id`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_level` (`level`) USING BTREE,
|
||
KEY `idx_deal_status` (`deal_status`) USING BTREE,
|
||
KEY `idx_source` (`source`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||
KEY `idx_next_time` (`next_time`) USING BTREE,
|
||
KEY `idx_clue` (`clue_id`) USING BTREE,
|
||
KEY `idx_tenant` (`tenant_id`) USING BTREE,
|
||
KEY `idx_park_area` (`park_area`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=2060210343636594690 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-客户主表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_customer_follow
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_customer_follow`;
|
||
CREATE TABLE `crm_customer_follow` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
|
||
`customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余)',
|
||
`contact_id` bigint(20) DEFAULT NULL COMMENT '联系人ID',
|
||
`contact_name` varchar(100) DEFAULT NULL COMMENT '联系人姓名(冗余)',
|
||
`follow_type` varchar(20) NOT NULL COMMENT '跟进方式(电话/微信/邮件/拜访/其他)',
|
||
`follow_content` text NOT NULL COMMENT '跟进内容',
|
||
`next_time` datetime DEFAULT NULL COMMENT '下次联系时间',
|
||
`attachments` varchar(1000) DEFAULT NULL COMMENT '附件(多个用逗号分隔)',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者(跟进人)',
|
||
`create_by_name` varchar(50) DEFAULT NULL COMMENT '跟进人姓名(冗余)',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(跟进时间)',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_customer_id` (`customer_id`) USING BTREE,
|
||
KEY `idx_contact_id` (`contact_id`) USING BTREE,
|
||
KEY `idx_create_by` (`create_by`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||
KEY `idx_next_time` (`next_time`) USING BTREE,
|
||
KEY `idx_tenant` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=1985641912854016003 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-客户跟进记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_customer_pool
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_customer_pool`;
|
||
CREATE TABLE `crm_customer_pool` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
|
||
`customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余)',
|
||
`operation_type` varchar(20) NOT NULL COMMENT '操作类型(into-进入公海/claim-领取/assign-分配/recycle-回收)',
|
||
`from_user_id` bigint(20) DEFAULT NULL COMMENT '原负责人ID',
|
||
`from_user_name` varchar(50) DEFAULT NULL COMMENT '原负责人姓名(冗余)',
|
||
`to_user_id` bigint(20) DEFAULT NULL COMMENT '新负责人ID',
|
||
`to_user_name` varchar(50) DEFAULT NULL COMMENT '新负责人姓名(冗余)',
|
||
`reason` varchar(500) DEFAULT NULL COMMENT '操作原因',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者(操作人)',
|
||
`create_by_name` varchar(50) DEFAULT NULL COMMENT '操作人姓名(冗余)',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(操作时间)',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_customer_id` (`customer_id`) USING BTREE,
|
||
KEY `idx_operation_type` (`operation_type`) USING BTREE,
|
||
KEY `idx_from_user` (`from_user_id`) USING BTREE,
|
||
KEY `idx_to_user` (`to_user_id`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||
KEY `idx_tenant` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=1991718802157080578 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-客户公海池记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_customer_pool_rule
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_customer_pool_rule`;
|
||
CREATE TABLE `crm_customer_pool_rule` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`pool_name` varchar(100) NOT NULL COMMENT '规则名称',
|
||
`rule_type` varchar(20) NOT NULL COMMENT '规则类型(no_follow-未跟进/no_deal-未成交)',
|
||
`timeout_days` int(11) NOT NULL COMMENT '超时天数(多少天未跟进/未成交)',
|
||
`protect_days` int(11) NOT NULL DEFAULT '0' COMMENT '保护期天数(领取后保护多少天)',
|
||
`status` varchar(20) DEFAULT 'enable' COMMENT '状态(enable-启用/disable-禁用)',
|
||
`sort` int(11) DEFAULT '0' COMMENT '排序号',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_rule_type` (`rule_type`) USING BTREE,
|
||
KEY `idx_sort` (`sort`) USING BTREE,
|
||
KEY `idx_tenant` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-客户公海池规则表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_customer_tag
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_customer_tag`;
|
||
CREATE TABLE `crm_customer_tag` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`tag_name` varchar(50) NOT NULL COMMENT '标签名称',
|
||
`tag_color` varchar(20) DEFAULT '#409EFF' COMMENT '标签颜色(十六进制颜色值)',
|
||
`tag_type` varchar(20) DEFAULT 'custom' COMMENT '标签类型(system-系统预设/custom-自定义)',
|
||
`sort_order` int(11) DEFAULT '0' COMMENT '排序号',
|
||
`share_scope` varchar(20) DEFAULT 'private' COMMENT '共享范围(private-个人/dept-部门/company-公司)',
|
||
`create_user_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||
`create_user_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||
`use_count` int(11) DEFAULT '0' COMMENT '使用次数',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_tag_name` (`tag_name`,`tenant_id`,`del_flag`) USING BTREE,
|
||
KEY `idx_tag_type` (`tag_type`) USING BTREE,
|
||
KEY `idx_share_scope` (`share_scope`) USING BTREE,
|
||
KEY `idx_create_user` (`create_user_id`) USING BTREE,
|
||
KEY `idx_tenant` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-客户标签表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_customer_tag_relation
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_customer_tag_relation`;
|
||
CREATE TABLE `crm_customer_tag_relation` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
|
||
`customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余)',
|
||
`tag_id` bigint(20) NOT NULL COMMENT '标签ID',
|
||
`tag_name` varchar(50) DEFAULT NULL COMMENT '标签名称(冗余)',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者(打标签的人)',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_customer_tag` (`customer_id`,`tag_id`,`del_flag`) USING BTREE,
|
||
KEY `idx_customer_id` (`customer_id`) USING BTREE,
|
||
KEY `idx_tag_id` (`tag_id`) USING BTREE,
|
||
KEY `idx_tenant` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-客户标签关联表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_invoice
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_invoice`;
|
||
CREATE TABLE `crm_invoice` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`invoice_no` varchar(50) NOT NULL COMMENT '发票编号(INV+yyyyMMdd+4位流水号)',
|
||
`invoice_code` varchar(50) DEFAULT NULL COMMENT '发票代码(税务发票代码)',
|
||
`invoice_number` varchar(50) DEFAULT NULL COMMENT '发票号码(税务发票号码)',
|
||
`contract_id` bigint(20) NOT NULL COMMENT '合同ID',
|
||
`contract_no` varchar(50) DEFAULT NULL COMMENT '合同编号(冗余字段)',
|
||
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
|
||
`customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
|
||
`payment_id` bigint(20) DEFAULT NULL COMMENT '回款ID',
|
||
`payment_no` varchar(50) DEFAULT NULL COMMENT '回款编号(冗余字段)',
|
||
`invoice_type` varchar(20) NOT NULL DEFAULT 'special' COMMENT '发票类型(special-增值税专用发票/normal-增值税普通发票/electronic-电子发票)',
|
||
`invoice_title` varchar(200) NOT NULL COMMENT '发票抬头',
|
||
`tax_no` varchar(50) NOT NULL COMMENT '纳税人识别号',
|
||
`company_address` varchar(255) DEFAULT NULL COMMENT '企业地址',
|
||
`company_phone` varchar(50) DEFAULT NULL COMMENT '企业电话',
|
||
`bank_name` varchar(100) DEFAULT NULL COMMENT '开户银行',
|
||
`bank_account` varchar(100) DEFAULT NULL COMMENT '银行账号',
|
||
`amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '开票金额(不含税)',
|
||
`tax_rate` decimal(5,2) NOT NULL DEFAULT '6.00' COMMENT '税率(百分比,如6.00表示6%)',
|
||
`is_tax_included` tinyint(1) DEFAULT '0' COMMENT '是否含税: 0-不含税 1-含税',
|
||
`tax_amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '税额',
|
||
`total_amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '价税合计',
|
||
`invoice_content` varchar(200) DEFAULT NULL COMMENT '开票内容',
|
||
`invoice_date` date DEFAULT NULL COMMENT '开票日期',
|
||
`status` varchar(20) NOT NULL DEFAULT 'applying' COMMENT '发票状态(applying-申请中/approved-已审批/invoiced-已开票/delivered-已寄出/received-已签收/rejected-已驳回/invalid-已作废)',
|
||
`reject_reason` varchar(500) DEFAULT NULL COMMENT '驳回原因',
|
||
`invalid_reason` varchar(500) DEFAULT NULL COMMENT '作废原因',
|
||
`invalid_time` datetime DEFAULT NULL COMMENT '作废时间',
|
||
`invoice_file` varchar(500) DEFAULT NULL COMMENT '发票PDF文件',
|
||
`invoice_image` varchar(500) DEFAULT NULL COMMENT '发票图片(扫描件)',
|
||
`express_company` varchar(50) DEFAULT NULL COMMENT '快递公司',
|
||
`express_no` varchar(100) DEFAULT NULL COMMENT '快递单号',
|
||
`express_status` varchar(20) DEFAULT 'no' COMMENT '快递状态(no-未寄出/sent-已寄出/received-已签收)',
|
||
`express_time` datetime DEFAULT NULL COMMENT '寄出时间',
|
||
`receive_time` datetime DEFAULT NULL COMMENT '签收时间',
|
||
`mail_address` varchar(255) DEFAULT NULL COMMENT '邮寄地址',
|
||
`mail_contact` varchar(50) DEFAULT NULL COMMENT '收件人',
|
||
`mail_mobile` varchar(20) DEFAULT NULL COMMENT '收件电话',
|
||
`owner_user_id` bigint(20) NOT NULL COMMENT '负责人ID',
|
||
`owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
|
||
`apply_by` bigint(20) DEFAULT NULL COMMENT '申请人ID',
|
||
`apply_by_name` varchar(50) DEFAULT NULL COMMENT '申请人姓名',
|
||
`apply_time` datetime DEFAULT NULL COMMENT '申请时间',
|
||
`approve_by` bigint(20) DEFAULT NULL COMMENT '审批人ID',
|
||
`approve_by_name` varchar(50) DEFAULT NULL COMMENT '审批人姓名',
|
||
`approve_time` datetime DEFAULT NULL COMMENT '审批时间',
|
||
`invoice_by` bigint(20) DEFAULT NULL COMMENT '开票人ID',
|
||
`invoice_by_name` varchar(50) DEFAULT NULL COMMENT '开票人姓名',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_invoice_no_del_flag` (`invoice_no`,`del_flag`) USING BTREE,
|
||
KEY `uk_invoice_number` (`invoice_number`) USING BTREE,
|
||
KEY `idx_contract_id` (`contract_id`) USING BTREE,
|
||
KEY `idx_customer_id` (`customer_id`) USING BTREE,
|
||
KEY `idx_payment_id` (`payment_id`) USING BTREE,
|
||
KEY `idx_owner_user_id` (`owner_user_id`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_invoice_date` (`invoice_date`) USING BTREE,
|
||
KEY `idx_express_status` (`express_status`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-发票主表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_invoice_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_invoice_info`;
|
||
CREATE TABLE `crm_invoice_info` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
|
||
`company_name` varchar(200) DEFAULT NULL COMMENT '单位名称(章)',
|
||
`company_address` varchar(500) DEFAULT NULL COMMENT '单位地址',
|
||
`legal_representative` varchar(100) DEFAULT NULL COMMENT '法定代表人',
|
||
`agent` varchar(100) DEFAULT NULL COMMENT '代理人',
|
||
`phone_fax` varchar(100) DEFAULT NULL COMMENT '电话/传真',
|
||
`bank_name` varchar(200) DEFAULT NULL COMMENT '开户银行',
|
||
`bank_account` varchar(100) DEFAULT NULL COMMENT '账号',
|
||
`is_default` char(1) DEFAULT '0' COMMENT '是否默认(0否 1是)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`del_flag` int(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_customer_id` (`customer_id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户开票信息表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_invoice_item
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_invoice_item`;
|
||
CREATE TABLE `crm_invoice_item` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`invoice_id` bigint(20) NOT NULL COMMENT '发票ID',
|
||
`item_name` varchar(200) NOT NULL COMMENT '项目名称',
|
||
`spec` varchar(100) DEFAULT NULL COMMENT '规格型号',
|
||
`unit` varchar(50) DEFAULT NULL COMMENT '单位',
|
||
`quantity` decimal(15,2) DEFAULT '0.00' COMMENT '数量',
|
||
`unit_price` decimal(15,2) DEFAULT '0.00' COMMENT '单价',
|
||
`amount` decimal(15,2) DEFAULT '0.00' COMMENT '金额',
|
||
`tax_rate` decimal(5,2) DEFAULT '0.00' COMMENT '税率(百分比)',
|
||
`tax_amount` decimal(15,2) DEFAULT '0.00' COMMENT '税额',
|
||
`total_amount` decimal(15,2) DEFAULT '0.00' COMMENT '价税合计',
|
||
`sort` int(11) DEFAULT '0' COMMENT '排序',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_invoice_id` (`invoice_id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-发票明细表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_opportunity
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_opportunity`;
|
||
CREATE TABLE `crm_opportunity` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`opportunity_no` varchar(50) NOT NULL COMMENT '商机编号(OPP+yyyyMMdd+4位流水号)',
|
||
`opportunity_name` varchar(200) NOT NULL COMMENT '商机名称',
|
||
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
|
||
`customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
|
||
`contact_id` bigint(20) DEFAULT NULL COMMENT '联系人ID',
|
||
`contact_name` varchar(50) DEFAULT NULL COMMENT '联系人姓名(冗余字段)',
|
||
`amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '商机金额',
|
||
`stage` varchar(20) NOT NULL DEFAULT 'initial' COMMENT '商机阶段(initial-初步接触/requirement-需求分析/solution-方案制定/quote-报价/negotiate-谈判审核/contract-合同签订/won-赢单)',
|
||
`stage_percent` int(11) DEFAULT '10' COMMENT '阶段进度百分比(10/20/40/60/80/90/100)',
|
||
`status` varchar(20) NOT NULL DEFAULT 'following' COMMENT '商机状态(following-跟进中/won-赢单/lost-输单/invalid-无效)',
|
||
`win_rate` decimal(5,2) DEFAULT '50.00' COMMENT '赢单率(百分比,如50.00表示50%)',
|
||
`expect_deal_date` date DEFAULT NULL COMMENT '预计成交日期',
|
||
`actual_deal_date` date DEFAULT NULL COMMENT '实际成交日期',
|
||
`lost_reason` varchar(500) DEFAULT NULL COMMENT '输单原因',
|
||
`owner_user_id` bigint(20) NOT NULL COMMENT '负责人ID(销售人员)',
|
||
`owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
|
||
`product_count` int(11) DEFAULT '0' COMMENT '产品数量(冗余字段)',
|
||
`last_time` datetime DEFAULT NULL COMMENT '最后跟进时间',
|
||
`next_time` datetime DEFAULT NULL COMMENT '下次联系时间',
|
||
`follow_count` int(11) DEFAULT '0' COMMENT '跟进次数(冗余字段)',
|
||
`contract_id` bigint(20) DEFAULT NULL COMMENT '关联合同ID(赢单后生成)',
|
||
`source` varchar(20) DEFAULT NULL COMMENT '商机来源(同线索来源)',
|
||
`type` varchar(20) DEFAULT NULL COMMENT '商机类型(new_customer-新客户新业务/renewal-老客户续约/upgrade-老客户升级)',
|
||
`description` text COMMENT '商机描述(详细说明商机背景、客户需求等)',
|
||
`competitors` varchar(500) DEFAULT NULL COMMENT '竞争对手(多个竞争对手用逗号分隔)',
|
||
`key_factors` varchar(500) DEFAULT NULL COMMENT '关键决策因素(客户关注的核心要素)',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_opportunity_no_del_flag` (`opportunity_no`,`del_flag`) USING BTREE,
|
||
KEY `idx_customer_id` (`customer_id`) USING BTREE,
|
||
KEY `idx_owner_user_id` (`owner_user_id`) USING BTREE,
|
||
KEY `idx_stage` (`stage`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_expect_deal_date` (`expect_deal_date`) USING BTREE,
|
||
KEY `idx_next_time` (`next_time`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-商机主表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_opportunity_follow
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_opportunity_follow`;
|
||
CREATE TABLE `crm_opportunity_follow` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`opportunity_id` bigint(20) NOT NULL COMMENT '商机ID',
|
||
`follow_type` varchar(20) NOT NULL COMMENT '跟进方式(phone-电话/wechat-微信/email-邮件/visit-拜访/meeting-会议/other-其他)',
|
||
`follow_content` text NOT NULL COMMENT '跟进内容',
|
||
`follow_time` datetime DEFAULT NULL COMMENT '跟进时间',
|
||
`stage` varchar(20) DEFAULT NULL COMMENT '当前商机阶段',
|
||
`stage_percent` int(11) DEFAULT NULL COMMENT '阶段进度百分比',
|
||
`next_time` datetime DEFAULT NULL COMMENT '下次联系时间',
|
||
`next_content` varchar(500) DEFAULT NULL COMMENT '下次联系计划',
|
||
`attachments` varchar(1000) DEFAULT NULL COMMENT '附件(多个文件用逗号分隔)',
|
||
`contact_id` bigint(20) DEFAULT NULL COMMENT '联系人ID',
|
||
`contact_name` varchar(50) DEFAULT NULL COMMENT '联系人姓名',
|
||
`location` varchar(200) DEFAULT NULL COMMENT '跟进地点(拜访时填写)',
|
||
`duration` int(11) DEFAULT NULL COMMENT '跟进时长(分钟)',
|
||
`follow_by` bigint(20) DEFAULT NULL COMMENT '跟进人ID',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者(跟进人)',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(跟进时间)',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_opportunity_id` (`opportunity_id`) USING BTREE,
|
||
KEY `idx_create_by` (`create_by`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||
KEY `idx_next_time` (`next_time`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_follow_time` (`follow_time`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-商机跟进记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_opportunity_product
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_opportunity_product`;
|
||
CREATE TABLE `crm_opportunity_product` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`opportunity_id` bigint(20) NOT NULL COMMENT '商机ID',
|
||
`product_id` bigint(20) NOT NULL COMMENT '产品ID',
|
||
`product_name` varchar(200) DEFAULT NULL COMMENT '产品名称(冗余字段)',
|
||
`product_no` varchar(50) DEFAULT NULL COMMENT '产品编号(冗余字段)',
|
||
`category_id` bigint(20) DEFAULT NULL COMMENT '产品分类ID',
|
||
`category_name` varchar(100) DEFAULT NULL COMMENT '产品分类名称(冗余字段)',
|
||
`model` varchar(100) DEFAULT NULL COMMENT '规格型号',
|
||
`unit` varchar(20) DEFAULT '件' COMMENT '单位',
|
||
`quantity` decimal(20,4) NOT NULL COMMENT '数量',
|
||
`price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '单价',
|
||
`discount` decimal(5,2) DEFAULT '0.00' COMMENT '折扣(百分比,如10.00表示9折)',
|
||
`subtotal` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '小计金额(数量*单价*折扣后)',
|
||
`sort` int(11) DEFAULT '0' COMMENT '排序号',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_opportunity_id` (`opportunity_id`) USING BTREE,
|
||
KEY `idx_product_id` (`product_id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-商机产品关联表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_opportunity_stage_log
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_opportunity_stage_log`;
|
||
CREATE TABLE `crm_opportunity_stage_log` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`opportunity_id` bigint(20) NOT NULL COMMENT '商机ID',
|
||
`from_stage` varchar(20) DEFAULT NULL COMMENT '原阶段',
|
||
`from_stage_name` varchar(50) DEFAULT NULL COMMENT '原阶段名称',
|
||
`from_percent` int(11) DEFAULT NULL COMMENT '原进度百分比',
|
||
`to_stage` varchar(20) NOT NULL COMMENT '新阶段',
|
||
`to_stage_name` varchar(50) DEFAULT NULL COMMENT '新阶段名称',
|
||
`to_percent` int(11) DEFAULT NULL COMMENT '新进度百分比',
|
||
`change_type` varchar(20) DEFAULT 'forward' COMMENT '变更类型(forward-推进/backward-后退)',
|
||
`change_reason` varchar(500) DEFAULT NULL COMMENT '变更原因',
|
||
`change_amount` decimal(15,2) DEFAULT NULL COMMENT '变更时的商机金额',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者(变更人)',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(变更时间)',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
`lost_detail` varchar(2000) DEFAULT NULL COMMENT '输单详细说明',
|
||
`competitor_info` varchar(1000) DEFAULT NULL COMMENT '竞争对手信息',
|
||
`improvement` varchar(1000) DEFAULT NULL COMMENT '改进建议',
|
||
`won_remark` varchar(2000) DEFAULT NULL COMMENT '赢单说明',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_opportunity_id` (`opportunity_id`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-商机阶段变更日志表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_payment
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_payment`;
|
||
CREATE TABLE `crm_payment` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`payment_no` varchar(50) NOT NULL COMMENT '回款编号(PAY+yyyyMMdd+4位流水号)',
|
||
`contract_id` bigint(20) NOT NULL COMMENT '合同ID',
|
||
`contract_no` varchar(50) DEFAULT NULL COMMENT '合同编号(冗余字段)',
|
||
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
|
||
`customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
|
||
`plan_id` bigint(20) DEFAULT NULL COMMENT '回款计划ID',
|
||
`plan_no` varchar(50) DEFAULT NULL COMMENT '计划编号(冗余字段)',
|
||
`period` int(11) DEFAULT NULL COMMENT '期数(冗余字段)',
|
||
`amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '回款金额',
|
||
`payment_date` date NOT NULL COMMENT '回款日期',
|
||
`payment_method` varchar(20) DEFAULT 'bank' COMMENT '付款方式(bank-银行转账/cash-现金/check-支票/alipay-支付宝/wechat-微信/other-其他)',
|
||
`payment_account` varchar(100) DEFAULT NULL COMMENT '付款账户',
|
||
`voucher_no` varchar(100) DEFAULT NULL COMMENT '凭证号(流水号)',
|
||
`voucher_file` varchar(500) DEFAULT NULL COMMENT '凭证文件(回款凭证扫描件)',
|
||
`status` varchar(20) NOT NULL DEFAULT 'pending' COMMENT '回款状态(pending-待确认/confirmed-已确认/invalid-已作废)',
|
||
`confirm_by` bigint(20) DEFAULT NULL COMMENT '确认人ID',
|
||
`confirm_by_name` varchar(50) DEFAULT NULL COMMENT '确认人姓名',
|
||
`confirm_time` datetime DEFAULT NULL COMMENT '确认时间',
|
||
`invalid_reason` varchar(500) DEFAULT NULL COMMENT '作废原因',
|
||
`invalid_time` datetime DEFAULT NULL COMMENT '作废时间',
|
||
`owner_user_id` bigint(20) NOT NULL COMMENT '负责人ID(录入人)',
|
||
`owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
|
||
`bank_name` varchar(100) DEFAULT NULL COMMENT '收款银行',
|
||
`bank_account` varchar(100) DEFAULT NULL COMMENT '收款账号',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_payment_no_del_flag` (`payment_no`,`del_flag`) USING BTREE,
|
||
KEY `idx_contract_id` (`contract_id`) USING BTREE,
|
||
KEY `idx_customer_id` (`customer_id`) USING BTREE,
|
||
KEY `idx_plan_id` (`plan_id`) USING BTREE,
|
||
KEY `idx_owner_user_id` (`owner_user_id`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_payment_date` (`payment_date`) USING BTREE,
|
||
KEY `idx_confirm_by` (`confirm_by`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-回款记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_payment_collection
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_payment_collection`;
|
||
CREATE TABLE `crm_payment_collection` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`plan_id` bigint(20) NOT NULL COMMENT '回款计划ID',
|
||
`contract_id` bigint(20) NOT NULL COMMENT '合同ID',
|
||
`contract_no` varchar(50) DEFAULT NULL COMMENT '合同编号(冗余)',
|
||
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
|
||
`customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余)',
|
||
`collection_date` datetime NOT NULL COMMENT '催收日期时间',
|
||
`collection_method` varchar(20) NOT NULL COMMENT '催收方式(phone/email/message/visit/legal/other)',
|
||
`contact_person` varchar(100) DEFAULT NULL COMMENT '联系人姓名',
|
||
`contact_phone` varchar(20) DEFAULT NULL COMMENT '联系电话',
|
||
`collection_content` text NOT NULL COMMENT '催收内容(最少20字)',
|
||
`customer_feedback` varchar(20) NOT NULL COMMENT '客户反馈类型(promise/processing/difficulty/refuse/no_contact/other)',
|
||
`feedback_detail` varchar(500) DEFAULT NULL COMMENT '反馈详情',
|
||
`promise_date` date DEFAULT NULL COMMENT '承诺付款日期',
|
||
`collector_user_id` bigint(20) NOT NULL COMMENT '催收人ID',
|
||
`collector_user_name` varchar(50) DEFAULT NULL COMMENT '催收人姓名(冗余)',
|
||
`attachment` varchar(500) DEFAULT NULL COMMENT '附件(催收邮件截图等)',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_plan_id` (`plan_id`) USING BTREE,
|
||
KEY `idx_contract_id` (`contract_id`) USING BTREE,
|
||
KEY `idx_customer_id` (`customer_id`) USING BTREE,
|
||
KEY `idx_collection_date` (`collection_date`) USING BTREE,
|
||
KEY `idx_collector_user_id` (`collector_user_id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-催收记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_payment_plan
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_payment_plan`;
|
||
CREATE TABLE `crm_payment_plan` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`plan_no` varchar(50) NOT NULL COMMENT '计划编号(PLAN+yyyyMMdd+4位流水号)',
|
||
`contract_id` bigint(20) NOT NULL COMMENT '合同ID',
|
||
`contract_no` varchar(50) DEFAULT NULL COMMENT '合同编号(冗余字段)',
|
||
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
|
||
`customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
|
||
`period` int(11) NOT NULL DEFAULT '1' COMMENT '期数(第几期)',
|
||
`plan_amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '计划回款金额',
|
||
`plan_date` date NOT NULL COMMENT '计划回款日期',
|
||
`plan_percent` decimal(5,2) DEFAULT NULL COMMENT '计划比例(占合同总金额的百分比)',
|
||
`received_amount` decimal(15,2) DEFAULT '0.00' COMMENT '已回款金额',
|
||
`unreceived_amount` decimal(15,2) DEFAULT '0.00' COMMENT '未回款金额',
|
||
`status` varchar(20) NOT NULL DEFAULT 'pending' COMMENT '状态(pending-待回款/partial-部分回款/finished-已完成/overdue-已逾期)',
|
||
`is_overdue` tinyint(1) DEFAULT '0' COMMENT '是否逾期(0否 1是)',
|
||
`overdue_days` int(11) DEFAULT '0' COMMENT '逾期天数',
|
||
`remind_days` int(11) DEFAULT '7' COMMENT '提前提醒天数(默认7天)',
|
||
`remind_status` varchar(20) DEFAULT 'no' COMMENT '提醒状态(no-未提醒/reminded-已提醒)',
|
||
`last_remind_time` datetime DEFAULT NULL COMMENT '最后提醒时间',
|
||
`owner_user_id` bigint(20) NOT NULL COMMENT '负责人ID',
|
||
`owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_plan_no_del_flag` (`plan_no`,`del_flag`) USING BTREE,
|
||
KEY `idx_contract_id` (`contract_id`) USING BTREE,
|
||
KEY `idx_customer_id` (`customer_id`) USING BTREE,
|
||
KEY `idx_owner_user_id` (`owner_user_id`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_plan_date` (`plan_date`) USING BTREE,
|
||
KEY `idx_is_overdue` (`is_overdue`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-回款计划表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_product
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_product`;
|
||
CREATE TABLE `crm_product` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`product_no` varchar(50) NOT NULL COMMENT '产品编号(唯一)',
|
||
`product_name` varchar(200) NOT NULL COMMENT '产品名称',
|
||
`category_id` bigint(20) DEFAULT NULL COMMENT '分类ID',
|
||
`category_name` varchar(100) DEFAULT NULL COMMENT '分类名称(冗余)',
|
||
`model` varchar(100) DEFAULT NULL COMMENT '型号/规格',
|
||
`unit` varchar(20) DEFAULT '个' COMMENT '单位',
|
||
`barcode` varchar(100) DEFAULT NULL COMMENT '条码',
|
||
`price` decimal(15,2) DEFAULT '0.00' COMMENT '标准价格',
|
||
`cost` decimal(15,2) DEFAULT '0.00' COMMENT '成本价',
|
||
`min_price` decimal(15,2) DEFAULT NULL COMMENT '最低价格',
|
||
`stock` int(11) DEFAULT '0' COMMENT '库存数量',
|
||
`low_stock` int(11) DEFAULT '10' COMMENT '库存预警值',
|
||
`status` varchar(20) DEFAULT 'on' COMMENT '状态(on-上架/off-下架)',
|
||
`tax_rate` decimal(5,2) NOT NULL DEFAULT '13.00' COMMENT '税率(百分比)',
|
||
`description` text COMMENT '产品描述',
|
||
`images` varchar(1000) DEFAULT NULL COMMENT '产品图片(多个用逗号分隔)',
|
||
`sale_count` int(11) DEFAULT '0' COMMENT '销售次数',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_product_no_del_flag` (`product_no`,`del_flag`) USING BTREE,
|
||
KEY `idx_category` (`category_id`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_tenant` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=2060282814905675778 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-产品主表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_product_attachment
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_product_attachment`;
|
||
CREATE TABLE `crm_product_attachment` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`product_id` bigint(20) NOT NULL COMMENT '产品ID',
|
||
`file_name` varchar(200) NOT NULL COMMENT '文件名称',
|
||
`file_path` varchar(500) NOT NULL COMMENT '文件路径',
|
||
`file_type` varchar(50) DEFAULT NULL COMMENT '文件类型(pdf/doc/xls/ppt/jpg等)',
|
||
`file_size` bigint(20) DEFAULT NULL COMMENT '文件大小(字节)',
|
||
`attachment_type` varchar(50) DEFAULT 'other' COMMENT '资料类型(manual-产品手册/whitepaper-技术白皮书/guide-用户指南/demo-演示PPT/case-案例资料/video-视频教程/other-其他)',
|
||
`download_count` int(11) DEFAULT '0' COMMENT '下载次数',
|
||
`sort` int(11) DEFAULT '0' COMMENT '显示顺序',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
`del_flag` int(11) DEFAULT '0' COMMENT '逻辑删除标志(0存在 1删除)',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_product_id` (`product_id`) USING BTREE,
|
||
KEY `idx_attachment_type` (`attachment_type`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品附件表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_product_category
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_product_category`;
|
||
CREATE TABLE `crm_product_category` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`category_name` varchar(100) NOT NULL COMMENT '分类名称',
|
||
`parent_id` bigint(20) DEFAULT '0' COMMENT '父级ID(0为顶级)',
|
||
`ancestors` varchar(500) DEFAULT NULL COMMENT '祖级列表(如: 0,1,2)',
|
||
`sort` int(11) DEFAULT '0' COMMENT '显示顺序',
|
||
`status` varchar(10) DEFAULT '0' COMMENT '状态(0-正常 1-停用)',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_parent_id` (`parent_id`) USING BTREE,
|
||
KEY `idx_tenant` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=1975766650771238914 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-产品分类表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_product_price
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_product_price`;
|
||
CREATE TABLE `crm_product_price` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`product_id` bigint(20) NOT NULL COMMENT '产品ID',
|
||
`price_type` varchar(20) NOT NULL COMMENT '价格类型(standard/cost/minimum/vip/wholesale/promotion)',
|
||
`price` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '价格',
|
||
`start_date` datetime DEFAULT NULL COMMENT '生效日期',
|
||
`end_date` datetime DEFAULT NULL COMMENT '失效日期',
|
||
`status` varchar(10) DEFAULT 'active' COMMENT '状态(active-生效中/inactive-已失效)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
`del_flag` int(11) DEFAULT '0' COMMENT '逻辑删除标志(0存在 1删除)',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_product_id` (`product_id`) USING BTREE,
|
||
KEY `idx_price_type` (`price_type`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品价格表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_product_price_history
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_product_price_history`;
|
||
CREATE TABLE `crm_product_price_history` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`product_id` bigint(20) NOT NULL COMMENT '产品ID',
|
||
`price_type` varchar(20) NOT NULL COMMENT '价格类型',
|
||
`old_price` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '调整前价格',
|
||
`new_price` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '调整后价格',
|
||
`price_change` decimal(12,2) DEFAULT '0.00' COMMENT '调整金额',
|
||
`change_percent` decimal(5,2) DEFAULT '0.00' COMMENT '调整百分比',
|
||
`adjust_reason` varchar(500) DEFAULT NULL COMMENT '调价原因',
|
||
`effective_date` datetime DEFAULT NULL COMMENT '生效日期',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '操作人',
|
||
`create_time` datetime DEFAULT NULL COMMENT '操作时间',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_product_id` (`product_id`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品价格历史表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_product_stock_log
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_product_stock_log`;
|
||
CREATE TABLE `crm_product_stock_log` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`product_id` bigint(20) NOT NULL COMMENT '产品ID',
|
||
`operation_type` varchar(20) NOT NULL COMMENT '操作类型(in-入库/out-出库/adjust-调整/check-盘点)',
|
||
`quantity` int(11) NOT NULL DEFAULT '0' COMMENT '变动数量(正数-增加/负数-减少)',
|
||
`before_stock` int(11) NOT NULL DEFAULT '0' COMMENT '变动前库存',
|
||
`after_stock` int(11) NOT NULL DEFAULT '0' COMMENT '变动后库存',
|
||
`unit_price` decimal(12,2) DEFAULT NULL COMMENT '单价',
|
||
`total_amount` decimal(12,2) DEFAULT NULL COMMENT '总金额',
|
||
`related_no` varchar(100) DEFAULT NULL COMMENT '关联单号(入库单/出库单/合同编号等)',
|
||
`related_type` varchar(50) DEFAULT NULL COMMENT '关联类型(purchase-采购/sale-销售/sample-样品/other-其他)',
|
||
`supplier` varchar(200) DEFAULT NULL COMMENT '供应商(入库时)',
|
||
`operator` varchar(100) DEFAULT NULL COMMENT '操作人',
|
||
`operation_date` datetime DEFAULT NULL COMMENT '操作日期',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_product_id` (`product_id`) USING BTREE,
|
||
KEY `idx_operation_type` (`operation_type`) USING BTREE,
|
||
KEY `idx_operation_date` (`operation_date`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品库存记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_product_tag
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_product_tag`;
|
||
CREATE TABLE `crm_product_tag` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`tag_name` varchar(50) NOT NULL COMMENT '标签名称',
|
||
`tag_color` varchar(20) DEFAULT NULL COMMENT '标签颜色',
|
||
`sort` int(11) DEFAULT '0' COMMENT '显示顺序',
|
||
`status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
`del_flag` int(11) DEFAULT '0' COMMENT '逻辑删除标志(0存在 1删除)',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_tag_name` (`tag_name`,`tenant_id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品标签表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_product_tag_relation
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_product_tag_relation`;
|
||
CREATE TABLE `crm_product_tag_relation` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`product_id` bigint(20) NOT NULL COMMENT '产品ID',
|
||
`tag_id` bigint(20) NOT NULL COMMENT '标签ID',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_product_tag` (`product_id`,`tag_id`,`tenant_id`) USING BTREE,
|
||
KEY `idx_product_id` (`product_id`) USING BTREE,
|
||
KEY `idx_tag_id` (`tag_id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品标签关联表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_quote
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_quote`;
|
||
CREATE TABLE `crm_quote` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`quote_no` varchar(50) NOT NULL COMMENT '报价单编号(QUO+yyyyMMdd+4位流水号)',
|
||
`quote_title` varchar(200) NOT NULL COMMENT '报价单标题',
|
||
`quote_type` varchar(20) NOT NULL DEFAULT 'sales' COMMENT '报价单类型(sales-销售/purchase-采购)',
|
||
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
|
||
`customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
|
||
`opportunity_id` bigint(20) DEFAULT NULL COMMENT '商机ID',
|
||
`contact_id` bigint(20) DEFAULT NULL COMMENT '联系人ID',
|
||
`contact_name` varchar(50) DEFAULT NULL COMMENT '联系人姓名(冗余字段)',
|
||
`contact_mobile` varchar(20) DEFAULT NULL COMMENT '联系人手机(冗余字段)',
|
||
`contact_email` varchar(100) DEFAULT NULL COMMENT '联系人邮箱(冗余字段)',
|
||
`version` varchar(20) DEFAULT 'V1.0' COMMENT '版本号(如V1.0,V1.1,V2.0)',
|
||
`parent_id` bigint(20) DEFAULT NULL COMMENT '父版本ID(版本管理,0表示首版)',
|
||
`is_latest` tinyint(1) DEFAULT '1' COMMENT '是否最新版本(0否 1是)',
|
||
`total_amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '总金额(未折扣前)',
|
||
`discount_rate` decimal(5,2) DEFAULT '0.00' COMMENT '整单折扣率(百分比)',
|
||
`discount_amount` decimal(15,2) DEFAULT '0.00' COMMENT '折扣金额',
|
||
`final_amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '最终金额(折扣后)',
|
||
`validity_days` int(11) DEFAULT '30' COMMENT '有效期(天数)',
|
||
`quote_date` date DEFAULT NULL COMMENT '报价日期',
|
||
`expire_date` date DEFAULT NULL COMMENT '到期日期',
|
||
`status` varchar(20) NOT NULL DEFAULT 'draft' COMMENT '状态(draft-草稿/submitted-已提交/accepted-已接受/rejected-已拒绝/expired-已过期/contract-已转合同)',
|
||
`reject_reason` varchar(500) DEFAULT NULL COMMENT '拒绝原因',
|
||
`pdf_url` varchar(500) DEFAULT NULL COMMENT 'PDF文件路径',
|
||
`pdf_generated` tinyint(1) DEFAULT '0' COMMENT 'PDF是否已生成(0否 1是)',
|
||
`share_link` varchar(500) DEFAULT NULL COMMENT '分享链接',
|
||
`share_code` varchar(50) DEFAULT NULL COMMENT '分享码',
|
||
`share_password` varchar(100) DEFAULT NULL COMMENT '分享密码(可选)',
|
||
`share_expire_time` datetime DEFAULT NULL COMMENT '分享链接过期时间',
|
||
`view_count` int(11) DEFAULT '0' COMMENT '查看次数',
|
||
`last_view_time` datetime DEFAULT NULL COMMENT '最后查看时间',
|
||
`owner_user_id` bigint(20) NOT NULL COMMENT '负责人ID',
|
||
`owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
|
||
`supplier_id` bigint(20) DEFAULT NULL COMMENT '报价主体ID(关联crm_supplier_info表)',
|
||
`supplier_name` varchar(200) DEFAULT NULL COMMENT '报价主体名称(冗余字段)',
|
||
`contract_id` bigint(20) DEFAULT NULL COMMENT '关联合同ID(转合同后)',
|
||
`payment_terms` varchar(500) DEFAULT NULL COMMENT '付款条款',
|
||
`delivery_terms` varchar(500) DEFAULT NULL COMMENT '交付条款',
|
||
`freight` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '运费(元)',
|
||
`attachments` varchar(1000) DEFAULT NULL COMMENT '附件(多个用逗号分隔)',
|
||
`template_content` longtext COMMENT '报价单模板内容(富文本HTML)',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version_no` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_customer_id` (`customer_id`) USING BTREE,
|
||
KEY `idx_opportunity_id` (`opportunity_id`) USING BTREE,
|
||
KEY `idx_owner_user_id` (`owner_user_id`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_parent_id` (`parent_id`) USING BTREE,
|
||
KEY `idx_expire_date` (`expire_date`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||
KEY `idx_share_code` (`share_code`) USING BTREE,
|
||
KEY `idx_supplier_id` (`supplier_id`)
|
||
) ENGINE=InnoDB AUTO_INCREMENT=2060201834769510402 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-报价单主表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_quote_approval
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_quote_approval`;
|
||
CREATE TABLE `crm_quote_approval` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`quote_id` bigint(20) NOT NULL COMMENT '报价单ID',
|
||
`quote_no` varchar(50) DEFAULT NULL COMMENT '报价单编号(冗余)',
|
||
`step` int(11) NOT NULL COMMENT '审批步骤(1/2/3...)',
|
||
`approver_id` bigint(20) NOT NULL COMMENT '审批人ID',
|
||
`approver_name` varchar(50) DEFAULT NULL COMMENT '审批人姓名(冗余)',
|
||
`approval_result` varchar(20) DEFAULT 'pending' COMMENT '审批结果(pending-待审批/approved-通过/rejected-拒绝)',
|
||
`approval_opinion` text COMMENT '审批意见',
|
||
`approval_time` datetime DEFAULT NULL COMMENT '审批时间',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_quote_id` (`quote_id`) USING BTREE,
|
||
KEY `idx_approver_id` (`approver_id`) USING BTREE,
|
||
KEY `idx_approval_time` (`approval_time`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_approval_result` (`approval_result`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=2060201835247661059 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-报价单审批记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_quote_product
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_quote_product`;
|
||
CREATE TABLE `crm_quote_product` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`quote_id` bigint(20) NOT NULL COMMENT '报价单ID',
|
||
`product_id` bigint(20) NOT NULL COMMENT '产品ID',
|
||
`product_name` varchar(200) NOT NULL COMMENT '产品名称',
|
||
`product_no` varchar(50) DEFAULT NULL COMMENT '产品编号',
|
||
`category_id` bigint(20) DEFAULT NULL COMMENT '产品分类ID',
|
||
`category_name` varchar(100) DEFAULT NULL COMMENT '产品分类名称',
|
||
`model` varchar(100) DEFAULT NULL COMMENT '规格型号',
|
||
`unit` varchar(20) DEFAULT '件' COMMENT '单位',
|
||
`quantity` decimal(20,4) NOT NULL COMMENT '数量',
|
||
`price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '含税单价/元',
|
||
`discount` decimal(5,2) DEFAULT '0.00' COMMENT '折扣(百分比)',
|
||
`subtotal` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '含税总价/元',
|
||
`tax_amount` decimal(15,2) DEFAULT '0.00' COMMENT '税费/元',
|
||
`tax_rate` decimal(5,2) DEFAULT '13.00' COMMENT '税率(%)',
|
||
`package_spec` varchar(200) DEFAULT NULL COMMENT '包装规格',
|
||
`delivery_method` varchar(200) DEFAULT NULL COMMENT '送货方式',
|
||
`description` varchar(1000) DEFAULT NULL COMMENT '产品描述',
|
||
`sort` int(11) DEFAULT '0' COMMENT '排序号',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_quote_id` (`quote_id`) USING BTREE,
|
||
KEY `idx_product_id` (`product_id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=2060201834803064834 DEFAULT CHARSET=utf8mb4 COMMENT='CRM-报价单产品明细表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_quote_share_log
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_quote_share_log`;
|
||
CREATE TABLE `crm_quote_share_log` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`quote_id` bigint(20) NOT NULL COMMENT '报价单ID',
|
||
`share_code` varchar(50) NOT NULL COMMENT '分享码',
|
||
`visit_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '访问时间',
|
||
`ip_address` varchar(50) DEFAULT NULL COMMENT 'IP地址',
|
||
`location` varchar(200) DEFAULT NULL COMMENT '地理位置(省市)',
|
||
`device_type` varchar(50) DEFAULT NULL COMMENT '设备类型(PC/Mobile/Tablet)',
|
||
`browser` varchar(100) DEFAULT NULL COMMENT '浏览器信息',
|
||
`stay_duration` int(11) DEFAULT '0' COMMENT '停留时长(秒)',
|
||
`page_views` int(11) DEFAULT '1' COMMENT '浏览页数',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_quote_id` (`quote_id`) USING BTREE,
|
||
KEY `idx_share_code` (`share_code`) USING BTREE,
|
||
KEY `idx_visit_time` (`visit_time`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-报价单分享访问日志表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_supplier_info
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_supplier_info`;
|
||
CREATE TABLE `crm_supplier_info` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`supplier_name` varchar(200) NOT NULL COMMENT '供方名称(章)',
|
||
`short_name` varchar(100) DEFAULT NULL COMMENT '简称',
|
||
`supplier_code` varchar(50) DEFAULT NULL COMMENT '编码',
|
||
`supplier_address` varchar(500) DEFAULT NULL COMMENT '单位地址',
|
||
`legal_person` varchar(100) DEFAULT NULL COMMENT '法定代表人',
|
||
`agent` varchar(100) DEFAULT NULL COMMENT '代理人',
|
||
`phone_fax` varchar(100) DEFAULT NULL COMMENT '电话/传真',
|
||
`bank_name` varchar(200) DEFAULT NULL COMMENT '开户银行',
|
||
`bank_account` varchar(100) DEFAULT NULL COMMENT '账号',
|
||
`status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '逻辑删除标志(0存在 1删除)',
|
||
PRIMARY KEY (`id`),
|
||
KEY `idx_tenant_id` (`tenant_id`),
|
||
KEY `idx_del_flag` (`del_flag`)
|
||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='供方信息表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_visit
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_visit`;
|
||
CREATE TABLE `crm_visit` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`visit_no` varchar(50) NOT NULL COMMENT '回访编号(VIS+yyyyMMdd+4位流水号)',
|
||
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
|
||
`customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
|
||
`contract_id` bigint(20) DEFAULT NULL COMMENT '合同ID',
|
||
`contract_no` varchar(50) DEFAULT NULL COMMENT '合同编号(冗余字段)',
|
||
`contact_id` bigint(20) DEFAULT NULL COMMENT '联系人ID',
|
||
`contact_name` varchar(50) DEFAULT NULL COMMENT '联系人姓名',
|
||
`contact_mobile` varchar(20) DEFAULT NULL COMMENT '联系人手机',
|
||
`visit_type` varchar(20) NOT NULL DEFAULT 'regular' COMMENT '回访类型(contract-合同回访/delivery-交付回访/regular-定期回访/renew-续约回访/complaint-投诉回访/other-其他)',
|
||
`plan_visit_date` datetime DEFAULT NULL COMMENT '计划回访时间',
|
||
`visit_date` datetime NOT NULL COMMENT '实际回访时间(执行回访时填写)',
|
||
`visit_method` varchar(20) NOT NULL DEFAULT 'phone' COMMENT '回访方式(phone-电话/wechat-微信/email-邮件/visit-上门拜访/other-其他)',
|
||
`visit_purpose` text COMMENT '回访目的(多个用逗号分隔: understand_usage,collect_feedback等)',
|
||
`visit_script` text COMMENT '回访话术模板',
|
||
`visit_content` text NOT NULL COMMENT '回访内容',
|
||
`visit_summary` varchar(1000) DEFAULT NULL COMMENT '回访小结',
|
||
`satisfaction` varchar(20) DEFAULT NULL COMMENT '满意度(very_satisfied-非常满意/satisfied-满意/general-一般/dissatisfied-不满意/very_dissatisfied-非常不满意)',
|
||
`satisfaction_score` int(11) DEFAULT NULL COMMENT '满意度评分(1-5分,5分最高)',
|
||
`usage_status` varchar(20) DEFAULT NULL COMMENT '使用情况(normal-正常/occasional-偶尔/rarely-很少/not_used-未使用)',
|
||
`dissatisfaction_reason` varchar(500) DEFAULT NULL COMMENT '不满意原因(满意度<3星时必填)',
|
||
`has_problem` tinyint(1) DEFAULT '0' COMMENT '是否有问题(0否 1是)',
|
||
`problem_count` int(11) DEFAULT '0' COMMENT '问题数量(冗余字段)',
|
||
`problem_summary` varchar(500) DEFAULT NULL COMMENT '问题概述',
|
||
`has_opportunity` tinyint(1) DEFAULT '0' COMMENT '是否有商机(0否 1是)',
|
||
`opportunity_desc` text COMMENT '商机描述',
|
||
`opportunity_amount` decimal(15,2) DEFAULT NULL COMMENT '预估商机金额',
|
||
`next_visit_date` date DEFAULT NULL COMMENT '下次回访日期',
|
||
`next_visit_content` varchar(500) DEFAULT NULL COMMENT '下次回访计划',
|
||
`status` varchar(20) NOT NULL DEFAULT 'pending' COMMENT '回访状态(pending-待回访/visiting-回访中/completed-已完成/cancelled-已取消)',
|
||
`cancel_reason` varchar(500) DEFAULT NULL COMMENT '取消原因',
|
||
`cancel_time` datetime DEFAULT NULL COMMENT '取消时间',
|
||
`owner_user_id` bigint(20) NOT NULL COMMENT '负责人ID(回访人)',
|
||
`owner_user_name` varchar(50) DEFAULT NULL COMMENT '负责人姓名(冗余字段)',
|
||
`duration` int(11) DEFAULT NULL COMMENT '回访时长(分钟)',
|
||
`attachments` varchar(1000) DEFAULT NULL COMMENT '附件(多个文件用逗号分隔)',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_visit_no_del_flag` (`visit_no`,`del_flag`) USING BTREE,
|
||
KEY `idx_customer_id` (`customer_id`) USING BTREE,
|
||
KEY `idx_contract_id` (`contract_id`) USING BTREE,
|
||
KEY `idx_owner_user_id` (`owner_user_id`) USING BTREE,
|
||
KEY `idx_visit_type` (`visit_type`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_visit_date` (`visit_date`) USING BTREE,
|
||
KEY `idx_satisfaction` (`satisfaction`) USING BTREE,
|
||
KEY `idx_has_problem` (`has_problem`) USING BTREE,
|
||
KEY `idx_has_opportunity` (`has_opportunity`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-回访记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_visit_plan
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_visit_plan`;
|
||
CREATE TABLE `crm_visit_plan` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`rule_name` varchar(200) NOT NULL COMMENT '规则名称',
|
||
`trigger_type` varchar(20) NOT NULL COMMENT '触发类型(contract_signed-合同签订后/last_visit-上次回访后/product_expire-产品到期前/fixed_period-固定周期)',
|
||
`delay_days` int(11) NOT NULL DEFAULT '0' COMMENT '延迟天数(合同签订/上次回访后多少天回访)',
|
||
`visit_type` varchar(20) NOT NULL COMMENT '回访类型(参考crm_visit_type字典)',
|
||
`visit_method` varchar(20) DEFAULT 'phone' COMMENT '回访方式(参考crm_visit_method字典)',
|
||
`visit_content_template` text COMMENT '回访内容模板',
|
||
`status` varchar(20) NOT NULL DEFAULT 'enabled' COMMENT '状态(enabled-启用/disabled-禁用)',
|
||
`execute_count` int(11) DEFAULT '0' COMMENT '执行次数',
|
||
`last_execute_time` datetime DEFAULT NULL COMMENT '最后执行时间',
|
||
`sort` int(11) DEFAULT '0' COMMENT '排序号',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_trigger_type` (`trigger_type`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-回访计划规则表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for crm_visit_problem
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `crm_visit_problem`;
|
||
CREATE TABLE `crm_visit_problem` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`visit_id` bigint(20) NOT NULL COMMENT '回访ID',
|
||
`visit_no` varchar(50) DEFAULT NULL COMMENT '回访编号(冗余字段)',
|
||
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
|
||
`customer_name` varchar(200) DEFAULT NULL COMMENT '客户名称(冗余字段)',
|
||
`problem_type` varchar(20) NOT NULL DEFAULT 'product' COMMENT '问题类型(product-产品问题/service-服务问题/delivery-交付问题/quality-质量问题/price-价格问题/other-其他)',
|
||
`problem_desc` text NOT NULL COMMENT '问题描述',
|
||
`problem_images` varchar(1000) DEFAULT NULL COMMENT '问题图片(多个图片用逗号分隔)',
|
||
`severity` varchar(20) NOT NULL DEFAULT 'medium' COMMENT '严重程度(low-低/medium-中/high-高/urgent-紧急)',
|
||
`solution` text COMMENT '解决方案',
|
||
`status` varchar(20) NOT NULL DEFAULT 'pending' COMMENT '问题状态(pending-待处理/processing-处理中/solved-已解决/closed-已关闭)',
|
||
`solve_by` bigint(20) DEFAULT NULL COMMENT '处理人ID',
|
||
`solve_by_name` varchar(50) DEFAULT NULL COMMENT '处理人姓名',
|
||
`solve_time` datetime DEFAULT NULL COMMENT '处理时间',
|
||
`solve_duration` int(11) DEFAULT NULL COMMENT '处理耗时(小时)',
|
||
`close_by` bigint(20) DEFAULT NULL COMMENT '关闭人ID',
|
||
`close_by_name` varchar(50) DEFAULT NULL COMMENT '关闭人姓名',
|
||
`close_time` datetime DEFAULT NULL COMMENT '关闭时间',
|
||
`close_reason` varchar(500) DEFAULT NULL COMMENT '关闭原因',
|
||
`customer_feedback` text COMMENT '客户反馈',
|
||
`is_satisfied` tinyint(1) DEFAULT NULL COMMENT '客户是否满意(0否 1是)',
|
||
`sort` int(11) DEFAULT '0' COMMENT '排序号',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_visit_id` (`visit_id`) USING BTREE,
|
||
KEY `idx_customer_id` (`customer_id`) USING BTREE,
|
||
KEY `idx_problem_type` (`problem_type`) USING BTREE,
|
||
KEY `idx_severity` (`severity`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_solve_by` (`solve_by`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='CRM-回访问题记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_category
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_category`;
|
||
CREATE TABLE `flow_category` (
|
||
`category_id` bigint(20) NOT NULL COMMENT '流程分类ID',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`parent_id` bigint(20) DEFAULT '0' COMMENT '父流程分类id',
|
||
`ancestors` varchar(500) DEFAULT '' COMMENT '祖级列表',
|
||
`category_name` varchar(30) NOT NULL COMMENT '流程分类名称',
|
||
`order_num` int(4) DEFAULT '0' COMMENT '显示顺序',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
PRIMARY KEY (`category_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程分类';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_category_bak
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_category_bak`;
|
||
CREATE TABLE `flow_category_bak` (
|
||
`category_id` bigint(20) NOT NULL COMMENT '流程分类ID',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`parent_id` bigint(20) DEFAULT '0' COMMENT '父流程分类id',
|
||
`ancestors` varchar(500) DEFAULT '' COMMENT '祖级列表',
|
||
`category_name` varchar(30) NOT NULL COMMENT '流程分类名称',
|
||
`order_num` int(4) DEFAULT '0' COMMENT '显示顺序',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
PRIMARY KEY (`category_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程分类';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_definition
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_definition`;
|
||
CREATE TABLE `flow_definition` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键id',
|
||
`flow_code` varchar(40) NOT NULL COMMENT '流程编码',
|
||
`flow_name` varchar(100) NOT NULL COMMENT '流程名称',
|
||
`category` varchar(100) DEFAULT NULL COMMENT '流程类别',
|
||
`version` varchar(20) NOT NULL COMMENT '流程版本',
|
||
`is_publish` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否发布(0未发布 1已发布 9失效)',
|
||
`form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
|
||
`form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
|
||
`activity_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '流程激活状态(0挂起 1激活)',
|
||
`listener_type` varchar(100) DEFAULT NULL COMMENT '监听器类型',
|
||
`listener_path` varchar(400) DEFAULT NULL COMMENT '监听器路径',
|
||
`ext` varchar(500) DEFAULT NULL COMMENT '业务详情 存业务表对象json字符串',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
|
||
`tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程定义表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_definition_bak
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_definition_bak`;
|
||
CREATE TABLE `flow_definition_bak` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键id',
|
||
`flow_code` varchar(40) NOT NULL COMMENT '流程编码',
|
||
`flow_name` varchar(100) NOT NULL COMMENT '流程名称',
|
||
`category` varchar(100) DEFAULT NULL COMMENT '流程类别',
|
||
`version` varchar(20) NOT NULL COMMENT '流程版本',
|
||
`is_publish` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否发布(0未发布 1已发布 9失效)',
|
||
`form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
|
||
`form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
|
||
`activity_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '流程激活状态(0挂起 1激活)',
|
||
`listener_type` varchar(100) DEFAULT NULL COMMENT '监听器类型',
|
||
`listener_path` varchar(400) DEFAULT NULL COMMENT '监听器路径',
|
||
`ext` varchar(500) DEFAULT NULL COMMENT '业务详情 存业务表对象json字符串',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
|
||
`tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程定义表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_his_task
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_his_task`;
|
||
CREATE TABLE `flow_his_task` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键id',
|
||
`definition_id` bigint(20) NOT NULL COMMENT '对应flow_definition表的id',
|
||
`instance_id` bigint(20) NOT NULL COMMENT '对应flow_instance表的id',
|
||
`task_id` bigint(20) NOT NULL COMMENT '对应flow_task表的id',
|
||
`node_code` varchar(100) DEFAULT NULL COMMENT '开始节点编码',
|
||
`node_name` varchar(100) DEFAULT NULL COMMENT '开始节点名称',
|
||
`node_type` tinyint(1) DEFAULT NULL COMMENT '开始节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
|
||
`target_node_code` varchar(200) DEFAULT NULL COMMENT '目标节点编码',
|
||
`target_node_name` varchar(200) DEFAULT NULL COMMENT '结束节点名称',
|
||
`approver` varchar(40) DEFAULT NULL COMMENT '审批者',
|
||
`cooperate_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '协作方式(1审批 2转办 3委派 4会签 5票签 6加签 7减签)',
|
||
`collaborator` varchar(40) DEFAULT NULL COMMENT '协作人',
|
||
`skip_type` varchar(10) NOT NULL COMMENT '流转类型(PASS通过 REJECT退回 NONE无动作)',
|
||
`flow_status` varchar(20) NOT NULL COMMENT '流程状态(0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回)',
|
||
`form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
|
||
`form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
|
||
`message` varchar(500) DEFAULT NULL COMMENT '审批意见',
|
||
`variable` text COMMENT '任务变量',
|
||
`ext` varchar(500) DEFAULT NULL COMMENT '业务详情 存业务表对象json字符串',
|
||
`create_time` datetime DEFAULT NULL COMMENT '任务开始时间',
|
||
`update_time` datetime DEFAULT NULL COMMENT '审批完成时间',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
|
||
`tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='历史任务记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_his_task_bak
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_his_task_bak`;
|
||
CREATE TABLE `flow_his_task_bak` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键id',
|
||
`definition_id` bigint(20) NOT NULL COMMENT '对应flow_definition表的id',
|
||
`instance_id` bigint(20) NOT NULL COMMENT '对应flow_instance表的id',
|
||
`task_id` bigint(20) NOT NULL COMMENT '对应flow_task表的id',
|
||
`node_code` varchar(100) DEFAULT NULL COMMENT '开始节点编码',
|
||
`node_name` varchar(100) DEFAULT NULL COMMENT '开始节点名称',
|
||
`node_type` tinyint(1) DEFAULT NULL COMMENT '开始节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
|
||
`target_node_code` varchar(200) DEFAULT NULL COMMENT '目标节点编码',
|
||
`target_node_name` varchar(200) DEFAULT NULL COMMENT '结束节点名称',
|
||
`approver` varchar(40) DEFAULT NULL COMMENT '审批者',
|
||
`cooperate_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '协作方式(1审批 2转办 3委派 4会签 5票签 6加签 7减签)',
|
||
`collaborator` varchar(40) DEFAULT NULL COMMENT '协作人',
|
||
`skip_type` varchar(10) NOT NULL COMMENT '流转类型(PASS通过 REJECT退回 NONE无动作)',
|
||
`flow_status` varchar(20) NOT NULL COMMENT '流程状态(0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回)',
|
||
`form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
|
||
`form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
|
||
`message` varchar(500) DEFAULT NULL COMMENT '审批意见',
|
||
`variable` text COMMENT '任务变量',
|
||
`ext` varchar(500) DEFAULT NULL COMMENT '业务详情 存业务表对象json字符串',
|
||
`create_time` datetime DEFAULT NULL COMMENT '任务开始时间',
|
||
`update_time` datetime DEFAULT NULL COMMENT '审批完成时间',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
|
||
`tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='历史任务记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_instance
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_instance`;
|
||
CREATE TABLE `flow_instance` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键id',
|
||
`definition_id` bigint(20) NOT NULL COMMENT '对应flow_definition表的id',
|
||
`business_id` varchar(40) NOT NULL COMMENT '业务id',
|
||
`node_type` tinyint(1) NOT NULL COMMENT '节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
|
||
`node_code` varchar(40) NOT NULL COMMENT '流程节点编码',
|
||
`node_name` varchar(100) DEFAULT NULL COMMENT '流程节点名称',
|
||
`variable` text COMMENT '任务变量',
|
||
`flow_status` varchar(20) NOT NULL COMMENT '流程状态(0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回)',
|
||
`activity_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '流程激活状态(0挂起 1激活)',
|
||
`def_json` text COMMENT '流程定义json',
|
||
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`ext` varchar(500) DEFAULT NULL COMMENT '扩展字段,预留给业务系统使用',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
|
||
`tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程实例表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_instance_bak
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_instance_bak`;
|
||
CREATE TABLE `flow_instance_bak` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键id',
|
||
`definition_id` bigint(20) NOT NULL COMMENT '对应flow_definition表的id',
|
||
`business_id` varchar(40) NOT NULL COMMENT '业务id',
|
||
`node_type` tinyint(1) NOT NULL COMMENT '节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
|
||
`node_code` varchar(40) NOT NULL COMMENT '流程节点编码',
|
||
`node_name` varchar(100) DEFAULT NULL COMMENT '流程节点名称',
|
||
`variable` text COMMENT '任务变量',
|
||
`flow_status` varchar(20) NOT NULL COMMENT '流程状态(0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回)',
|
||
`activity_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '流程激活状态(0挂起 1激活)',
|
||
`def_json` text COMMENT '流程定义json',
|
||
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`ext` varchar(500) DEFAULT NULL COMMENT '扩展字段,预留给业务系统使用',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
|
||
`tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程实例表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_node
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_node`;
|
||
CREATE TABLE `flow_node` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键id',
|
||
`node_type` tinyint(1) NOT NULL COMMENT '节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
|
||
`definition_id` bigint(20) NOT NULL COMMENT '流程定义id',
|
||
`node_code` varchar(100) NOT NULL COMMENT '流程节点编码',
|
||
`node_name` varchar(100) DEFAULT NULL COMMENT '流程节点名称',
|
||
`permission_flag` varchar(200) DEFAULT NULL COMMENT '权限标识(权限类型:权限标识,可以多个,用逗号隔开)',
|
||
`node_ratio` decimal(6,3) DEFAULT NULL COMMENT '流程签署比例值',
|
||
`coordinate` varchar(100) DEFAULT NULL COMMENT '坐标',
|
||
`any_node_skip` varchar(100) DEFAULT NULL COMMENT '任意结点跳转',
|
||
`listener_type` varchar(100) DEFAULT NULL COMMENT '监听器类型',
|
||
`listener_path` varchar(400) DEFAULT NULL COMMENT '监听器路径',
|
||
`handler_type` varchar(100) DEFAULT NULL COMMENT '处理器类型',
|
||
`handler_path` varchar(400) DEFAULT NULL COMMENT '处理器路径',
|
||
`form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
|
||
`form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
|
||
`version` varchar(20) NOT NULL COMMENT '版本',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`ext` text COMMENT '扩展属性',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
|
||
`tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程节点表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_node_bak
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_node_bak`;
|
||
CREATE TABLE `flow_node_bak` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键id',
|
||
`node_type` tinyint(1) NOT NULL COMMENT '节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
|
||
`definition_id` bigint(20) NOT NULL COMMENT '流程定义id',
|
||
`node_code` varchar(100) NOT NULL COMMENT '流程节点编码',
|
||
`node_name` varchar(100) DEFAULT NULL COMMENT '流程节点名称',
|
||
`permission_flag` varchar(200) DEFAULT NULL COMMENT '权限标识(权限类型:权限标识,可以多个,用逗号隔开)',
|
||
`node_ratio` decimal(6,3) DEFAULT NULL COMMENT '流程签署比例值',
|
||
`coordinate` varchar(100) DEFAULT NULL COMMENT '坐标',
|
||
`any_node_skip` varchar(100) DEFAULT NULL COMMENT '任意结点跳转',
|
||
`listener_type` varchar(100) DEFAULT NULL COMMENT '监听器类型',
|
||
`listener_path` varchar(400) DEFAULT NULL COMMENT '监听器路径',
|
||
`handler_type` varchar(100) DEFAULT NULL COMMENT '处理器类型',
|
||
`handler_path` varchar(400) DEFAULT NULL COMMENT '处理器路径',
|
||
`form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
|
||
`form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
|
||
`version` varchar(20) NOT NULL COMMENT '版本',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`ext` text COMMENT '扩展属性',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
|
||
`tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程节点表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_skip
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_skip`;
|
||
CREATE TABLE `flow_skip` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键id',
|
||
`definition_id` bigint(20) NOT NULL COMMENT '流程定义id',
|
||
`now_node_code` varchar(100) NOT NULL COMMENT '当前流程节点的编码',
|
||
`now_node_type` tinyint(1) DEFAULT NULL COMMENT '当前节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
|
||
`next_node_code` varchar(100) NOT NULL COMMENT '下一个流程节点的编码',
|
||
`next_node_type` tinyint(1) DEFAULT NULL COMMENT '下一个节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
|
||
`skip_name` varchar(100) DEFAULT NULL COMMENT '跳转名称',
|
||
`skip_type` varchar(40) DEFAULT NULL COMMENT '跳转类型(PASS审批通过 REJECT退回)',
|
||
`skip_condition` varchar(200) DEFAULT NULL COMMENT '跳转条件',
|
||
`coordinate` varchar(100) DEFAULT NULL COMMENT '坐标',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
|
||
`tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='节点跳转关联表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_skip_bak
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_skip_bak`;
|
||
CREATE TABLE `flow_skip_bak` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键id',
|
||
`definition_id` bigint(20) NOT NULL COMMENT '流程定义id',
|
||
`now_node_code` varchar(100) NOT NULL COMMENT '当前流程节点的编码',
|
||
`now_node_type` tinyint(1) DEFAULT NULL COMMENT '当前节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
|
||
`next_node_code` varchar(100) NOT NULL COMMENT '下一个流程节点的编码',
|
||
`next_node_type` tinyint(1) DEFAULT NULL COMMENT '下一个节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
|
||
`skip_name` varchar(100) DEFAULT NULL COMMENT '跳转名称',
|
||
`skip_type` varchar(40) DEFAULT NULL COMMENT '跳转类型(PASS审批通过 REJECT退回)',
|
||
`skip_condition` varchar(200) DEFAULT NULL COMMENT '跳转条件',
|
||
`coordinate` varchar(100) DEFAULT NULL COMMENT '坐标',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
|
||
`tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='节点跳转关联表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_task
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_task`;
|
||
CREATE TABLE `flow_task` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键id',
|
||
`definition_id` bigint(20) NOT NULL COMMENT '对应flow_definition表的id',
|
||
`instance_id` bigint(20) NOT NULL COMMENT '对应flow_instance表的id',
|
||
`node_code` varchar(100) NOT NULL COMMENT '节点编码',
|
||
`node_name` varchar(100) DEFAULT NULL COMMENT '节点名称',
|
||
`node_type` tinyint(1) NOT NULL COMMENT '节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
|
||
`flow_status` varchar(20) NOT NULL COMMENT '流程状态(0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回)',
|
||
`form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
|
||
`form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
|
||
`tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='待办任务表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_task_bak
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_task_bak`;
|
||
CREATE TABLE `flow_task_bak` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键id',
|
||
`definition_id` bigint(20) NOT NULL COMMENT '对应flow_definition表的id',
|
||
`instance_id` bigint(20) NOT NULL COMMENT '对应flow_instance表的id',
|
||
`node_code` varchar(100) NOT NULL COMMENT '节点编码',
|
||
`node_name` varchar(100) DEFAULT NULL COMMENT '节点名称',
|
||
`node_type` tinyint(1) NOT NULL COMMENT '节点类型(0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关)',
|
||
`flow_status` varchar(20) NOT NULL COMMENT '流程状态(0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回)',
|
||
`form_custom` char(1) DEFAULT 'N' COMMENT '审批表单是否自定义(Y是 N否)',
|
||
`form_path` varchar(100) DEFAULT NULL COMMENT '审批表单路径',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
|
||
`tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='待办任务表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_user
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_user`;
|
||
CREATE TABLE `flow_user` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键id',
|
||
`type` char(1) NOT NULL COMMENT '人员类型(1待办任务的审批人权限 2待办任务的转办人权限 3待办任务的委托人权限)',
|
||
`processed_by` varchar(80) DEFAULT NULL COMMENT '权限人',
|
||
`associated` bigint(20) NOT NULL COMMENT '任务表id',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`create_by` varchar(80) DEFAULT NULL COMMENT '创建人',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
|
||
`tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `user_processed_type` (`processed_by`,`type`) USING BTREE,
|
||
KEY `user_associated` (`associated`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程用户表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for flow_user_bak
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `flow_user_bak`;
|
||
CREATE TABLE `flow_user_bak` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键id',
|
||
`type` char(1) NOT NULL COMMENT '人员类型(1待办任务的审批人权限 2待办任务的转办人权限 3待办任务的委托人权限)',
|
||
`processed_by` varchar(80) DEFAULT NULL COMMENT '权限人',
|
||
`associated` bigint(20) NOT NULL COMMENT '任务表id',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`create_by` varchar(80) DEFAULT NULL COMMENT '创建人',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志',
|
||
`tenant_id` varchar(40) DEFAULT NULL COMMENT '租户id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `user_processed_type` (`processed_by`,`type`) USING BTREE,
|
||
KEY `user_associated` (`associated`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='流程用户表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for gen_table
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `gen_table`;
|
||
CREATE TABLE `gen_table` (
|
||
`table_id` bigint(20) NOT NULL COMMENT '编号',
|
||
`data_name` varchar(200) DEFAULT '' COMMENT '数据源名称',
|
||
`table_name` varchar(200) DEFAULT '' COMMENT '表名称',
|
||
`table_comment` varchar(500) DEFAULT '' COMMENT '表描述',
|
||
`sub_table_name` varchar(64) DEFAULT NULL COMMENT '关联子表的表名',
|
||
`sub_table_fk_name` varchar(64) DEFAULT NULL COMMENT '子表关联的外键名',
|
||
`class_name` varchar(100) DEFAULT '' COMMENT '实体类名称',
|
||
`tpl_category` varchar(200) DEFAULT 'crud' COMMENT '使用的模板(crud单表操作 tree树表操作)',
|
||
`package_name` varchar(100) DEFAULT NULL COMMENT '生成包路径',
|
||
`module_name` varchar(30) DEFAULT NULL COMMENT '生成模块名',
|
||
`business_name` varchar(30) DEFAULT NULL COMMENT '生成业务名',
|
||
`function_name` varchar(50) DEFAULT NULL COMMENT '生成功能名',
|
||
`function_author` varchar(50) DEFAULT NULL COMMENT '生成功能作者',
|
||
`gen_type` char(1) DEFAULT '0' COMMENT '生成代码方式(0zip压缩包 1自定义路径)',
|
||
`gen_path` varchar(200) DEFAULT '/' COMMENT '生成路径(不填默认项目路径)',
|
||
`options` varchar(1000) DEFAULT NULL COMMENT '其它生成选项',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`table_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='代码生成业务表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for gen_table_column
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `gen_table_column`;
|
||
CREATE TABLE `gen_table_column` (
|
||
`column_id` bigint(20) NOT NULL COMMENT '编号',
|
||
`table_id` bigint(20) DEFAULT NULL COMMENT '归属表编号',
|
||
`column_name` varchar(200) DEFAULT NULL COMMENT '列名称',
|
||
`column_comment` varchar(500) DEFAULT NULL COMMENT '列描述',
|
||
`column_type` varchar(100) DEFAULT NULL COMMENT '列类型',
|
||
`java_type` varchar(500) DEFAULT NULL COMMENT 'JAVA类型',
|
||
`java_field` varchar(200) DEFAULT NULL COMMENT 'JAVA字段名',
|
||
`is_pk` char(1) DEFAULT NULL COMMENT '是否主键(1是)',
|
||
`is_increment` char(1) DEFAULT NULL COMMENT '是否自增(1是)',
|
||
`is_required` char(1) DEFAULT NULL COMMENT '是否必填(1是)',
|
||
`is_insert` char(1) DEFAULT NULL COMMENT '是否为插入字段(1是)',
|
||
`is_edit` char(1) DEFAULT NULL COMMENT '是否编辑字段(1是)',
|
||
`is_list` char(1) DEFAULT NULL COMMENT '是否列表字段(1是)',
|
||
`is_query` char(1) DEFAULT NULL COMMENT '是否查询字段(1是)',
|
||
`query_type` varchar(200) DEFAULT 'EQ' COMMENT '查询方式(等于、不等于、大于、小于、范围)',
|
||
`html_type` varchar(200) DEFAULT NULL COMMENT '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)',
|
||
`dict_type` varchar(200) DEFAULT '' COMMENT '字典类型',
|
||
`sort` int(11) DEFAULT NULL COMMENT '排序',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
PRIMARY KEY (`column_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='代码生成业务表字段';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_distributed_lock
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_distributed_lock`;
|
||
CREATE TABLE `sj_distributed_lock` (
|
||
`name` varchar(64) NOT NULL COMMENT '锁名称',
|
||
`lock_until` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '锁定时长',
|
||
`locked_at` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '锁定时间',
|
||
`locked_by` varchar(255) NOT NULL COMMENT '锁定者',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`name`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='锁定表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_group_config
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_group_config`;
|
||
CREATE TABLE `sj_group_config` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL DEFAULT '' COMMENT '组名称',
|
||
`description` varchar(256) NOT NULL DEFAULT '' COMMENT '组描述',
|
||
`token` varchar(64) NOT NULL DEFAULT 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT' COMMENT 'token',
|
||
`group_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '组状态 0、未启用 1、启用',
|
||
`version` int(11) NOT NULL COMMENT '版本号',
|
||
`group_partition` int(11) NOT NULL COMMENT '分区',
|
||
`id_generator_mode` tinyint(4) NOT NULL DEFAULT '1' COMMENT '唯一id生成模式 默认号段模式',
|
||
`init_scene` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否初始化场景 0:否 1:是',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='组配置';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_job
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_job`;
|
||
CREATE TABLE `sj_job` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||
`job_name` varchar(64) NOT NULL COMMENT '名称',
|
||
`args_str` text COMMENT '执行方法参数',
|
||
`args_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '参数类型 ',
|
||
`next_trigger_at` bigint(13) NOT NULL COMMENT '下次触发时间',
|
||
`job_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '任务状态 0、关闭、1、开启',
|
||
`task_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '任务类型 1、集群 2、广播 3、切片',
|
||
`route_key` tinyint(4) NOT NULL DEFAULT '4' COMMENT '路由策略',
|
||
`executor_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '执行器类型',
|
||
`executor_info` varchar(255) DEFAULT NULL COMMENT '执行器名称',
|
||
`trigger_type` tinyint(4) NOT NULL COMMENT '触发类型 1.CRON 表达式 2. 固定时间',
|
||
`trigger_interval` varchar(255) NOT NULL COMMENT '间隔时长',
|
||
`block_strategy` tinyint(4) NOT NULL DEFAULT '1' COMMENT '阻塞策略 1、丢弃 2、覆盖 3、并行 4、恢复',
|
||
`executor_timeout` int(11) NOT NULL DEFAULT '0' COMMENT '任务执行超时时间,单位秒',
|
||
`max_retry_times` int(11) NOT NULL DEFAULT '0' COMMENT '最大重试次数',
|
||
`parallel_num` int(11) NOT NULL DEFAULT '1' COMMENT '并行数',
|
||
`retry_interval` int(11) NOT NULL DEFAULT '0' COMMENT '重试间隔(s)',
|
||
`bucket_index` int(11) NOT NULL DEFAULT '0' COMMENT 'bucket',
|
||
`resident` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否是常驻任务',
|
||
`notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT '通知告警场景配置id列表',
|
||
`owner_id` bigint(20) DEFAULT NULL COMMENT '负责人id',
|
||
`description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
|
||
`ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
|
||
`deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除 1、删除',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE,
|
||
KEY `idx_job_status_bucket_index` (`job_status`,`bucket_index`) USING BTREE,
|
||
KEY `idx_create_dt` (`create_dt`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='任务信息';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_job_log_message
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_job_log_message`;
|
||
CREATE TABLE `sj_job_log_message` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||
`job_id` bigint(20) NOT NULL COMMENT '任务信息id',
|
||
`task_batch_id` bigint(20) NOT NULL COMMENT '任务批次id',
|
||
`task_id` bigint(20) NOT NULL COMMENT '调度任务id',
|
||
`message` longtext NOT NULL COMMENT '调度信息',
|
||
`log_num` int(11) NOT NULL DEFAULT '1' COMMENT '日志数量',
|
||
`real_time` bigint(13) NOT NULL DEFAULT '0' COMMENT '上报时间',
|
||
`ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_task_batch_id_task_id` (`task_batch_id`,`task_id`) USING BTREE,
|
||
KEY `idx_create_dt` (`create_dt`) USING BTREE,
|
||
KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=2574 DEFAULT CHARSET=utf8mb4 COMMENT='调度日志';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_job_summary
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_job_summary`;
|
||
CREATE TABLE `sj_job_summary` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL DEFAULT '' COMMENT '组名称',
|
||
`business_id` bigint(20) NOT NULL COMMENT '业务id (job_id或workflow_id)',
|
||
`system_task_type` tinyint(4) NOT NULL DEFAULT '3' COMMENT '任务类型 3、JOB任务 4、WORKFLOW任务',
|
||
`trigger_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '统计时间',
|
||
`success_num` int(11) NOT NULL DEFAULT '0' COMMENT '执行成功-日志数量',
|
||
`fail_num` int(11) NOT NULL DEFAULT '0' COMMENT '执行失败-日志数量',
|
||
`fail_reason` varchar(512) NOT NULL DEFAULT '' COMMENT '失败原因',
|
||
`stop_num` int(11) NOT NULL DEFAULT '0' COMMENT '执行失败-日志数量',
|
||
`stop_reason` varchar(512) NOT NULL DEFAULT '' COMMENT '失败原因',
|
||
`cancel_num` int(11) NOT NULL DEFAULT '0' COMMENT '执行失败-日志数量',
|
||
`cancel_reason` varchar(512) NOT NULL DEFAULT '' COMMENT '失败原因',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_trigger_at_system_task_type_business_id` (`trigger_at`,`system_task_type`,`business_id`) USING BTREE,
|
||
KEY `idx_namespace_id_group_name_business_id` (`namespace_id`,`group_name`,`business_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=222 DEFAULT CHARSET=utf8mb4 COMMENT='DashBoard_Job';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_job_task
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_job_task`;
|
||
CREATE TABLE `sj_job_task` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||
`job_id` bigint(20) NOT NULL COMMENT '任务信息id',
|
||
`task_batch_id` bigint(20) NOT NULL COMMENT '调度任务id',
|
||
`parent_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '父执行器id',
|
||
`task_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '执行的状态 0、失败 1、成功',
|
||
`retry_count` int(11) NOT NULL DEFAULT '0' COMMENT '重试次数',
|
||
`mr_stage` tinyint(4) DEFAULT NULL COMMENT '动态分片所处阶段 1:map 2:reduce 3:mergeReduce',
|
||
`leaf` tinyint(4) NOT NULL DEFAULT '1' COMMENT '叶子节点',
|
||
`task_name` varchar(255) NOT NULL DEFAULT '' COMMENT '任务名称',
|
||
`client_info` varchar(128) DEFAULT NULL COMMENT '客户端地址 clientId#ip:port',
|
||
`wf_context` text COMMENT '工作流全局上下文',
|
||
`result_message` text NOT NULL COMMENT '执行结果',
|
||
`args_str` text COMMENT '执行方法参数',
|
||
`args_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '参数类型 ',
|
||
`ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_task_batch_id_task_status` (`task_batch_id`,`task_status`) USING BTREE,
|
||
KEY `idx_create_dt` (`create_dt`) USING BTREE,
|
||
KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='任务实例';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_job_task_batch
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_job_task_batch`;
|
||
CREATE TABLE `sj_job_task_batch` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||
`job_id` bigint(20) NOT NULL COMMENT '任务id',
|
||
`workflow_node_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '工作流节点id',
|
||
`parent_workflow_node_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '工作流任务父批次id',
|
||
`workflow_task_batch_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '工作流任务批次id',
|
||
`task_batch_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '任务批次状态 0、失败 1、成功',
|
||
`operation_reason` tinyint(4) NOT NULL DEFAULT '0' COMMENT '操作原因',
|
||
`execution_at` bigint(13) NOT NULL DEFAULT '0' COMMENT '任务执行时间',
|
||
`system_task_type` tinyint(4) NOT NULL DEFAULT '3' COMMENT '任务类型 3、JOB任务 4、WORKFLOW任务',
|
||
`parent_id` varchar(64) NOT NULL DEFAULT '' COMMENT '父节点',
|
||
`ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
|
||
`deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除 1、删除',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_job_id_task_batch_status` (`job_id`,`task_batch_status`) USING BTREE,
|
||
KEY `idx_create_dt` (`create_dt`) USING BTREE,
|
||
KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE,
|
||
KEY `idx_workflow_task_batch_id_workflow_node_id` (`workflow_task_batch_id`,`workflow_node_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=103406 DEFAULT CHARSET=utf8mb4 COMMENT='任务批次';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_namespace
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_namespace`;
|
||
CREATE TABLE `sj_namespace` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`name` varchar(64) NOT NULL COMMENT '名称',
|
||
`unique_id` varchar(64) NOT NULL COMMENT '唯一id',
|
||
`description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
|
||
`deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除 1、删除',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_unique_id` (`unique_id`) USING BTREE,
|
||
KEY `idx_name` (`name`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='命名空间';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_notify_config
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_notify_config`;
|
||
CREATE TABLE `sj_notify_config` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||
`notify_name` varchar(64) NOT NULL DEFAULT '' COMMENT '通知名称',
|
||
`system_task_type` tinyint(4) NOT NULL DEFAULT '3' COMMENT '任务类型 1. 重试任务 2. 重试回调 3、JOB任务 4、WORKFLOW任务',
|
||
`notify_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '通知状态 0、未启用 1、启用',
|
||
`recipient_ids` varchar(128) NOT NULL COMMENT '接收人id列表',
|
||
`notify_threshold` int(11) NOT NULL DEFAULT '0' COMMENT '通知阈值',
|
||
`notify_scene` tinyint(4) NOT NULL DEFAULT '0' COMMENT '通知场景',
|
||
`rate_limiter_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '限流状态 0、未启用 1、启用',
|
||
`rate_limiter_threshold` int(11) NOT NULL DEFAULT '0' COMMENT '每秒限流阈值',
|
||
`description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`,`group_name`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='通知配置';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_notify_recipient
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_notify_recipient`;
|
||
CREATE TABLE `sj_notify_recipient` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`recipient_name` varchar(64) NOT NULL COMMENT '接收人名称',
|
||
`notify_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书 5 webhook',
|
||
`notify_attribute` varchar(512) NOT NULL COMMENT '配置属性',
|
||
`description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_namespace_id` (`namespace_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='告警通知接收人';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_retry
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_retry`;
|
||
CREATE TABLE `sj_retry` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||
`group_id` bigint(20) NOT NULL COMMENT '组Id',
|
||
`scene_name` varchar(64) NOT NULL COMMENT '场景名称',
|
||
`scene_id` bigint(20) NOT NULL COMMENT '场景ID',
|
||
`idempotent_id` varchar(64) NOT NULL COMMENT '幂等id',
|
||
`biz_no` varchar(64) NOT NULL DEFAULT '' COMMENT '业务编号',
|
||
`executor_name` varchar(512) NOT NULL DEFAULT '' COMMENT '执行器名称',
|
||
`args_str` text NOT NULL COMMENT '执行方法参数',
|
||
`ext_attrs` text NOT NULL COMMENT '扩展字段',
|
||
`next_trigger_at` bigint(13) NOT NULL COMMENT '下次触发时间',
|
||
`retry_count` int(11) NOT NULL DEFAULT '0' COMMENT '重试次数',
|
||
`retry_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '重试状态 0、重试中 1、成功 2、最大重试次数',
|
||
`task_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '任务类型 1、重试数据 2、回调数据',
|
||
`bucket_index` int(11) NOT NULL DEFAULT '0' COMMENT 'bucket',
|
||
`parent_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '父节点id',
|
||
`deleted` bigint(20) NOT NULL DEFAULT '0' COMMENT '逻辑删除',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_scene_tasktype_idempotentid_deleted` (`scene_id`,`task_type`,`idempotent_id`,`deleted`) USING BTREE,
|
||
KEY `idx_biz_no` (`biz_no`) USING BTREE,
|
||
KEY `idx_idempotent_id` (`idempotent_id`) USING BTREE,
|
||
KEY `idx_retry_status_bucket_index` (`retry_status`,`bucket_index`) USING BTREE,
|
||
KEY `idx_parent_id` (`parent_id`) USING BTREE,
|
||
KEY `idx_create_dt` (`create_dt`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='重试信息表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_retry_dead_letter
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_retry_dead_letter`;
|
||
CREATE TABLE `sj_retry_dead_letter` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||
`group_id` bigint(20) NOT NULL COMMENT '组Id',
|
||
`scene_name` varchar(64) NOT NULL COMMENT '场景名称',
|
||
`scene_id` bigint(20) NOT NULL COMMENT '场景ID',
|
||
`idempotent_id` varchar(64) NOT NULL COMMENT '幂等id',
|
||
`biz_no` varchar(64) NOT NULL DEFAULT '' COMMENT '业务编号',
|
||
`executor_name` varchar(512) NOT NULL DEFAULT '' COMMENT '执行器名称',
|
||
`args_str` text NOT NULL COMMENT '执行方法参数',
|
||
`ext_attrs` text NOT NULL COMMENT '扩展字段',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`,`group_name`,`scene_name`) USING BTREE,
|
||
KEY `idx_idempotent_id` (`idempotent_id`) USING BTREE,
|
||
KEY `idx_biz_no` (`biz_no`) USING BTREE,
|
||
KEY `idx_create_dt` (`create_dt`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='死信队列表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_retry_scene_config
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_retry_scene_config`;
|
||
CREATE TABLE `sj_retry_scene_config` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`scene_name` varchar(64) NOT NULL COMMENT '场景名称',
|
||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||
`scene_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '组状态 0、未启用 1、启用',
|
||
`max_retry_count` int(11) NOT NULL DEFAULT '5' COMMENT '最大重试次数',
|
||
`back_off` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1、默认等级 2、固定间隔时间 3、CRON 表达式',
|
||
`trigger_interval` varchar(16) NOT NULL DEFAULT '' COMMENT '间隔时长',
|
||
`notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT '通知告警场景配置id列表',
|
||
`deadline_request` bigint(20) unsigned NOT NULL DEFAULT '60000' COMMENT 'Deadline Request 调用链超时 单位毫秒',
|
||
`executor_timeout` int(11) unsigned NOT NULL DEFAULT '5' COMMENT '任务执行超时时间,单位秒',
|
||
`route_key` tinyint(4) NOT NULL DEFAULT '4' COMMENT '路由策略',
|
||
`block_strategy` tinyint(4) NOT NULL DEFAULT '1' COMMENT '阻塞策略 1、丢弃 2、覆盖 3、并行',
|
||
`cb_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '回调状态 0、不开启 1、开启',
|
||
`cb_trigger_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1、默认等级 2、固定间隔时间 3、CRON 表达式',
|
||
`cb_max_count` int(11) NOT NULL DEFAULT '16' COMMENT '回调的最大执行次数',
|
||
`cb_trigger_interval` varchar(16) NOT NULL DEFAULT '' COMMENT '回调的最大执行次数',
|
||
`description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_namespace_id_group_name_scene_name` (`namespace_id`,`group_name`,`scene_name`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='场景配置';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_retry_summary
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_retry_summary`;
|
||
CREATE TABLE `sj_retry_summary` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL DEFAULT '' COMMENT '组名称',
|
||
`scene_name` varchar(50) NOT NULL DEFAULT '' COMMENT '场景名称',
|
||
`trigger_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '统计时间',
|
||
`running_num` int(11) NOT NULL DEFAULT '0' COMMENT '重试中-日志数量',
|
||
`finish_num` int(11) NOT NULL DEFAULT '0' COMMENT '重试完成-日志数量',
|
||
`max_count_num` int(11) NOT NULL DEFAULT '0' COMMENT '重试到达最大次数-日志数量',
|
||
`suspend_num` int(11) NOT NULL DEFAULT '0' COMMENT '暂停重试-日志数量',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_scene_name_trigger_at` (`namespace_id`,`group_name`,`scene_name`,`trigger_at`) USING BTREE,
|
||
KEY `idx_trigger_at` (`trigger_at`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='DashBoard_Retry';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_retry_task
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_retry_task`;
|
||
CREATE TABLE `sj_retry_task` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||
`scene_name` varchar(64) NOT NULL COMMENT '场景名称',
|
||
`retry_id` bigint(20) NOT NULL COMMENT '重试信息Id',
|
||
`ext_attrs` text NOT NULL COMMENT '扩展字段',
|
||
`task_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '重试状态',
|
||
`task_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '任务类型 1、重试数据 2、回调数据',
|
||
`operation_reason` tinyint(4) NOT NULL DEFAULT '0' COMMENT '操作原因',
|
||
`client_info` varchar(128) DEFAULT NULL COMMENT '客户端地址 clientId#ip:port',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_group_name_scene_name` (`namespace_id`,`group_name`,`scene_name`) USING BTREE,
|
||
KEY `task_status` (`task_status`) USING BTREE,
|
||
KEY `idx_create_dt` (`create_dt`) USING BTREE,
|
||
KEY `idx_retry_id` (`retry_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='重试任务表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_retry_task_log_message
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_retry_task_log_message`;
|
||
CREATE TABLE `sj_retry_task_log_message` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||
`retry_id` bigint(20) NOT NULL COMMENT '重试信息Id',
|
||
`retry_task_id` bigint(20) NOT NULL COMMENT '重试任务Id',
|
||
`message` longtext NOT NULL COMMENT '异常信息',
|
||
`log_num` int(11) NOT NULL DEFAULT '1' COMMENT '日志数量',
|
||
`real_time` bigint(13) NOT NULL DEFAULT '0' COMMENT '上报时间',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_namespace_id_group_name_retry_task_id` (`namespace_id`,`group_name`,`retry_task_id`) USING BTREE,
|
||
KEY `idx_create_dt` (`create_dt`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='任务调度日志信息记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_sequence_alloc
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_sequence_alloc`;
|
||
CREATE TABLE `sj_sequence_alloc` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL DEFAULT '' COMMENT '组名称',
|
||
`max_id` bigint(20) NOT NULL DEFAULT '1' COMMENT '最大id',
|
||
`step` int(11) NOT NULL DEFAULT '100' COMMENT '步长',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='号段模式序号ID分配表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_server_node
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_server_node`;
|
||
CREATE TABLE `sj_server_node` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||
`host_id` varchar(64) NOT NULL COMMENT '主机id',
|
||
`host_ip` varchar(64) NOT NULL COMMENT '机器ip',
|
||
`host_port` int(16) NOT NULL COMMENT '机器端口',
|
||
`expire_at` datetime NOT NULL COMMENT '过期时间',
|
||
`node_type` tinyint(4) NOT NULL COMMENT '节点类型 1、客户端 2、是服务端',
|
||
`ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_host_id_host_ip` (`host_id`,`host_ip`) USING BTREE,
|
||
KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE,
|
||
KEY `idx_expire_at_node_type` (`expire_at`,`node_type`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=805 DEFAULT CHARSET=utf8mb4 COMMENT='服务器节点';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_system_user
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_system_user`;
|
||
CREATE TABLE `sj_system_user` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`username` varchar(64) NOT NULL COMMENT '账号',
|
||
`password` varchar(128) NOT NULL COMMENT '密码',
|
||
`role` tinyint(4) NOT NULL DEFAULT '0' COMMENT '角色:1-普通用户、2-管理员',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_username` (`username`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='系统用户表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_system_user_permission
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_system_user_permission`;
|
||
CREATE TABLE `sj_system_user_permission` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`system_user_id` bigint(20) NOT NULL COMMENT '系统用户id',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_namespace_id_group_name_system_user_id` (`namespace_id`,`group_name`,`system_user_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统用户权限表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_workflow
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_workflow`;
|
||
CREATE TABLE `sj_workflow` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`workflow_name` varchar(64) NOT NULL COMMENT '工作流名称',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||
`workflow_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '工作流状态 0、关闭、1、开启',
|
||
`trigger_type` tinyint(4) NOT NULL COMMENT '触发类型 1.CRON 表达式 2. 固定时间',
|
||
`trigger_interval` varchar(255) NOT NULL COMMENT '间隔时长',
|
||
`next_trigger_at` bigint(20) NOT NULL COMMENT '下次触发时间',
|
||
`block_strategy` tinyint(4) NOT NULL DEFAULT '1' COMMENT '阻塞策略 1、丢弃 2、覆盖 3、并行',
|
||
`executor_timeout` int(11) NOT NULL DEFAULT '0' COMMENT '任务执行超时时间,单位秒',
|
||
`description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
|
||
`flow_info` text COMMENT '流程信息',
|
||
`wf_context` text COMMENT '上下文',
|
||
`notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT '通知告警场景配置id列表',
|
||
`bucket_index` int(11) NOT NULL DEFAULT '0' COMMENT 'bucket',
|
||
`version` int(11) NOT NULL COMMENT '版本号',
|
||
`ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
|
||
`deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除 1、删除',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_create_dt` (`create_dt`) USING BTREE,
|
||
KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作流';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_workflow_node
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_workflow_node`;
|
||
CREATE TABLE `sj_workflow_node` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`node_name` varchar(64) NOT NULL COMMENT '节点名称',
|
||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||
`job_id` bigint(20) NOT NULL COMMENT '任务信息id',
|
||
`workflow_id` bigint(20) NOT NULL COMMENT '工作流ID',
|
||
`node_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1、任务节点 2、条件节点',
|
||
`expression_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '1、SpEl、2、Aviator 3、QL',
|
||
`fail_strategy` tinyint(4) NOT NULL DEFAULT '1' COMMENT '失败策略 1、跳过 2、阻塞',
|
||
`workflow_node_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '工作流节点状态 0、关闭、1、开启',
|
||
`priority_level` int(11) NOT NULL DEFAULT '1' COMMENT '优先级',
|
||
`node_info` text COMMENT '节点信息 ',
|
||
`version` int(11) NOT NULL COMMENT '版本号',
|
||
`ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
|
||
`deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除 1、删除',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_create_dt` (`create_dt`) USING BTREE,
|
||
KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作流节点';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sj_workflow_task_batch
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sj_workflow_task_batch`;
|
||
CREATE TABLE `sj_workflow_task_batch` (
|
||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||
`workflow_id` bigint(20) NOT NULL COMMENT '工作流任务id',
|
||
`task_batch_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '任务批次状态 0、失败 1、成功',
|
||
`operation_reason` tinyint(4) NOT NULL DEFAULT '0' COMMENT '操作原因',
|
||
`flow_info` text COMMENT '流程信息',
|
||
`wf_context` text COMMENT '全局上下文',
|
||
`execution_at` bigint(13) NOT NULL DEFAULT '0' COMMENT '任务执行时间',
|
||
`ext_attrs` varchar(256) DEFAULT '' COMMENT '扩展字段',
|
||
`version` int(11) NOT NULL DEFAULT '1' COMMENT '版本号',
|
||
`deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除 1、删除',
|
||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_job_id_task_batch_status` (`workflow_id`,`task_batch_status`) USING BTREE,
|
||
KEY `idx_create_dt` (`create_dt`) USING BTREE,
|
||
KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作流批次';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_bucket_access_password
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_bucket_access_password`;
|
||
CREATE TABLE `sys_bucket_access_password` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`bucket_name` varchar(100) NOT NULL COMMENT 'bucket名称',
|
||
`access_password` varchar(255) NOT NULL COMMENT '访问密码(加密存储)',
|
||
`password_salt` varchar(100) NOT NULL COMMENT '密码盐值',
|
||
`is_active` tinyint(4) DEFAULT '1' COMMENT '是否启用(1启用 0禁用)',
|
||
`expire_time` datetime DEFAULT NULL COMMENT '密码过期时间',
|
||
`max_access_count` int(11) DEFAULT '0' COMMENT '最大访问次数(0表示无限制)',
|
||
`current_access_count` int(11) DEFAULT '0' COMMENT '当前访问次数',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`deleted` tinyint(4) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_bucket_name` (`bucket_name`) USING BTREE,
|
||
KEY `idx_bucket_access_password_bucket_name` (`bucket_name`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='bucket访问密码表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_bucket_access_record
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_bucket_access_record`;
|
||
CREATE TABLE `sys_bucket_access_record` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`bucket_name` varchar(100) NOT NULL COMMENT 'bucket名称',
|
||
`access_password_id` bigint(20) NOT NULL COMMENT '访问密码ID',
|
||
`access_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '访问时间',
|
||
`access_ip` varchar(50) DEFAULT NULL COMMENT '访问IP',
|
||
`access_user_agent` varchar(500) DEFAULT NULL COMMENT '用户代理',
|
||
`access_result` tinyint(4) DEFAULT '1' COMMENT '访问结果(1成功 0失败)',
|
||
`fail_reason` varchar(500) DEFAULT NULL COMMENT '失败原因',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_bucket_access_record_bucket_name` (`bucket_name`) USING BTREE,
|
||
KEY `idx_bucket_access_record_access_time` (`access_time`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='bucket访问记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_client
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_client`;
|
||
CREATE TABLE `sys_client` (
|
||
`id` bigint(20) NOT NULL COMMENT 'id',
|
||
`client_id` varchar(64) DEFAULT NULL COMMENT '客户端id',
|
||
`client_key` varchar(32) DEFAULT NULL COMMENT '客户端key',
|
||
`client_secret` varchar(255) DEFAULT NULL COMMENT '客户端秘钥',
|
||
`grant_type` varchar(255) DEFAULT NULL COMMENT '授权类型',
|
||
`device_type` varchar(32) DEFAULT NULL COMMENT '设备类型',
|
||
`active_timeout` int(11) DEFAULT '1800' COMMENT 'token活跃超时时间',
|
||
`timeout` int(11) DEFAULT '604800' COMMENT 'token固定超时',
|
||
`status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统授权表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_config
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_config`;
|
||
CREATE TABLE `sys_config` (
|
||
`config_id` bigint(20) NOT NULL COMMENT '参数主键',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`config_name` varchar(100) DEFAULT '' COMMENT '参数名称',
|
||
`config_key` varchar(100) DEFAULT '' COMMENT '参数键名',
|
||
`config_value` varchar(500) DEFAULT '' COMMENT '参数键值',
|
||
`config_type` char(1) DEFAULT 'N' COMMENT '系统内置(Y是 N否)',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`config_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='参数配置表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_dept
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_dept`;
|
||
CREATE TABLE `sys_dept` (
|
||
`dept_id` bigint(20) NOT NULL COMMENT '部门id',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`parent_id` bigint(20) DEFAULT '0' COMMENT '父部门id',
|
||
`ancestors` varchar(500) DEFAULT '' COMMENT '祖级列表',
|
||
`dept_name` varchar(30) DEFAULT '' COMMENT '部门名称',
|
||
`dept_category` varchar(100) DEFAULT NULL COMMENT '部门类别编码',
|
||
`order_num` int(4) DEFAULT '0' COMMENT '显示顺序',
|
||
`leader` bigint(20) DEFAULT NULL COMMENT '负责人',
|
||
`phone` varchar(11) DEFAULT NULL COMMENT '联系电话',
|
||
`email` varchar(50) DEFAULT NULL COMMENT '邮箱',
|
||
`status` char(1) DEFAULT '0' COMMENT '部门状态(0正常 1停用)',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
PRIMARY KEY (`dept_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='部门表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_dict_data
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_dict_data`;
|
||
CREATE TABLE `sys_dict_data` (
|
||
`dict_code` bigint(20) NOT NULL COMMENT '字典编码',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`dict_sort` int(4) DEFAULT '0' COMMENT '字典排序',
|
||
`dict_label` varchar(100) DEFAULT '' COMMENT '字典标签',
|
||
`dict_value` varchar(100) DEFAULT '' COMMENT '字典键值',
|
||
`dict_type` varchar(100) DEFAULT '' COMMENT '字典类型',
|
||
`css_class` varchar(100) DEFAULT NULL COMMENT '样式属性(其他样式扩展)',
|
||
`list_class` varchar(100) DEFAULT NULL COMMENT '表格回显样式',
|
||
`is_default` char(1) DEFAULT 'N' COMMENT '是否默认(Y是 N否)',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`dict_code`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='字典数据表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_dict_type
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_dict_type`;
|
||
CREATE TABLE `sys_dict_type` (
|
||
`dict_id` bigint(20) NOT NULL COMMENT '字典主键',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`dict_name` varchar(100) DEFAULT '' COMMENT '字典名称',
|
||
`dict_type` varchar(100) DEFAULT '' COMMENT '字典类型',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`dict_id`) USING BTREE,
|
||
UNIQUE KEY `tenant_id` (`tenant_id`,`dict_type`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='字典类型表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_file_access_log
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_file_access_log`;
|
||
CREATE TABLE `sys_file_access_log` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`oss_id` bigint(20) NOT NULL COMMENT '文件ID',
|
||
`user_id` bigint(20) NOT NULL COMMENT '访问用户ID',
|
||
`access_type` varchar(20) NOT NULL COMMENT '访问类型:DOWNLOAD, PREVIEW',
|
||
`access_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '访问时间',
|
||
`ip_address` varchar(50) DEFAULT NULL COMMENT '访问IP',
|
||
`user_agent` varchar(500) DEFAULT NULL COMMENT '用户代理',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_file_access_log_oss_id` (`oss_id`) USING BTREE,
|
||
KEY `idx_file_access_log_user_id` (`user_id`) USING BTREE,
|
||
KEY `idx_file_access_log_access_time` (`access_time`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文件访问日志表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_file_permission
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_file_permission`;
|
||
CREATE TABLE `sys_file_permission` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||
`oss_id` bigint(20) NOT NULL COMMENT '文件ID',
|
||
`user_id` bigint(20) DEFAULT NULL COMMENT '用户ID(为空表示角色权限)',
|
||
`role_id` bigint(20) DEFAULT NULL COMMENT '角色ID(为空表示用户权限)',
|
||
`permission_type` varchar(20) NOT NULL COMMENT '权限类型:READ, WRITE, DELETE',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`deleted` tinyint(4) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_file_permission_oss_id` (`oss_id`) USING BTREE,
|
||
KEY `idx_file_permission_user_id` (`user_id`) USING BTREE,
|
||
KEY `idx_file_permission_role_id` (`role_id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=108 DEFAULT CHARSET=utf8mb4 COMMENT='文件权限表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_logininfor
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_logininfor`;
|
||
CREATE TABLE `sys_logininfor` (
|
||
`info_id` bigint(20) NOT NULL COMMENT '访问ID',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`user_name` varchar(50) DEFAULT '' COMMENT '用户账号',
|
||
`client_key` varchar(32) DEFAULT '' COMMENT '客户端',
|
||
`device_type` varchar(32) DEFAULT '' COMMENT '设备类型',
|
||
`ipaddr` varchar(128) DEFAULT '' COMMENT '登录IP地址',
|
||
`login_location` varchar(255) DEFAULT '' COMMENT '登录地点',
|
||
`browser` varchar(50) DEFAULT '' COMMENT '浏览器类型',
|
||
`os` varchar(50) DEFAULT '' COMMENT '操作系统',
|
||
`status` char(1) DEFAULT '0' COMMENT '登录状态(0成功 1失败)',
|
||
`msg` varchar(255) DEFAULT '' COMMENT '提示消息',
|
||
`login_time` datetime DEFAULT NULL COMMENT '访问时间',
|
||
PRIMARY KEY (`info_id`) USING BTREE,
|
||
KEY `idx_sys_logininfor_s` (`status`) USING BTREE,
|
||
KEY `idx_sys_logininfor_lt` (`login_time`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统访问记录';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_menu
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_menu`;
|
||
CREATE TABLE `sys_menu` (
|
||
`menu_id` bigint(20) NOT NULL COMMENT '菜单ID',
|
||
`menu_name` varchar(50) NOT NULL COMMENT '菜单名称',
|
||
`parent_id` bigint(20) DEFAULT '0' COMMENT '父菜单ID',
|
||
`order_num` int(4) DEFAULT '0' COMMENT '显示顺序',
|
||
`path` varchar(200) DEFAULT '' COMMENT '路由地址',
|
||
`component` varchar(255) DEFAULT NULL COMMENT '组件路径',
|
||
`query_param` varchar(255) DEFAULT NULL COMMENT '路由参数',
|
||
`is_frame` int(1) DEFAULT '1' COMMENT '是否为外链(0是 1否)',
|
||
`is_cache` int(1) DEFAULT '0' COMMENT '是否缓存(0缓存 1不缓存)',
|
||
`menu_type` char(1) DEFAULT '' COMMENT '菜单类型(M目录 C菜单 F按钮)',
|
||
`visible` char(1) DEFAULT '0' COMMENT '显示状态(0显示 1隐藏)',
|
||
`status` char(1) DEFAULT '0' COMMENT '菜单状态(0正常 1停用)',
|
||
`perms` varchar(100) DEFAULT NULL COMMENT '权限标识',
|
||
`icon` varchar(100) DEFAULT '#' COMMENT '菜单图标',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT '' COMMENT '备注',
|
||
PRIMARY KEY (`menu_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜单权限表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_menu_20251004
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_menu_20251004`;
|
||
CREATE TABLE `sys_menu_20251004` (
|
||
`menu_id` bigint(20) NOT NULL COMMENT '菜单ID',
|
||
`menu_name` varchar(50) NOT NULL COMMENT '菜单名称',
|
||
`parent_id` bigint(20) DEFAULT '0' COMMENT '父菜单ID',
|
||
`order_num` int(4) DEFAULT '0' COMMENT '显示顺序',
|
||
`path` varchar(200) DEFAULT '' COMMENT '路由地址',
|
||
`component` varchar(255) DEFAULT NULL COMMENT '组件路径',
|
||
`query_param` varchar(255) DEFAULT NULL COMMENT '路由参数',
|
||
`is_frame` int(1) DEFAULT '1' COMMENT '是否为外链(0是 1否)',
|
||
`is_cache` int(1) DEFAULT '0' COMMENT '是否缓存(0缓存 1不缓存)',
|
||
`menu_type` char(1) DEFAULT '' COMMENT '菜单类型(M目录 C菜单 F按钮)',
|
||
`visible` char(1) DEFAULT '0' COMMENT '显示状态(0显示 1隐藏)',
|
||
`status` char(1) DEFAULT '0' COMMENT '菜单状态(0正常 1停用)',
|
||
`perms` varchar(100) DEFAULT NULL COMMENT '权限标识',
|
||
`icon` varchar(100) DEFAULT '#' COMMENT '菜单图标',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT '' COMMENT '备注',
|
||
PRIMARY KEY (`menu_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜单权限表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_menu_linshi
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_menu_linshi`;
|
||
CREATE TABLE `sys_menu_linshi` (
|
||
`menu_id` bigint(20) NOT NULL COMMENT '菜单ID',
|
||
`menu_name` varchar(50) NOT NULL COMMENT '菜单名称',
|
||
`parent_id` bigint(20) DEFAULT '0' COMMENT '父菜单ID',
|
||
`order_num` int(4) DEFAULT '0' COMMENT '显示顺序',
|
||
`path` varchar(200) DEFAULT '' COMMENT '路由地址',
|
||
`component` varchar(255) DEFAULT NULL COMMENT '组件路径',
|
||
`query_param` varchar(255) DEFAULT NULL COMMENT '路由参数',
|
||
`is_frame` int(1) DEFAULT '1' COMMENT '是否为外链(0是 1否)',
|
||
`is_cache` int(1) DEFAULT '0' COMMENT '是否缓存(0缓存 1不缓存)',
|
||
`menu_type` char(1) DEFAULT '' COMMENT '菜单类型(M目录 C菜单 F按钮)',
|
||
`visible` char(1) DEFAULT '0' COMMENT '显示状态(0显示 1隐藏)',
|
||
`status` char(1) DEFAULT '0' COMMENT '菜单状态(0正常 1停用)',
|
||
`perms` varchar(100) DEFAULT NULL COMMENT '权限标识',
|
||
`icon` varchar(100) DEFAULT '#' COMMENT '菜单图标',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT '' COMMENT '备注',
|
||
PRIMARY KEY (`menu_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜单权限表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_notice
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_notice`;
|
||
CREATE TABLE `sys_notice` (
|
||
`notice_id` bigint(20) NOT NULL COMMENT '公告ID',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`notice_title` varchar(50) NOT NULL COMMENT '公告标题',
|
||
`notice_type` char(1) NOT NULL COMMENT '公告类型(1通知 2公告)',
|
||
`notice_content` longblob COMMENT '公告内容',
|
||
`status` char(1) DEFAULT '0' COMMENT '公告状态(0正常 1关闭)',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`notice_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='通知公告表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_oper_log
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_oper_log`;
|
||
CREATE TABLE `sys_oper_log` (
|
||
`oper_id` bigint(20) NOT NULL COMMENT '日志主键',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`title` varchar(50) DEFAULT '' COMMENT '模块标题',
|
||
`business_type` int(2) DEFAULT '0' COMMENT '业务类型(0其它 1新增 2修改 3删除)',
|
||
`method` varchar(100) DEFAULT '' COMMENT '方法名称',
|
||
`request_method` varchar(10) DEFAULT '' COMMENT '请求方式',
|
||
`operator_type` int(1) DEFAULT '0' COMMENT '操作类别(0其它 1后台用户 2手机端用户)',
|
||
`oper_name` varchar(50) DEFAULT '' COMMENT '操作人员',
|
||
`dept_name` varchar(50) DEFAULT '' COMMENT '部门名称',
|
||
`oper_url` varchar(255) DEFAULT '' COMMENT '请求URL',
|
||
`oper_ip` varchar(128) DEFAULT '' COMMENT '主机地址',
|
||
`oper_location` varchar(255) DEFAULT '' COMMENT '操作地点',
|
||
`oper_param` varchar(4000) DEFAULT '' COMMENT '请求参数',
|
||
`json_result` varchar(4000) DEFAULT '' COMMENT '返回参数',
|
||
`status` int(1) DEFAULT '0' COMMENT '操作状态(0正常 1异常)',
|
||
`error_msg` varchar(4000) DEFAULT '' COMMENT '错误消息',
|
||
`oper_time` datetime DEFAULT NULL COMMENT '操作时间',
|
||
`cost_time` bigint(20) DEFAULT '0' COMMENT '消耗时间',
|
||
PRIMARY KEY (`oper_id`) USING BTREE,
|
||
KEY `idx_sys_oper_log_bt` (`business_type`) USING BTREE,
|
||
KEY `idx_sys_oper_log_s` (`status`) USING BTREE,
|
||
KEY `idx_sys_oper_log_ot` (`oper_time`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='操作日志记录';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_oss
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_oss`;
|
||
CREATE TABLE `sys_oss` (
|
||
`oss_id` bigint(20) NOT NULL COMMENT '对象存储主键',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`file_name` varchar(255) NOT NULL DEFAULT '' COMMENT '文件名',
|
||
`original_name` varchar(255) NOT NULL DEFAULT '' COMMENT '原名',
|
||
`file_suffix` varchar(10) NOT NULL DEFAULT '' COMMENT '文件后缀名',
|
||
`url` varchar(500) NOT NULL COMMENT 'URL地址',
|
||
`ext1` text COMMENT '扩展字段',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '上传人',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新人',
|
||
`service` varchar(20) NOT NULL DEFAULT 'minio' COMMENT '服务商',
|
||
PRIMARY KEY (`oss_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='OSS对象存储表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_oss_config
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_oss_config`;
|
||
CREATE TABLE `sys_oss_config` (
|
||
`oss_config_id` bigint(20) NOT NULL COMMENT '主键',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`config_key` varchar(20) NOT NULL DEFAULT '' COMMENT '配置key',
|
||
`access_key` varchar(255) DEFAULT '' COMMENT 'accessKey',
|
||
`secret_key` varchar(255) DEFAULT '' COMMENT '秘钥',
|
||
`bucket_name` varchar(255) DEFAULT '' COMMENT '桶名称',
|
||
`prefix` varchar(255) DEFAULT '' COMMENT '前缀',
|
||
`endpoint` varchar(255) DEFAULT '' COMMENT '访问站点',
|
||
`domain` varchar(255) DEFAULT '' COMMENT '自定义域名',
|
||
`is_https` char(1) DEFAULT 'N' COMMENT '是否https(Y=是,N=否)',
|
||
`region` varchar(255) DEFAULT '' COMMENT '域',
|
||
`access_policy` char(1) NOT NULL DEFAULT '1' COMMENT '桶权限类型(0=private 1=public 2=custom)',
|
||
`status` char(1) DEFAULT '1' COMMENT '是否默认(0=是,1=否)',
|
||
`ext1` varchar(255) DEFAULT '' COMMENT '扩展字段',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`oss_config_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='对象存储配置表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_post
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_post`;
|
||
CREATE TABLE `sys_post` (
|
||
`post_id` bigint(20) NOT NULL COMMENT '岗位ID',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`dept_id` bigint(20) NOT NULL COMMENT '部门id',
|
||
`post_code` varchar(64) NOT NULL COMMENT '岗位编码',
|
||
`post_category` varchar(100) DEFAULT NULL COMMENT '岗位类别编码',
|
||
`post_name` varchar(50) NOT NULL COMMENT '岗位名称',
|
||
`post_sort` int(4) NOT NULL COMMENT '显示顺序',
|
||
`status` char(1) NOT NULL COMMENT '状态(0正常 1停用)',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`post_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='岗位信息表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_region
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_region`;
|
||
CREATE TABLE `sys_region` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`code` varchar(20) NOT NULL COMMENT '行政区划编码',
|
||
`name` varchar(50) NOT NULL COMMENT '行政区划名称',
|
||
`short_name` varchar(30) DEFAULT NULL COMMENT '行政区划简称',
|
||
`parent_code` bigint(20) DEFAULT '0' COMMENT '父级行政区划编码,顶级为0',
|
||
`level` tinyint(1) NOT NULL COMMENT '层级(1:省,2:市,3:区/县,4:街道/镇)',
|
||
`sort` int(11) DEFAULT '0' COMMENT '排序',
|
||
`status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
`longitude` decimal(10,7) DEFAULT NULL COMMENT '经度',
|
||
`latitude` decimal(10,7) DEFAULT NULL COMMENT '纬度',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '逻辑删除标识(0未删除 1已删除)',
|
||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `idx_region_code` (`code`,`deleted`,`tenant_id`) USING BTREE,
|
||
KEY `idx_region_parent_code` (`parent_code`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='行政区划表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_role
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_role`;
|
||
CREATE TABLE `sys_role` (
|
||
`role_id` bigint(20) NOT NULL COMMENT '角色ID',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`role_name` varchar(30) NOT NULL COMMENT '角色名称',
|
||
`role_key` varchar(100) NOT NULL COMMENT '角色权限字符串',
|
||
`role_sort` int(4) NOT NULL COMMENT '显示顺序',
|
||
`data_scope` char(1) DEFAULT '1' COMMENT '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:仅本人数据权限 6:部门及以下或本人数据权限)',
|
||
`menu_check_strictly` tinyint(1) DEFAULT '1' COMMENT '菜单树选择项是否关联显示',
|
||
`dept_check_strictly` tinyint(1) DEFAULT '1' COMMENT '部门树选择项是否关联显示',
|
||
`status` char(1) NOT NULL COMMENT '角色状态(0正常 1停用)',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`role_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色信息表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_role_dept
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_role_dept`;
|
||
CREATE TABLE `sys_role_dept` (
|
||
`role_id` bigint(20) NOT NULL COMMENT '角色ID',
|
||
`dept_id` bigint(20) NOT NULL COMMENT '部门ID',
|
||
PRIMARY KEY (`role_id`,`dept_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色和部门关联表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_role_menu
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_role_menu`;
|
||
CREATE TABLE `sys_role_menu` (
|
||
`role_id` bigint(20) NOT NULL COMMENT '角色ID',
|
||
`menu_id` bigint(20) NOT NULL COMMENT '菜单ID',
|
||
PRIMARY KEY (`role_id`,`menu_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色和菜单关联表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_social
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_social`;
|
||
CREATE TABLE `sys_social` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键',
|
||
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户id',
|
||
`auth_id` varchar(255) NOT NULL COMMENT '平台+平台唯一id',
|
||
`source` varchar(255) NOT NULL COMMENT '用户来源',
|
||
`open_id` varchar(255) DEFAULT NULL COMMENT '平台编号唯一id',
|
||
`user_name` varchar(30) NOT NULL COMMENT '登录账号',
|
||
`nick_name` varchar(30) DEFAULT '' COMMENT '用户昵称',
|
||
`email` varchar(255) DEFAULT '' COMMENT '用户邮箱',
|
||
`avatar` varchar(500) DEFAULT '' COMMENT '头像地址',
|
||
`access_token` varchar(2000) NOT NULL COMMENT '用户的授权令牌',
|
||
`expire_in` int(11) DEFAULT NULL COMMENT '用户的授权令牌的有效期,部分平台可能没有',
|
||
`refresh_token` varchar(255) DEFAULT NULL COMMENT '刷新令牌,部分平台可能没有',
|
||
`access_code` varchar(2000) DEFAULT NULL COMMENT '平台的授权信息,部分平台可能没有',
|
||
`union_id` varchar(255) DEFAULT NULL COMMENT '用户的 unionid',
|
||
`scope` varchar(255) DEFAULT NULL COMMENT '授予的权限,部分平台可能没有',
|
||
`token_type` varchar(255) DEFAULT NULL COMMENT '个别平台的授权信息,部分平台可能没有',
|
||
`id_token` varchar(2000) DEFAULT NULL COMMENT 'id token,部分平台可能没有',
|
||
`mac_algorithm` varchar(255) DEFAULT NULL COMMENT '小米平台用户的附带属性,部分平台可能没有',
|
||
`mac_key` varchar(255) DEFAULT NULL COMMENT '小米平台用户的附带属性,部分平台可能没有',
|
||
`code` varchar(255) DEFAULT NULL COMMENT '用户的授权code,部分平台可能没有',
|
||
`oauth_token` varchar(255) DEFAULT NULL COMMENT 'Twitter平台用户的附带属性,部分平台可能没有',
|
||
`oauth_token_secret` varchar(255) DEFAULT NULL COMMENT 'Twitter平台用户的附带属性,部分平台可能没有',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='社会化关系表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_tenant
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_tenant`;
|
||
CREATE TABLE `sys_tenant` (
|
||
`id` bigint(20) NOT NULL COMMENT 'id',
|
||
`tenant_id` varchar(20) NOT NULL COMMENT '租户编号',
|
||
`contact_user_name` varchar(20) DEFAULT NULL COMMENT '联系人',
|
||
`contact_phone` varchar(20) DEFAULT NULL COMMENT '联系电话',
|
||
`company_name` varchar(30) DEFAULT NULL COMMENT '企业名称',
|
||
`license_number` varchar(30) DEFAULT NULL COMMENT '统一社会信用代码',
|
||
`address` varchar(200) DEFAULT NULL COMMENT '地址',
|
||
`intro` varchar(200) DEFAULT NULL COMMENT '企业简介',
|
||
`domain` varchar(200) DEFAULT NULL COMMENT '域名',
|
||
`remark` varchar(200) DEFAULT NULL COMMENT '备注',
|
||
`package_id` bigint(20) DEFAULT NULL COMMENT '租户套餐编号',
|
||
`expire_time` datetime DEFAULT NULL COMMENT '过期时间',
|
||
`account_count` int(11) DEFAULT '-1' COMMENT '用户数量(-1不限制)',
|
||
`status` char(1) DEFAULT '0' COMMENT '租户状态(0正常 1停用)',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='租户表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_tenant_package
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_tenant_package`;
|
||
CREATE TABLE `sys_tenant_package` (
|
||
`package_id` bigint(20) NOT NULL COMMENT '租户套餐id',
|
||
`package_name` varchar(20) DEFAULT NULL COMMENT '套餐名称',
|
||
`menu_ids` varchar(3000) DEFAULT NULL COMMENT '关联菜单id',
|
||
`remark` varchar(200) DEFAULT NULL COMMENT '备注',
|
||
`menu_check_strictly` tinyint(1) DEFAULT '1' COMMENT '菜单树选择项是否关联显示',
|
||
`status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
PRIMARY KEY (`package_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='租户套餐表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_user
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_user`;
|
||
CREATE TABLE `sys_user` (
|
||
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`dept_id` bigint(20) DEFAULT NULL COMMENT '部门ID',
|
||
`user_name` varchar(30) NOT NULL COMMENT '用户账号',
|
||
`nick_name` varchar(30) NOT NULL COMMENT '用户昵称',
|
||
`user_type` varchar(10) DEFAULT 'sys_user' COMMENT '用户类型(sys_user系统用户)',
|
||
`email` varchar(50) DEFAULT '' COMMENT '用户邮箱',
|
||
`phonenumber` varchar(11) DEFAULT '' COMMENT '手机号码',
|
||
`sex` char(1) DEFAULT '0' COMMENT '用户性别(0男 1女 2未知)',
|
||
`avatar` bigint(20) DEFAULT NULL COMMENT '头像地址',
|
||
`password` varchar(100) DEFAULT '' COMMENT '密码',
|
||
`status` char(1) DEFAULT '0' COMMENT '帐号状态(0正常 1停用)',
|
||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`login_ip` varchar(128) DEFAULT '' COMMENT '最后登录IP',
|
||
`login_date` datetime DEFAULT NULL COMMENT '最后登录时间',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
`account_type` varchar(255) DEFAULT '1' COMMENT '账户类型 1 - 教职工 2- 学生',
|
||
PRIMARY KEY (`user_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户信息表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_user_post
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_user_post`;
|
||
CREATE TABLE `sys_user_post` (
|
||
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
|
||
`post_id` bigint(20) NOT NULL COMMENT '岗位ID',
|
||
PRIMARY KEY (`user_id`,`post_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户与岗位关联表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_user_role
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_user_role`;
|
||
CREATE TABLE `sys_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
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户和角色关联表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for sys_wechat_config
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `sys_wechat_config`;
|
||
CREATE TABLE `sys_wechat_config` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '参数主键',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`config_name` varchar(100) DEFAULT '' COMMENT '参数名称',
|
||
`config_key` varchar(100) DEFAULT '' COMMENT '参数键名',
|
||
`config_value` varchar(500) DEFAULT '' COMMENT '参数键值',
|
||
`config_type` char(1) DEFAULT 'N' COMMENT '系统内置(Y是 N否)',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COMMENT='参数配置表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for test_demo
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `test_demo`;
|
||
CREATE TABLE `test_demo` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`dept_id` bigint(20) DEFAULT NULL COMMENT '部门id',
|
||
`user_id` bigint(20) DEFAULT NULL COMMENT '用户id',
|
||
`order_num` int(11) DEFAULT '0' COMMENT '排序号',
|
||
`test_key` varchar(255) DEFAULT NULL COMMENT 'key键',
|
||
`value` varchar(255) DEFAULT NULL COMMENT '值',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建人',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新人',
|
||
`del_flag` int(11) DEFAULT '0' COMMENT '删除标志',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='测试单表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for test_leave
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `test_leave`;
|
||
CREATE TABLE `test_leave` (
|
||
`id` bigint(20) NOT NULL COMMENT 'id',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`leave_type` varchar(255) NOT NULL COMMENT '请假类型',
|
||
`start_date` datetime NOT NULL COMMENT '开始时间',
|
||
`end_date` datetime NOT NULL COMMENT '结束时间',
|
||
`leave_days` int(10) NOT NULL COMMENT '请假天数',
|
||
`remark` varchar(255) DEFAULT NULL COMMENT '请假原因',
|
||
`status` varchar(255) DEFAULT NULL COMMENT '状态',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='请假申请表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for test_tree
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `test_tree`;
|
||
CREATE TABLE `test_tree` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`parent_id` bigint(20) DEFAULT '0' COMMENT '父id',
|
||
`dept_id` bigint(20) DEFAULT NULL COMMENT '部门id',
|
||
`user_id` bigint(20) DEFAULT NULL COMMENT '用户id',
|
||
`tree_name` varchar(255) DEFAULT NULL COMMENT '值',
|
||
`version` int(11) DEFAULT '0' COMMENT '版本',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建人',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新人',
|
||
`del_flag` int(11) DEFAULT '0' COMMENT '删除标志',
|
||
PRIMARY KEY (`id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='测试树表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_class_msg
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_class_msg`;
|
||
CREATE TABLE `xg_class_msg` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
|
||
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`college_id` bigint(20) DEFAULT NULL COMMENT '学院代码',
|
||
`college_name` varchar(100) DEFAULT NULL COMMENT '学院名称',
|
||
`major_id` bigint(20) DEFAULT NULL COMMENT '专业代码',
|
||
`major_name` varchar(100) DEFAULT NULL COMMENT '专业名称',
|
||
`class_code` varchar(32) NOT NULL COMMENT '班级代码',
|
||
`class_name` varchar(100) NOT NULL COMMENT '班级名称',
|
||
`class_type` varchar(20) DEFAULT '1' COMMENT '班级类型:1-中级工 2-高级工 3-预备技师 4-技师 5-中高职一体',
|
||
`grade` varchar(10) NOT NULL COMMENT '年级',
|
||
`enrollment_year` int(4) NOT NULL COMMENT '入学年份',
|
||
`graduation_year` int(4) DEFAULT NULL COMMENT '毕业年份',
|
||
`training_type` varchar(20) DEFAULT NULL COMMENT '培养方式:全日制,在职,函授,夜大等',
|
||
`degree_type` varchar(20) DEFAULT NULL COMMENT '学位类型:学士,硕士,博士,专科',
|
||
`counselor_id` bigint(20) DEFAULT NULL COMMENT '辅导员ID',
|
||
`counselor_name` varchar(50) DEFAULT NULL COMMENT '辅导员姓名',
|
||
`class_teacher_id` bigint(20) DEFAULT NULL COMMENT '班主任ID',
|
||
`class_teacher_name` varchar(50) DEFAULT NULL COMMENT '班主任姓名',
|
||
`class_advisor_id` bigint(20) DEFAULT NULL COMMENT '班级导师ID',
|
||
`class_advisor_name` varchar(50) DEFAULT NULL COMMENT '班级导师姓名',
|
||
`class_monitor_id` bigint(20) DEFAULT NULL COMMENT '班长ID',
|
||
`class_monitor_name` varchar(50) DEFAULT NULL COMMENT '班长姓名',
|
||
`deputy_monitor_id` bigint(20) DEFAULT NULL COMMENT '副班长ID',
|
||
`deputy_monitor_name` varchar(50) DEFAULT NULL COMMENT '副班长姓名',
|
||
`class_status` char(1) DEFAULT '1' COMMENT '班级状态:1-正常,2-暂停,3-毕业,4-解散',
|
||
`is_graduation` tinyint(1) DEFAULT '0' COMMENT '是否已毕业:0-未毕业,1-已毕业',
|
||
`graduation_date` date DEFAULT NULL COMMENT '毕业日期',
|
||
`planned_capacity` int(11) DEFAULT '50' COMMENT '计划容量',
|
||
`current_student_count` int(11) DEFAULT '0' COMMENT '当前学生人数',
|
||
`max_student_count` int(11) DEFAULT '50' COMMENT '最大学生人数',
|
||
`male_count` int(11) DEFAULT '0' COMMENT '男生人数',
|
||
`female_count` int(11) DEFAULT '0' COMMENT '女生人数',
|
||
`active_count` int(11) DEFAULT '0' COMMENT '在籍人数',
|
||
`transfer_in_count` int(11) DEFAULT '0' COMMENT '转入人数',
|
||
`transfer_out_count` int(11) DEFAULT '0' COMMENT '转出人数',
|
||
`dropout_count` int(11) DEFAULT '0' COMMENT '退学人数',
|
||
`graduate_count` int(11) DEFAULT '0' COMMENT '毕业人数',
|
||
`office_location` varchar(200) DEFAULT NULL COMMENT '班级办公室位置',
|
||
`class_location` varchar(100) DEFAULT NULL COMMENT '班级教室位置',
|
||
`contact_phone` varchar(20) DEFAULT NULL COMMENT '联系电话',
|
||
`qq_group` varchar(20) DEFAULT NULL COMMENT 'QQ群号',
|
||
`wechat_group` varchar(100) DEFAULT NULL COMMENT '微信群',
|
||
`email` varchar(100) DEFAULT NULL COMMENT '班级邮箱',
|
||
`class_schedule` text COMMENT '课程安排(JSON格式)',
|
||
`class_culture` text COMMENT '班级文化建设',
|
||
`class_rules` text COMMENT '班级规章制度',
|
||
`class_description` varchar(500) DEFAULT NULL COMMENT '班级描述',
|
||
`last_count_update` datetime DEFAULT NULL COMMENT '最后统计更新时间',
|
||
`ext_field1` varchar(200) DEFAULT NULL COMMENT '扩展字段1',
|
||
`ext_field2` varchar(200) DEFAULT NULL COMMENT '扩展字段2',
|
||
`ext_field3` varchar(200) DEFAULT NULL COMMENT '扩展字段3',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
|
||
`school_system` int(11) DEFAULT '4' COMMENT '学制(年)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `uk_class_code_tenant` (`class_code`,`tenant_id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_deleted` (`deleted`) USING BTREE,
|
||
KEY `idx_college_id` (`college_id`) USING BTREE,
|
||
KEY `idx_enrollment_year` (`enrollment_year`) USING BTREE,
|
||
KEY `idx_grade` (`grade`) USING BTREE,
|
||
KEY `idx_major_id` (`major_id`) USING BTREE,
|
||
KEY `idx_counselor_id` (`counselor_id`) USING BTREE,
|
||
KEY `idx_class_teacher_id` (`class_teacher_id`) USING BTREE,
|
||
KEY `idx_class_status` (`class_status`) USING BTREE,
|
||
KEY `idx_college_grade` (`college_id`,`grade`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='班级信息表-新版';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_class_pos_dict
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_class_pos_dict`;
|
||
CREATE TABLE `xg_class_pos_dict` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
|
||
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`position_code` varchar(20) NOT NULL COMMENT '职务编码',
|
||
`position_name` varchar(50) NOT NULL COMMENT '职务名称',
|
||
`position_category` varchar(20) DEFAULT 'class' COMMENT '学生职务类别:class-班级干部,party-党团干部,other-其他',
|
||
`position_level` tinyint(1) NOT NULL DEFAULT '9' COMMENT '学生职务级别:1-班长,2-副班长,3-委员,9-普通成员',
|
||
`position_type` varchar(20) DEFAULT 'regular' COMMENT '学生职务类型:regular-常规职务,special-特殊职务,temporary-临时职务',
|
||
`responsibilities` text COMMENT '职责描述',
|
||
`status` char(1) DEFAULT '1' COMMENT '状态:0-启用,1-停用',
|
||
`sort_order` int(11) DEFAULT '0' COMMENT '排序顺序',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_deleted` (`deleted`) USING BTREE,
|
||
KEY `idx_position_level` (`position_level`) USING BTREE,
|
||
KEY `idx_position_category` (`position_category`) USING BTREE,
|
||
KEY `idx_dict_status` (`status`) USING BTREE,
|
||
KEY `idx_sort_order` (`sort_order`) USING BTREE,
|
||
KEY `idx_position_type` (`position_type`) USING BTREE,
|
||
KEY `uk_position_code_tenant` (`position_code`,`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='班级干部职务字典表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_class_pos_msg
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_class_pos_msg`;
|
||
CREATE TABLE `xg_class_pos_msg` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
|
||
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`class_id` bigint(20) NOT NULL COMMENT '班级ID,关联xg_class_msg.id',
|
||
`student_id` bigint(20) NOT NULL COMMENT '学生ID,关联xg_student_msg.id',
|
||
`student_no` varchar(32) NOT NULL COMMENT '学号',
|
||
`student_name` varchar(50) NOT NULL COMMENT '学生姓名(冗余字段)',
|
||
`position_id` bigint(20) NOT NULL COMMENT '职务编码,关联xg_class_pos_dict.id',
|
||
`position_code` varchar(20) NOT NULL COMMENT '职务编码,关联xg_class_pos_dict.position_code',
|
||
`appointment_date` date NOT NULL COMMENT '任职日期',
|
||
`term_start_date` date NOT NULL COMMENT '任期开始日期',
|
||
`term_end_date` date DEFAULT NULL COMMENT '任期结束日期',
|
||
`term_duration` int(11) DEFAULT '12' COMMENT '任期时长(月)',
|
||
`is_current` tinyint(1) DEFAULT '1' COMMENT '是否现任:0-否,1-是',
|
||
`cadre_status` char(1) DEFAULT '1' COMMENT '学生职务任职状态:1-在任,2-到期,3-辞职,4-免职,5-调任,6-休学',
|
||
`appointment_reason` varchar(200) DEFAULT NULL COMMENT '任命原因',
|
||
`appointment_method` varchar(20) DEFAULT 'appointment' COMMENT '学生职务任命方式:appointment-任命,election-选举,recommendation-推荐',
|
||
`dismissal_date` date DEFAULT NULL COMMENT '离任日期',
|
||
`dismissal_reason` varchar(200) DEFAULT NULL COMMENT '离任原因',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_deleted` (`deleted`) USING BTREE,
|
||
KEY `idx_class_id` (`class_id`) USING BTREE,
|
||
KEY `idx_student_id` (`student_id`) USING BTREE,
|
||
KEY `idx_position_code` (`position_code`) USING BTREE,
|
||
KEY `idx_cadre_status` (`cadre_status`) USING BTREE,
|
||
KEY `idx_is_current` (`is_current`) USING BTREE,
|
||
KEY `idx_appointment_date` (`appointment_date`) USING BTREE,
|
||
KEY `idx_term_dates` (`term_start_date`,`term_end_date`) USING BTREE,
|
||
KEY `idx_class_position` (`class_id`,`position_code`,`is_current`) USING BTREE,
|
||
KEY `idx_student_cadre` (`student_id`,`is_current`,`cadre_status`) USING BTREE,
|
||
KEY `uk_class_student_position` (`class_id`,`student_id`,`position_code`,`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='班级干部信息表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_class_teacher_counselor_rel
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_class_teacher_counselor_rel`;
|
||
CREATE TABLE `xg_class_teacher_counselor_rel` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
|
||
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`class_id` bigint(20) NOT NULL COMMENT '班级ID,关联xg_class_msg.id',
|
||
`class_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
|
||
`teacher_id` bigint(20) NOT NULL COMMENT '教师ID,关联sys_user.user_id',
|
||
`teacher_name` varchar(50) DEFAULT NULL COMMENT '教师姓名',
|
||
`teacher_type` varchar(20) NOT NULL COMMENT '教师类型:class_teacher-班主任,counselor-辅导员,advisor-导师',
|
||
`start_date` datetime NOT NULL COMMENT '开始日期',
|
||
`end_date` datetime DEFAULT NULL COMMENT '结束日期',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_deleted` (`deleted`) USING BTREE,
|
||
KEY `idx_class_id` (`class_id`) USING BTREE,
|
||
KEY `idx_teacher_id` (`teacher_id`) USING BTREE,
|
||
KEY `idx_teacher_type` (`teacher_type`) USING BTREE,
|
||
KEY `idx_start_date` (`start_date`) USING BTREE,
|
||
KEY `idx_end_date` (`end_date`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='班级班主任辅导员关联表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_dorm_application
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_dorm_application`;
|
||
CREATE TABLE `xg_dorm_application` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
|
||
`application_name` varchar(50) NOT NULL COMMENT '申请名称',
|
||
`application_type` char(1) NOT NULL COMMENT '申请类型(1:调宿申请 2:退宿申请)',
|
||
`application_status` char(20) DEFAULT 'waiting' COMMENT '审批状态:cancel-已撤销 , draft-草稿, waiting-待审核, finish-已完成, invalid-已作废, back-已退回, termination-已终止"',
|
||
`student_id` bigint(20) NOT NULL COMMENT '申请学生ID',
|
||
`student_no` varchar(20) NOT NULL COMMENT '学号',
|
||
`student_name` varchar(50) NOT NULL COMMENT '学生姓名',
|
||
`student_phone` varchar(20) DEFAULT NULL COMMENT '学生联系电话',
|
||
`college_id` bigint(20) NOT NULL COMMENT '学院ID',
|
||
`college_name` varchar(100) DEFAULT NULL COMMENT '学院名称',
|
||
`major_id` bigint(20) DEFAULT NULL COMMENT '专业ID',
|
||
`major_name` varchar(100) DEFAULT NULL COMMENT '专业名称',
|
||
`class_id` bigint(20) DEFAULT NULL COMMENT '班级ID',
|
||
`class_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
|
||
`current_campus_id` bigint(20) DEFAULT NULL COMMENT '当前校区ID',
|
||
`current_campus_name` varchar(100) DEFAULT NULL COMMENT '当前校区名称',
|
||
`current_building_id` bigint(20) DEFAULT NULL COMMENT '当前宿舍楼ID',
|
||
`current_building_name` varchar(100) DEFAULT NULL COMMENT '当前宿舍楼名称',
|
||
`current_room_id` bigint(20) DEFAULT NULL COMMENT '当前房间ID',
|
||
`current_room_no` varchar(20) DEFAULT NULL COMMENT '当前房间号',
|
||
`current_bed_id` bigint(20) DEFAULT NULL COMMENT '当前床位ID',
|
||
`current_bed_no` varchar(10) DEFAULT NULL COMMENT '当前床位号',
|
||
`target_campus_id` bigint(20) DEFAULT NULL COMMENT '目标校区ID',
|
||
`target_campus_name` varchar(100) DEFAULT NULL COMMENT '目标校区名称',
|
||
`target_building_id` bigint(20) DEFAULT NULL COMMENT '目标宿舍楼ID',
|
||
`target_building_name` varchar(100) DEFAULT NULL COMMENT '目标宿舍楼名称',
|
||
`target_room_id` bigint(20) DEFAULT NULL COMMENT '目标房间ID',
|
||
`target_room_no` varchar(20) DEFAULT NULL COMMENT '目标房间号',
|
||
`target_bed_id` bigint(20) DEFAULT NULL COMMENT '目标床位ID',
|
||
`target_bed_no` varchar(10) DEFAULT NULL COMMENT '目标床位号',
|
||
`reason_detail` text COMMENT '详细原因说明',
|
||
`apply_time` datetime NOT NULL COMMENT '申请时间',
|
||
`attachment_oss_ids` varchar(1000) DEFAULT NULL COMMENT '附件OSS文件ID,多个用逗号分隔',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
|
||
`ext_field1` varchar(200) DEFAULT NULL COMMENT '扩展字段1',
|
||
`ext_field2` varchar(200) DEFAULT NULL COMMENT '扩展字段2',
|
||
`ext_field3` varchar(500) DEFAULT NULL COMMENT '扩展字段3',
|
||
`deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_deleted` (`deleted`) USING BTREE,
|
||
KEY `idx_student_id` (`student_id`) USING BTREE,
|
||
KEY `idx_student_no` (`student_no`) USING BTREE,
|
||
KEY `idx_application_type` (`application_type`) USING BTREE,
|
||
KEY `idx_application_status` (`application_status`) USING BTREE,
|
||
KEY `idx_apply_time` (`apply_time`) USING BTREE,
|
||
KEY `idx_college_id` (`college_id`) USING BTREE,
|
||
KEY `idx_current_building_id` (`current_building_id`) USING BTREE,
|
||
KEY `idx_target_building_id` (`target_building_id`) USING BTREE,
|
||
KEY `idx_tenant_deleted_status` (`tenant_id`,`deleted`,`application_status`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生宿舍申请单表(调宿+退宿)';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_dorm_area
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_dorm_area`;
|
||
CREATE TABLE `xg_dorm_area` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`area_code` varchar(50) NOT NULL COMMENT '宿舍区编码',
|
||
`area_name` varchar(100) NOT NULL COMMENT '宿舍区名称',
|
||
`campus_id` bigint(20) NOT NULL COMMENT '所属校区ID',
|
||
`area_description` varchar(500) DEFAULT NULL COMMENT '宿舍区描述',
|
||
`sort_order` int(11) DEFAULT '0' COMMENT '排序号',
|
||
`deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_area_code` (`area_code`) USING BTREE,
|
||
KEY `idx_campus_id` (`campus_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍区信息表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_dorm_bed
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_dorm_bed`;
|
||
CREATE TABLE `xg_dorm_bed` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`bed_code` varchar(50) NOT NULL COMMENT '床位编号',
|
||
`bed_name` varchar(100) NOT NULL COMMENT '床位名称',
|
||
`room_id` bigint(20) NOT NULL COMMENT '所属房间ID',
|
||
`bed_type` char(1) DEFAULT '1' COMMENT '床位类型(1下铺 2上铺 3中铺 4独立床)',
|
||
`bed_status` char(1) DEFAULT '0' COMMENT '床位状态(0空闲 1已分配 2维修中)',
|
||
`deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_room_id` (`room_id`) USING BTREE,
|
||
KEY `uk_bed_code` (`bed_code`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍床位信息表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_dorm_bed_student
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_dorm_bed_student`;
|
||
CREATE TABLE `xg_dorm_bed_student` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`college_id` bigint(20) NOT NULL COMMENT '分配学院ID',
|
||
`major_id` bigint(20) DEFAULT NULL COMMENT '分配专业ID',
|
||
`class_id` bigint(20) DEFAULT NULL COMMENT '分配班级ID',
|
||
`student_id` bigint(20) DEFAULT NULL COMMENT '分配学生ID',
|
||
`bed_id` bigint(20) NOT NULL COMMENT '床位ID',
|
||
`room_id` bigint(20) NOT NULL COMMENT '房间ID',
|
||
`building_id` bigint(20) NOT NULL COMMENT '宿舍楼ID',
|
||
`area_id` bigint(20) DEFAULT NULL COMMENT '宿舍区ID',
|
||
`campus_id` bigint(20) NOT NULL COMMENT '校区ID',
|
||
`status` char(1) DEFAULT '0' COMMENT '状态(0正常 1已退宿)',
|
||
`assign_time` datetime NOT NULL COMMENT '分配时间',
|
||
`checkout_time` datetime DEFAULT NULL COMMENT '退宿时间',
|
||
`deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `uk_student_bed` (`student_id`,`bed_id`) USING BTREE,
|
||
KEY `idx_college_id` (`college_id`) USING BTREE,
|
||
KEY `idx_student_id` (`student_id`) USING BTREE,
|
||
KEY `idx_bed_id` (`bed_id`) USING BTREE,
|
||
KEY `idx_room_id` (`room_id`) USING BTREE,
|
||
KEY `idx_building_id` (`building_id`) USING BTREE,
|
||
KEY `idx_area_id` (`area_id`) USING BTREE,
|
||
KEY `idx_campus_id` (`campus_id`) USING BTREE,
|
||
KEY `idx_assign_time` (`assign_time`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='床位学生分配关系表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_dorm_building
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_dorm_building`;
|
||
CREATE TABLE `xg_dorm_building` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`building_code` varchar(50) NOT NULL COMMENT '宿舍楼编码',
|
||
`building_name` varchar(100) NOT NULL COMMENT '宿舍楼名称',
|
||
`area_id` bigint(20) DEFAULT NULL COMMENT '所属宿舍区ID',
|
||
`campus_id` bigint(20) NOT NULL COMMENT '所属校区ID',
|
||
`floors` int(11) NOT NULL DEFAULT '6' COMMENT '总楼层数',
|
||
`building_type` char(1) DEFAULT '1' COMMENT '宿舍楼类型(1男生楼 2女生楼 3混合楼)',
|
||
`building_description` varchar(500) DEFAULT NULL COMMENT '宿舍楼描述',
|
||
`sort_order` int(11) DEFAULT '0' COMMENT '排序号',
|
||
`deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_building_code` (`building_code`) USING BTREE,
|
||
KEY `idx_area_id` (`area_id`) USING BTREE,
|
||
KEY `idx_campus_id` (`campus_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍楼信息表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_dorm_campus
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_dorm_campus`;
|
||
CREATE TABLE `xg_dorm_campus` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`campus_code` varchar(50) NOT NULL COMMENT '校区编码',
|
||
`campus_name` varchar(100) NOT NULL COMMENT '校区名称',
|
||
`campus_description` varchar(500) DEFAULT NULL COMMENT '校区描述',
|
||
`sort_order` int(11) DEFAULT '0' COMMENT '排序号',
|
||
`deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_campus_code` (`campus_code`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='校区信息表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_dorm_college_bed
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_dorm_college_bed`;
|
||
CREATE TABLE `xg_dorm_college_bed` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`college_id` bigint(20) NOT NULL COMMENT '学院ID',
|
||
`bed_id` bigint(20) NOT NULL COMMENT '床位ID',
|
||
`building_id` bigint(20) NOT NULL COMMENT '宿舍楼ID',
|
||
`room_id` bigint(20) NOT NULL COMMENT '房间ID',
|
||
`status` char(1) DEFAULT '0' COMMENT '状态(0正常 1已解除)',
|
||
`assign_time` datetime DEFAULT NULL COMMENT '分配时间',
|
||
`release_time` datetime DEFAULT NULL COMMENT '到期解除时间',
|
||
`deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_college_bed` (`college_id`,`bed_id`) USING BTREE,
|
||
KEY `idx_college_id` (`college_id`) USING BTREE,
|
||
KEY `idx_bed_id` (`bed_id`) USING BTREE,
|
||
KEY `idx_building_id` (`building_id`) USING BTREE,
|
||
KEY `idx_room_id` (`room_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='二级学院床位绑定关系表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_dorm_hygiene_check
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_dorm_hygiene_check`;
|
||
CREATE TABLE `xg_dorm_hygiene_check` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`check_title` varchar(200) NOT NULL COMMENT '检查标题',
|
||
`check_date` datetime NOT NULL COMMENT '检查日期',
|
||
`checker_id` bigint(20) NOT NULL COMMENT '检查员ID,关联sys_user.id',
|
||
`checker_name` varchar(50) NOT NULL COMMENT '检查员姓名',
|
||
`check_type` char(1) DEFAULT '1' COMMENT '检查类型(1日常检查 2专项检查 3突击检查 4复查)',
|
||
`check_level` char(1) DEFAULT '1' COMMENT '检查级别(1宿管员 2学院 3学校)',
|
||
`room_id` bigint(20) NOT NULL COMMENT '宿舍房间ID,关联xg_dorm_room.id',
|
||
`room_code` varchar(50) NOT NULL COMMENT '房间编号',
|
||
`room_name` varchar(100) NOT NULL COMMENT '房间名称',
|
||
`building_id` bigint(20) NOT NULL COMMENT '宿舍楼ID,关联xg_dorm_building.id',
|
||
`building_name` varchar(100) NOT NULL COMMENT '宿舍楼名称',
|
||
`area_id` bigint(20) DEFAULT NULL COMMENT '宿舍区ID,关联xg_dorm_area.id',
|
||
`area_name` varchar(100) DEFAULT NULL COMMENT '宿舍区名称',
|
||
`campus_id` bigint(20) DEFAULT NULL COMMENT '校区ID,关联xg_dorm_campus.id',
|
||
`campus_name` varchar(100) DEFAULT NULL COMMENT '校区名称',
|
||
`total_score` decimal(5,2) DEFAULT NULL COMMENT '宿舍扣分(0-100分)',
|
||
`hygiene_grade` char(1) DEFAULT NULL COMMENT '卫生等级(A优秀 B良好 C合格 D不合格)',
|
||
`attachment_ids` text COMMENT '附件OSS ID列表,逗号分隔',
|
||
`check_summary` text COMMENT '检查总结',
|
||
`improvement_suggestions` text COMMENT '整改建议',
|
||
`check_remarks` varchar(500) DEFAULT NULL COMMENT '检查备注',
|
||
`discipline_type_id` bigint(20) DEFAULT NULL COMMENT '违纪类型ID,关联xskh_discipline_type.id',
|
||
`discipline_type_name` varchar(255) DEFAULT NULL COMMENT '违纪类型名称',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_deleted` (`deleted`) USING BTREE,
|
||
KEY `idx_check_date` (`check_date`) USING BTREE,
|
||
KEY `idx_checker_id` (`checker_id`) USING BTREE,
|
||
KEY `idx_room_id` (`room_id`) USING BTREE,
|
||
KEY `idx_building_id` (`building_id`) USING BTREE,
|
||
KEY `idx_area_id` (`area_id`) USING BTREE,
|
||
KEY `idx_campus_id` (`campus_id`) USING BTREE,
|
||
KEY `idx_hygiene_grade` (`hygiene_grade`) USING BTREE,
|
||
KEY `idx_check_type` (`check_type`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||
KEY `idx_tenant_deleted` (`tenant_id`,`deleted`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍卫生检查表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_dorm_hygiene_student_score
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_dorm_hygiene_student_score`;
|
||
CREATE TABLE `xg_dorm_hygiene_student_score` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`hygiene_check_id` bigint(20) NOT NULL COMMENT '卫生检查ID,关联xg_dorm_hygiene_check.id',
|
||
`student_id` bigint(20) NOT NULL COMMENT '学生ID,关联xg_student_msg.id',
|
||
`student_no` varchar(32) NOT NULL COMMENT '学号',
|
||
`student_name` varchar(50) NOT NULL COMMENT '学生姓名',
|
||
`class_id` bigint(20) DEFAULT NULL COMMENT '班级ID',
|
||
`class_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
|
||
`major_id` bigint(20) DEFAULT NULL COMMENT '专业ID',
|
||
`major_name` varchar(100) DEFAULT NULL COMMENT '专业名称',
|
||
`college_id` bigint(20) DEFAULT NULL COMMENT '学院ID',
|
||
`college_name` varchar(100) DEFAULT NULL COMMENT '学院名称',
|
||
`bed_id` bigint(20) DEFAULT NULL COMMENT '床位ID,关联xg_dorm_bed.id',
|
||
`bed_code` varchar(50) DEFAULT NULL COMMENT '床位编号',
|
||
`student_score` decimal(5,2) DEFAULT NULL COMMENT '学生个人扣分(0-100分)',
|
||
`attendance_status` char(1) DEFAULT '1' COMMENT '出勤状态(1在寝 2外出 3请假 4其他)',
|
||
`student_grade` char(1) DEFAULT NULL COMMENT '学生评级(A优秀 B良好 C合格 D不合格)',
|
||
`is_responsible_person` tinyint(1) DEFAULT '0' COMMENT '是否为寝室长(0否 1是)',
|
||
`score_remarks` varchar(500) DEFAULT NULL COMMENT '评分备注',
|
||
`improvement_notes` varchar(500) DEFAULT NULL COMMENT '改进意见',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_deleted` (`deleted`) USING BTREE,
|
||
KEY `idx_hygiene_check_id` (`hygiene_check_id`) USING BTREE,
|
||
KEY `idx_student_id` (`student_id`) USING BTREE,
|
||
KEY `idx_student_no` (`student_no`) USING BTREE,
|
||
KEY `idx_class_id` (`class_id`) USING BTREE,
|
||
KEY `idx_major_id` (`major_id`) USING BTREE,
|
||
KEY `idx_college_id` (`college_id`) USING BTREE,
|
||
KEY `idx_bed_id` (`bed_id`) USING BTREE,
|
||
KEY `idx_attendance_status` (`attendance_status`) USING BTREE,
|
||
KEY `idx_student_grade` (`student_grade`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||
KEY `idx_tenant_deleted` (`tenant_id`,`deleted`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍卫生检查学生评分表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_dorm_manager
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_dorm_manager`;
|
||
CREATE TABLE `xg_dorm_manager` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`manager_name` varchar(100) NOT NULL COMMENT '管理员姓名',
|
||
`manager_type` char(1) NOT NULL COMMENT '管理员类型(1全校管理员 2校区管理员 3宿舍区管理员 4宿舍楼管理员)',
|
||
`manager_level` int(11) DEFAULT '1' COMMENT '管理级别(1-5,1为最高)',
|
||
`user_id` bigint(20) DEFAULT NULL COMMENT '关联用户ID',
|
||
`phone` varchar(20) DEFAULT NULL COMMENT '联系电话',
|
||
`gender` char(1) DEFAULT '0' COMMENT '性别(0男 1女 2未知)',
|
||
`status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
|
||
`deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_user_id` (`user_id`) USING BTREE,
|
||
KEY `idx_manager_type` (`manager_type`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍管理员信息表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_dorm_manager_source
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_dorm_manager_source`;
|
||
CREATE TABLE `xg_dorm_manager_source` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`manager_id` bigint(20) NOT NULL COMMENT '管理员ID',
|
||
`permission_type` char(1) DEFAULT '1' COMMENT '权限类型(1查看 2编辑 3完全管理)',
|
||
`auth_type` char(1) NOT NULL COMMENT '授权类型(1全校级 2校区级 3宿舍区级 4楼栋级)',
|
||
`auth_source` bigint(20) DEFAULT NULL COMMENT '授权来源ID(对应校区ID或宿舍区ID或楼栋ID)',
|
||
`status` char(1) DEFAULT '0' COMMENT '状态(0有效 1已撤销)',
|
||
`deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_manager_id` (`manager_id`) USING BTREE,
|
||
KEY `idx_auth_source` (`auth_source`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员授权关系表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_dorm_room
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_dorm_room`;
|
||
CREATE TABLE `xg_dorm_room` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`room_code` varchar(50) NOT NULL COMMENT '房间编号',
|
||
`room_name` varchar(100) NOT NULL COMMENT '房间名称',
|
||
`building_id` bigint(20) NOT NULL COMMENT '所属宿舍楼ID',
|
||
`floor_num` int(11) NOT NULL COMMENT '楼层',
|
||
`room_type` char(1) DEFAULT '1' COMMENT '房间类型(1标准间 2 单人间 3 套间)',
|
||
`actual_beds` int(11) DEFAULT '4' COMMENT '实际床位数',
|
||
`room_area` decimal(10,2) DEFAULT NULL COMMENT '房间面积(平方米)',
|
||
`room_status` char(1) DEFAULT '0' COMMENT '房间状态(0可用 1维修中 2停用)',
|
||
`sort` int(11) DEFAULT '0' COMMENT '排序号',
|
||
`deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_building_id` (`building_id`) USING BTREE,
|
||
KEY `idx_floor_num` (`floor_num`) USING BTREE,
|
||
KEY `uk_room_code` (`room_code`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍房间信息表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_dorm_violation
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_dorm_violation`;
|
||
CREATE TABLE `xg_dorm_violation` (
|
||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '违纪记录ID(主键)',
|
||
`student_id` bigint(20) NOT NULL COMMENT '学生ID',
|
||
`student_name` varchar(100) NOT NULL COMMENT '学生姓名',
|
||
`student_no` varchar(50) NOT NULL COMMENT '学号',
|
||
`college_id` bigint(20) DEFAULT NULL COMMENT '学院ID',
|
||
`college_name` varchar(100) DEFAULT NULL COMMENT '学院名称',
|
||
`major_id` bigint(20) DEFAULT NULL COMMENT '专业ID',
|
||
`major_name` varchar(100) DEFAULT NULL COMMENT '专业名称',
|
||
`class_id` bigint(20) DEFAULT NULL COMMENT '班级ID',
|
||
`class_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
|
||
`campus_id` bigint(20) DEFAULT NULL COMMENT '校区ID',
|
||
`campus_name` varchar(100) DEFAULT NULL COMMENT '校区名称',
|
||
`area_id` bigint(20) DEFAULT NULL COMMENT '宿舍区域ID',
|
||
`area_name` varchar(100) DEFAULT NULL COMMENT '宿舍区域名称',
|
||
`building_id` bigint(20) NOT NULL COMMENT '宿舍楼ID',
|
||
`building_name` varchar(100) NOT NULL COMMENT '宿舍楼名称',
|
||
`room_id` bigint(20) NOT NULL COMMENT '宿舍房间ID',
|
||
`room_name` varchar(50) NOT NULL COMMENT '房间名称',
|
||
`bed_id` bigint(20) DEFAULT NULL COMMENT '床位ID',
|
||
`bed_name` varchar(20) DEFAULT NULL COMMENT '床位名称',
|
||
`violation_type` varchar(50) NOT NULL COMMENT '违纪类型',
|
||
`violation_level` char(1) NOT NULL COMMENT '违纪等级:1轻微 2一般 3严重 4特别严重',
|
||
`violation_time` datetime NOT NULL COMMENT '违纪发生时间',
|
||
`violation_description` text NOT NULL COMMENT '违纪行为描述',
|
||
`involved_students` text COMMENT '涉及其他学生信息(JSON格式)',
|
||
`attachment_oss_ids` text COMMENT '附件OSS ID列表(逗号分隔)',
|
||
`deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_student_id` (`student_id`) USING BTREE,
|
||
KEY `idx_student_no` (`student_no`) USING BTREE,
|
||
KEY `idx_college_id` (`college_id`) USING BTREE,
|
||
KEY `idx_building_id` (`building_id`) USING BTREE,
|
||
KEY `idx_room_id` (`room_id`) USING BTREE,
|
||
KEY `idx_violation_type` (`violation_type`) USING BTREE,
|
||
KEY `idx_violation_time` (`violation_time`) USING BTREE,
|
||
KEY `idx_violation_level` (`violation_level`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_deleted` (`deleted`) USING BTREE,
|
||
KEY `idx_college_time` (`college_id`,`violation_time`) USING BTREE,
|
||
KEY `idx_building_level` (`building_id`,`violation_level`) USING BTREE,
|
||
KEY `idx_student_time` (`student_id`,`violation_time`) USING BTREE,
|
||
KEY `idx_type_level` (`violation_type`,`violation_level`) USING BTREE
|
||
) ENGINE=InnoDB AUTO_INCREMENT=1958884987826626562 DEFAULT CHARSET=utf8mb4 COMMENT='宿舍违纪记录表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_holiday_stay
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_holiday_stay`;
|
||
CREATE TABLE `xg_holiday_stay` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`student_id` bigint(20) NOT NULL COMMENT '学生ID,关联xg_student_msg.id',
|
||
`student_name` varchar(50) NOT NULL COMMENT '学生姓名',
|
||
`student_no` varchar(20) NOT NULL COMMENT '学号',
|
||
`class_id` bigint(20) DEFAULT NULL COMMENT '班级ID',
|
||
`class_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
|
||
`major_id` bigint(20) DEFAULT NULL COMMENT '专业ID',
|
||
`major_name` varchar(100) DEFAULT NULL COMMENT '专业名称',
|
||
`college_id` bigint(20) DEFAULT NULL COMMENT '学院ID',
|
||
`college_name` varchar(100) DEFAULT NULL COMMENT '学院名称',
|
||
`campus_id` bigint(20) DEFAULT NULL COMMENT '校区ID,关联xg_dorm_campus.id',
|
||
`campus_name` varchar(100) DEFAULT NULL COMMENT '校区名称',
|
||
`area_id` bigint(20) DEFAULT NULL COMMENT '宿舍区ID,关联xg_dorm_area.id',
|
||
`area_name` varchar(100) DEFAULT NULL COMMENT '宿舍区名称',
|
||
`building_id` bigint(20) DEFAULT NULL COMMENT '宿舍楼ID,关联xg_dorm_building.id',
|
||
`building_name` varchar(100) DEFAULT NULL COMMENT '宿舍楼名称',
|
||
`room_id` bigint(20) DEFAULT NULL COMMENT '房间ID,关联xg_dorm_room.id',
|
||
`room_name` varchar(100) DEFAULT NULL COMMENT '房间名称',
|
||
`bed_id` bigint(20) DEFAULT NULL COMMENT '床位ID,关联xg_dorm_bed.id',
|
||
`bed_name` varchar(100) DEFAULT NULL COMMENT '床位名称',
|
||
`holiday_type` varchar(50) NOT NULL COMMENT '假期类型(寒假、暑假、春节假期、国庆假期等)',
|
||
`apply_start_date` datetime NOT NULL COMMENT '申请留宿开始日期',
|
||
`apply_end_date` datetime NOT NULL COMMENT '申请留宿结束日期',
|
||
`stay_reason` text NOT NULL COMMENT '留宿原因(必填)',
|
||
`stay_reason_type` varchar(20) DEFAULT NULL COMMENT '留宿原因类型(学习、实习、家庭困难、其他)',
|
||
`student_phone` varchar(20) NOT NULL COMMENT '学生联系电话',
|
||
`emergency_contact` varchar(50) NOT NULL COMMENT '紧急联系人姓名',
|
||
`emergency_phone` varchar(20) NOT NULL COMMENT '紧急联系人电话',
|
||
`parent_consent` char(1) NOT NULL DEFAULT '1' COMMENT '家长同意(0否 1是)',
|
||
`attachment_oss_ids` varchar(1000) DEFAULT NULL COMMENT '附件OSS文件ID,多个用逗号分隔(申请材料、证明文件等)',
|
||
`ext_field1` varchar(200) DEFAULT NULL COMMENT '扩展字段1',
|
||
`ext_field2` varchar(200) DEFAULT NULL COMMENT '扩展字段2',
|
||
`ext_field3` varchar(500) DEFAULT NULL COMMENT '扩展字段3',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_deleted` (`deleted`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||
KEY `idx_tenant_deleted` (`tenant_id`,`deleted`) USING BTREE,
|
||
KEY `idx_student_id` (`student_id`) USING BTREE,
|
||
KEY `idx_student_no` (`student_no`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='假期留宿管理表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_hygiene_check_violation
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_hygiene_check_violation`;
|
||
CREATE TABLE `xg_hygiene_check_violation` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
|
||
`hygiene_check_id` bigint(20) NOT NULL COMMENT '宿舍卫生检查ID,关联xg_dorm_hygiene_check.id',
|
||
`discipline_record_id` bigint(20) NOT NULL COMMENT '违纪记录ID,关联xskh_discipline_record.id',
|
||
`student_id` bigint(20) NOT NULL COMMENT '学生ID,关联xg_student_msg.id',
|
||
`student_no` varchar(20) NOT NULL COMMENT '学号',
|
||
`student_name` varchar(50) NOT NULL COMMENT '学生姓名',
|
||
`discipline_type_id` bigint(20) NOT NULL COMMENT '违纪类型ID,关联xskh_discipline_type.id',
|
||
`discipline_type_name` varchar(100) NOT NULL COMMENT '违纪类型名称',
|
||
`violation_source` char(1) DEFAULT '1' COMMENT '违纪来源(1宿舍卫生检查 2其他)',
|
||
`status` char(1) DEFAULT '1' COMMENT '状态(1生效 2已撤销)',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0-未删除 1-已删除)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_hygiene_check_id` (`hygiene_check_id`) USING BTREE,
|
||
KEY `idx_discipline_record_id` (`discipline_record_id`) USING BTREE,
|
||
KEY `idx_student_id` (`student_id`) USING BTREE,
|
||
KEY `idx_student_no` (`student_no`) USING BTREE,
|
||
KEY `idx_discipline_type_id` (`discipline_type_id`) USING BTREE,
|
||
KEY `idx_violation_source` (`violation_source`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_deleted` (`deleted`) USING BTREE,
|
||
KEY `idx_tenant_deleted` (`tenant_id`,`deleted`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='宿舍卫生检查违纪关联表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_leave_type_config
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_leave_type_config`;
|
||
CREATE TABLE `xg_leave_type_config` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
|
||
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`leave_type_name` varchar(50) NOT NULL COMMENT '请假类型名称',
|
||
`leave_type_code` varchar(20) NOT NULL COMMENT '请假类型编码',
|
||
`leave_type_desc` varchar(500) DEFAULT NULL COMMENT '请假类型描述',
|
||
`sort_order` int(4) DEFAULT '0' COMMENT '排序号',
|
||
`need_location_on_apply` char(1) NOT NULL DEFAULT '0' COMMENT '请假是否需要上传地理位置:0-否,1-是',
|
||
`need_photo_on_cancel` char(1) NOT NULL DEFAULT '0' COMMENT '销假是否必须上传照片:0-否,1-是',
|
||
`need_location_on_cancel` char(1) NOT NULL DEFAULT '0' COMMENT '销假是否需要上传地理位置:0-否,1-是',
|
||
`need_cancel_for_non_leave` char(1) NOT NULL DEFAULT '0' COMMENT '非离校请假是否需要销假:0-否,1-是',
|
||
`can_apply_in_advance` char(1) NOT NULL DEFAULT '0' COMMENT '是否可以提前请假:0-否,1-是',
|
||
`is_enabled` char(1) NOT NULL DEFAULT '1' COMMENT '是否开启:0-关闭,1-开启',
|
||
`max_apply_duration` decimal(5,2) DEFAULT NULL COMMENT '请假最大申请时长(天)',
|
||
`cancel_overdue_reminder` decimal(5,2) DEFAULT NULL COMMENT '销假逾期多少时长给予提醒(天)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
UNIQUE KEY `uk_leave_type_code` (`leave_type_code`,`tenant_id`) USING BTREE COMMENT '请假类型编码唯一索引',
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE COMMENT '租户索引',
|
||
KEY `idx_is_enabled` (`is_enabled`) USING BTREE COMMENT '启用状态索引',
|
||
KEY `idx_sort_order` (`sort_order`) USING BTREE COMMENT '排序索引'
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生请假类型配置表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_stu_col_batch
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_stu_col_batch`;
|
||
CREATE TABLE `xg_stu_col_batch` (
|
||
`id` bigint(20) NOT NULL COMMENT '批次ID',
|
||
`batch_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '批次名称',
|
||
`description` text COLLATE utf8mb4_unicode_ci COMMENT '批次描述',
|
||
`start_time` datetime NOT NULL COMMENT '开始时间',
|
||
`end_time` datetime NOT NULL COMMENT '结束时间',
|
||
`status` char(1) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '状态(0正常 1停用)',
|
||
`collection_type` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '收集类型 1 - 新学期收集 2 - 其他',
|
||
`remark` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
|
||
`tenant_id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_status` (`status`) USING BTREE,
|
||
KEY `idx_start_time` (`start_time`) USING BTREE,
|
||
KEY `idx_end_time` (`end_time`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='学生信息收集批次表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_stu_col_batch_class
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_stu_col_batch_class`;
|
||
CREATE TABLE `xg_stu_col_batch_class` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`batch_id` bigint(20) NOT NULL COMMENT '批次ID',
|
||
`class_id` bigint(20) NOT NULL COMMENT '班级ID',
|
||
`class_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '班级名称',
|
||
`major_id` bigint(20) DEFAULT NULL COMMENT '专业ID',
|
||
`major_name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '专业名称',
|
||
`college_id` bigint(20) DEFAULT NULL COMMENT '院系ID',
|
||
`college_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '院系名称',
|
||
`remark` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
|
||
`tenant_id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_batch_id` (`batch_id`) USING BTREE,
|
||
KEY `idx_class_id` (`class_id`) USING BTREE,
|
||
KEY `idx_grade_id` (`major_id`) USING BTREE,
|
||
KEY `idx_department_id` (`college_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='学生信息收集批次班级权限表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_student_cancel_leave
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_student_cancel_leave`;
|
||
CREATE TABLE `xg_student_cancel_leave` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
|
||
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`student_id` bigint(20) NOT NULL COMMENT '学生ID',
|
||
`student_name` varchar(50) NOT NULL COMMENT '学生姓名',
|
||
`student_no` varchar(20) NOT NULL COMMENT '学号',
|
||
`class_id` bigint(20) DEFAULT NULL COMMENT '班级ID',
|
||
`class_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
|
||
`major_id` bigint(20) DEFAULT NULL COMMENT '专业ID',
|
||
`major_name` varchar(100) DEFAULT NULL COMMENT '专业名称',
|
||
`college_id` bigint(20) DEFAULT NULL COMMENT '学院ID',
|
||
`college_name` varchar(100) DEFAULT NULL COMMENT '学院名称',
|
||
`leave_type_code` varchar(20) NOT NULL COMMENT '请假类型编码',
|
||
`leave_type_name` varchar(50) NOT NULL COMMENT '请假类型名称',
|
||
`start_time` datetime NOT NULL COMMENT '开始时间(年月日时分秒)',
|
||
`end_time` datetime NOT NULL COMMENT '结束时间(年月日时分秒)',
|
||
`leave_duration` decimal(5,2) NOT NULL COMMENT '请假时长(天)',
|
||
`is_leave_school` char(1) NOT NULL DEFAULT '0' COMMENT '是否离校:0-否,1-是',
|
||
`need_cancel` char(1) NOT NULL DEFAULT '1' COMMENT '是否需要销假:0-否,1-是',
|
||
`emergency_contact` varchar(50) DEFAULT NULL COMMENT '紧急联系人',
|
||
`emergency_phone` varchar(20) DEFAULT NULL COMMENT '紧急联系电话',
|
||
`leave_reason` text NOT NULL COMMENT '请假原因',
|
||
`leave_location` varchar(500) DEFAULT NULL COMMENT '请假时地理位置',
|
||
`attachment_oss_ids` text COMMENT '附件OSS文件ID(逗号分隔)',
|
||
`approval_status` char(100) NOT NULL DEFAULT '0' COMMENT '审批状态:"cancel", "已撤销" "draft", "草稿" "waiting", "待审核" "finish", "已完成" "invalid", "已作废" "back", "已退回" "termination", "已终止"',
|
||
`approval_opinion` varchar(500) DEFAULT NULL COMMENT '审批意见',
|
||
`approval_time` datetime DEFAULT NULL COMMENT '审批时间',
|
||
`approval_by` bigint(20) DEFAULT NULL COMMENT '审批人ID',
|
||
`approval_by_name` varchar(50) DEFAULT NULL COMMENT '审批人姓名',
|
||
`cancel_status` char(100) DEFAULT '0' COMMENT '销假状态:0-未销假,1-已销假,2-逾期未销假 3 - 无需销假 "cancel", "已撤销" "draft", "草稿" "waiting", "待审核" "finish", "已完成" "invalid", "已作废" "back", "已退回" "termination", "已终止"',
|
||
`cancel_time` datetime DEFAULT NULL COMMENT '销假时间',
|
||
`cancel_location` varchar(500) DEFAULT NULL COMMENT '销假地理位置',
|
||
`cancel_photo_oss_ids` text COMMENT '销假照片OSS文件ID(逗号分隔)',
|
||
`cancel_remark` varchar(500) DEFAULT NULL COMMENT '销假备注',
|
||
`leave_id` bigint(20) NOT NULL COMMENT '学生请假表id',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE COMMENT '租户索引',
|
||
KEY `idx_student_id` (`student_id`) USING BTREE COMMENT '学生索引',
|
||
KEY `idx_student_no` (`student_no`) USING BTREE COMMENT '学号索引',
|
||
KEY `idx_class_id` (`class_id`) USING BTREE COMMENT '班级索引',
|
||
KEY `idx_college_id` (`college_id`) USING BTREE COMMENT '学院索引',
|
||
KEY `idx_leave_type_code` (`leave_type_code`) USING BTREE COMMENT '请假类型索引',
|
||
KEY `idx_start_time` (`start_time`) USING BTREE COMMENT '开始时间索引',
|
||
KEY `idx_end_time` (`end_time`) USING BTREE COMMENT '结束时间索引',
|
||
KEY `idx_approval_status` (`approval_status`) USING BTREE COMMENT '审批状态索引',
|
||
KEY `idx_cancel_status` (`cancel_status`) USING BTREE COMMENT '销假状态索引',
|
||
KEY `idx_create_time` (`create_time`) USING BTREE COMMENT '创建时间索引',
|
||
KEY `idx_is_leave_school` (`is_leave_school`) USING BTREE COMMENT '离校状态索引',
|
||
KEY `idx_need_cancel` (`need_cancel`) USING BTREE COMMENT '是否需要销假索引',
|
||
KEY `idx_student_time_range` (`student_id`,`start_time`,`end_time`) USING BTREE,
|
||
KEY `idx_class_approval_status` (`class_id`,`approval_status`) USING BTREE,
|
||
KEY `idx_college_leave_type` (`college_id`,`leave_type_code`) USING BTREE,
|
||
KEY `idx_time_approval_status` (`start_time`,`end_time`,`approval_status`) USING BTREE,
|
||
KEY `idx_need_cancel_status` (`need_cancel`,`cancel_status`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生销假表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_student_leave
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_student_leave`;
|
||
CREATE TABLE `xg_student_leave` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
|
||
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`student_id` bigint(20) NOT NULL COMMENT '学生ID',
|
||
`student_name` varchar(50) NOT NULL COMMENT '学生姓名',
|
||
`student_no` varchar(20) NOT NULL COMMENT '学号',
|
||
`class_id` bigint(20) DEFAULT NULL COMMENT '班级ID',
|
||
`class_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
|
||
`major_id` bigint(20) DEFAULT NULL COMMENT '专业ID',
|
||
`major_name` varchar(100) DEFAULT NULL COMMENT '专业名称',
|
||
`college_id` bigint(20) DEFAULT NULL COMMENT '学院ID',
|
||
`college_name` varchar(100) DEFAULT NULL COMMENT '学院名称',
|
||
`leave_type_code` varchar(20) NOT NULL COMMENT '请假类型编码',
|
||
`leave_type_name` varchar(50) NOT NULL COMMENT '请假类型名称',
|
||
`start_time` datetime NOT NULL COMMENT '开始时间(年月日时分秒)',
|
||
`end_time` datetime NOT NULL COMMENT '结束时间(年月日时分秒)',
|
||
`leave_duration` decimal(5,2) NOT NULL COMMENT '请假时长(天)',
|
||
`is_leave_school` char(1) NOT NULL DEFAULT '0' COMMENT '是否离校:0-否,1-是',
|
||
`need_cancel` char(1) NOT NULL DEFAULT '1' COMMENT '是否需要销假:0-否,1-是',
|
||
`emergency_contact` varchar(50) DEFAULT NULL COMMENT '紧急联系人',
|
||
`emergency_phone` varchar(20) DEFAULT NULL COMMENT '紧急联系电话',
|
||
`leave_reason` text NOT NULL COMMENT '请假原因',
|
||
`leave_location` varchar(500) DEFAULT NULL COMMENT '请假时地理位置',
|
||
`attachment_oss_ids` text COMMENT '附件OSS文件ID(逗号分隔)',
|
||
`approval_status` char(100) NOT NULL DEFAULT '0' COMMENT '审批状态:"cancel", "已撤销" "draft", "草稿" "waiting", "待审核" "finish", "已完成" "invalid", "已作废" "back", "已退回" "termination", "已终止"',
|
||
`approval_opinion` varchar(500) DEFAULT NULL COMMENT '审批意见',
|
||
`approval_time` datetime DEFAULT NULL COMMENT '审批时间',
|
||
`approval_by` bigint(20) DEFAULT NULL COMMENT '审批人ID',
|
||
`approval_by_name` varchar(50) DEFAULT NULL COMMENT '审批人姓名',
|
||
`cancel_status` char(100) DEFAULT '0' COMMENT '销假状态:0-未销假,1-已销假,2-逾期未销假 3 - 无需销假 "cancel", "已撤销" "draft", "草稿" "waiting", "待审核" "finish", "已完成" "invalid", "已作废" "back", "已退回" "termination", "已终止"',
|
||
`cancel_time` datetime DEFAULT NULL COMMENT '销假时间',
|
||
`cancel_location` varchar(500) DEFAULT NULL COMMENT '销假地理位置',
|
||
`cancel_photo_oss_ids` text COMMENT '销假照片OSS文件ID(逗号分隔)',
|
||
`cancel_remark` varchar(500) DEFAULT NULL COMMENT '销假备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE COMMENT '租户索引',
|
||
KEY `idx_student_id` (`student_id`) USING BTREE COMMENT '学生索引',
|
||
KEY `idx_student_no` (`student_no`) USING BTREE COMMENT '学号索引',
|
||
KEY `idx_class_id` (`class_id`) USING BTREE COMMENT '班级索引',
|
||
KEY `idx_college_id` (`college_id`) USING BTREE COMMENT '学院索引',
|
||
KEY `idx_leave_type_code` (`leave_type_code`) USING BTREE COMMENT '请假类型索引',
|
||
KEY `idx_start_time` (`start_time`) USING BTREE COMMENT '开始时间索引',
|
||
KEY `idx_end_time` (`end_time`) USING BTREE COMMENT '结束时间索引',
|
||
KEY `idx_approval_status` (`approval_status`) USING BTREE COMMENT '审批状态索引',
|
||
KEY `idx_cancel_status` (`cancel_status`) USING BTREE COMMENT '销假状态索引',
|
||
KEY `idx_create_time` (`create_time`) USING BTREE COMMENT '创建时间索引',
|
||
KEY `idx_is_leave_school` (`is_leave_school`) USING BTREE COMMENT '离校状态索引',
|
||
KEY `idx_need_cancel` (`need_cancel`) USING BTREE COMMENT '是否需要销假索引',
|
||
KEY `idx_student_time_range` (`student_id`,`start_time`,`end_time`) USING BTREE,
|
||
KEY `idx_class_approval_status` (`class_id`,`approval_status`) USING BTREE,
|
||
KEY `idx_college_leave_type` (`college_id`,`leave_type_code`) USING BTREE,
|
||
KEY `idx_time_approval_status` (`start_time`,`end_time`,`approval_status`) USING BTREE,
|
||
KEY `idx_need_cancel_status` (`need_cancel`,`cancel_status`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生请假表 - 记录学生的请假申请、审批和销假信息';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_student_manager
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_student_manager`;
|
||
CREATE TABLE `xg_student_manager` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`manager_name` varchar(100) NOT NULL COMMENT '管理员姓名',
|
||
`manager_type` char(1) NOT NULL COMMENT '管理员类型(1 全校管理员 2 自定义管理员 3 班主任)',
|
||
`manager_level` int(11) DEFAULT '1' COMMENT '管理级别(1-3,1为最高)',
|
||
`user_id` bigint(20) DEFAULT NULL COMMENT '关联用户ID',
|
||
`phone` varchar(20) DEFAULT NULL COMMENT '联系电话',
|
||
`gender` char(1) DEFAULT '0' COMMENT '性别(0男 1女 2未知)',
|
||
`status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
|
||
`deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_user_id` (`user_id`) USING BTREE,
|
||
KEY `idx_manager_type` (`manager_type`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生管理员信息表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_student_manager_source
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_student_manager_source`;
|
||
CREATE TABLE `xg_student_manager_source` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||
`manager_id` bigint(20) NOT NULL COMMENT '管理员ID',
|
||
`permission_type` char(1) DEFAULT '1' COMMENT '权限类型(1查看 2编辑 3完全管理)',
|
||
`auth_type` char(1) NOT NULL COMMENT '授权类型(1全校级 2自定义 3班主任)',
|
||
`auth_source` bigint(20) DEFAULT NULL COMMENT '授权来源ID(对应班级id)',
|
||
`status` char(1) DEFAULT '0' COMMENT '状态(0有效 1已撤销)',
|
||
`deleted` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_manager_id` (`manager_id`) USING BTREE,
|
||
KEY `idx_auth_source` (`auth_source`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生管理员授权关系表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_student_msg
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_student_msg`;
|
||
CREATE TABLE `xg_student_msg` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
|
||
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`student_no` varchar(32) NOT NULL COMMENT '学号',
|
||
`id_card` varchar(18) DEFAULT NULL COMMENT '身份证号',
|
||
`name` varchar(50) NOT NULL COMMENT '姓名',
|
||
`name_english` varchar(100) DEFAULT NULL COMMENT '英文姓名',
|
||
`former_name` varchar(50) DEFAULT NULL COMMENT '曾用名',
|
||
`gender` char(1) NOT NULL COMMENT '性别:0-男,1-女',
|
||
`birth_date` date DEFAULT NULL COMMENT '出生日期',
|
||
`nationality` varchar(20) DEFAULT NULL COMMENT '民族 ',
|
||
`native_place` varchar(20) DEFAULT NULL COMMENT '籍贯',
|
||
`political_status` varchar(20) DEFAULT NULL COMMENT '政治面貌',
|
||
`hukou_location` varchar(1000) DEFAULT NULL COMMENT '户籍所在地',
|
||
`home_address` varchar(1000) DEFAULT NULL COMMENT '家庭地址',
|
||
`current_address` varchar(1000) DEFAULT NULL COMMENT '现住址',
|
||
`postal_code` varchar(10) DEFAULT NULL COMMENT '邮政编码',
|
||
`photo_url` varchar(500) DEFAULT NULL COMMENT '照片URL',
|
||
`photo_path` varchar(500) DEFAULT NULL COMMENT '学生照片存储路径',
|
||
`phone` varchar(20) DEFAULT NULL COMMENT '手机号码',
|
||
`is_boarder` tinyint(1) DEFAULT '0' COMMENT '是否住校:0-否,1-是',
|
||
`education_level` varchar(20) DEFAULT NULL COMMENT '文化程度',
|
||
`household_register_type` varchar(20) DEFAULT NULL COMMENT '户口类型:农业、非农业',
|
||
`religion` varchar(200) DEFAULT NULL COMMENT '宗教信仰',
|
||
`source_region` varchar(100) DEFAULT NULL COMMENT '生源地区(省市县)',
|
||
`graduate_school` varchar(100) DEFAULT NULL COMMENT '毕业院校',
|
||
`email` varchar(100) DEFAULT NULL COMMENT '电子邮箱',
|
||
`qq` varchar(20) DEFAULT NULL COMMENT 'QQ号码',
|
||
`wechat` varchar(50) DEFAULT NULL COMMENT '微信号',
|
||
`marital_status` varchar(10) DEFAULT NULL COMMENT '婚姻状况:1 未婚、2 已婚、3 离异、4 丧偶 ',
|
||
`emergency_contact_name` varchar(50) DEFAULT NULL COMMENT '紧急联系人姓名',
|
||
`emergency_contact_phone` varchar(20) DEFAULT NULL COMMENT '紧急联系人电话',
|
||
`emergency_contact_relation` varchar(100) DEFAULT NULL COMMENT '紧急联系人关系',
|
||
`is_poor_student` tinyint(1) DEFAULT '0' COMMENT '是否贫困生:0-否,1-是',
|
||
`is_minority` tinyint(1) DEFAULT '0' COMMENT '是否少数民族:0-否,1-是',
|
||
`is_disabled` tinyint(1) DEFAULT '0' COMMENT '是否残疾:0-否,1-是',
|
||
`is_orphan` tinyint(1) DEFAULT '0' COMMENT '是否孤儿:0-否,1-是',
|
||
`is_left_behind_child` tinyint(1) DEFAULT '0' COMMENT '是否留守儿童:0-否,1-是',
|
||
`is_single_child` tinyint(1) DEFAULT '0' COMMENT '是否独生子女:0-否,1-是',
|
||
`is_low_income` tinyint(1) DEFAULT '0' COMMENT '是否低保:0-否,1-是',
|
||
`has_loan` tinyint(1) DEFAULT '0' COMMENT '是否有助学贷款:0-否,1-是',
|
||
`loan_amount` decimal(10,2) DEFAULT NULL COMMENT '助学贷款金额',
|
||
`specialties` text COMMENT '特长爱好',
|
||
`awards` text COMMENT '获奖情况',
|
||
`violations` text COMMENT '违纪记录',
|
||
`social_activities` text COMMENT '社会活动',
|
||
`father_name` varchar(50) DEFAULT NULL COMMENT '父亲姓名',
|
||
`father_phone` varchar(20) DEFAULT NULL COMMENT '父亲电话',
|
||
`father_work_unit` varchar(1000) DEFAULT NULL COMMENT '父亲工作单位',
|
||
`mother_name` varchar(50) DEFAULT NULL COMMENT '母亲姓名',
|
||
`mother_phone` varchar(20) DEFAULT NULL COMMENT '母亲电话',
|
||
`mother_work_unit` varchar(1000) DEFAULT NULL COMMENT '母亲工作单位',
|
||
`guardian_name` varchar(50) DEFAULT NULL COMMENT '监护人姓名',
|
||
`guardian_phone` varchar(20) DEFAULT NULL COMMENT '监护人电话',
|
||
`guardian_relation` varchar(20) DEFAULT NULL COMMENT '监护人关系',
|
||
`family_income` decimal(12,2) DEFAULT NULL COMMENT '家庭年收入',
|
||
`per_capita_income` decimal(12,2) DEFAULT NULL COMMENT '人均收入',
|
||
`income_source` varchar(100) DEFAULT NULL COMMENT '收入来源',
|
||
`family_economic_status` varchar(20) DEFAULT NULL COMMENT '家庭经济状况:富裕、一般、困难、特困',
|
||
`family_members` tinyint(2) DEFAULT NULL COMMENT '家庭成员数量',
|
||
`height` decimal(10,2) DEFAULT NULL COMMENT '身高(cm)',
|
||
`weight` decimal(10,2) DEFAULT NULL COMMENT '体重(kg)',
|
||
`blood_type` varchar(10) DEFAULT NULL COMMENT '血型',
|
||
`health_status` varchar(1000) DEFAULT NULL COMMENT '健康状况',
|
||
`special_condition` varchar(1000) DEFAULT NULL COMMENT '特殊体质或疾病',
|
||
`medical_history` varchar(1000) DEFAULT NULL COMMENT '病史',
|
||
`allergies` varchar(1000) DEFAULT NULL COMMENT '过敏史',
|
||
`disability_type` varchar(50) DEFAULT NULL COMMENT '残疾类型 1 - 视力残疾 2 - 听力残疾 3 - 智力残疾 9 - 其他残疾',
|
||
`disability_level` varchar(20) DEFAULT NULL COMMENT '残疾等级',
|
||
`admission_category` varchar(20) DEFAULT NULL COMMENT '录取类别:统招、自主招生、专项计划等',
|
||
`student_status` char(1) DEFAULT '1' COMMENT '学籍状态:1-在籍,2-休学,3-复学,4-退学,5-毕业',
|
||
`enrollment_year` int(4) DEFAULT NULL COMMENT '入学年份',
|
||
`enrollment_date` date DEFAULT NULL COMMENT '入学日期',
|
||
`bank_card_no` varchar(30) DEFAULT NULL COMMENT '银行卡号',
|
||
`bank_name` varchar(100) DEFAULT NULL COMMENT '开户银行',
|
||
`bank_branch` varchar(100) DEFAULT NULL COMMENT '开户支行',
|
||
`card_holder_name` varchar(50) DEFAULT NULL COMMENT '持卡人姓名',
|
||
`info_status` char(1) DEFAULT '1' COMMENT '信息状态:1-正常,2-待审核,3-审核中,4-已驳回,5-已锁定',
|
||
`data_source` varchar(20) DEFAULT 'manual' COMMENT '数据来源:manual-手工录入,import-批量导入,sync-系统同步',
|
||
`last_batch_id` bigint(20) DEFAULT NULL COMMENT '最后修改批次ID',
|
||
`last_audit_time` datetime DEFAULT NULL COMMENT '最后审核时间',
|
||
`is_complete` tinyint(1) DEFAULT '0' COMMENT '信息是否完整:0-不完整,1-完整',
|
||
`completion_rate` decimal(10,2) DEFAULT '0.00' COMMENT '完整度百分比',
|
||
`school_system` int(2) DEFAULT '4' COMMENT '学制(年)- 预留,数据从班级表关联',
|
||
`academic_level` varchar(20) DEFAULT NULL COMMENT '学历层次 - 预留,数据从班级表关联',
|
||
`training_type` varchar(20) DEFAULT NULL COMMENT '培养方式:全日制、在职、函授、夜大等 - 预留,数据从班级表关联',
|
||
`major_id` varchar(100) DEFAULT NULL COMMENT '专业id - 预留,数据从班级表关联',
|
||
`major_name` varchar(100) DEFAULT NULL COMMENT '专业名称 - 预留,数据从班级表关联',
|
||
`class_id` varchar(100) DEFAULT NULL COMMENT '班级id - 预留,数据从班级表关联',
|
||
`class_name` varchar(100) DEFAULT NULL COMMENT '班级名称 - 预留,数据从班级表关联',
|
||
`grade` varchar(10) DEFAULT NULL COMMENT '年级 - 预留,数据从班级表关联',
|
||
`college_id` varchar(100) DEFAULT NULL COMMENT '学院id - 预留,数据从班级表关联',
|
||
`college_name` varchar(100) DEFAULT NULL COMMENT '学院名称 - 预留,数据从班级表关联',
|
||
`counselor_id` bigint(20) DEFAULT NULL COMMENT '辅导员ID - 预留,数据从班级表关联',
|
||
`counselor_name` varchar(50) DEFAULT NULL COMMENT '辅导员姓名 - 预留,数据从班级表关联',
|
||
`class_teacher_id` bigint(20) DEFAULT NULL COMMENT '班主任ID - 预留,数据从班级表关联',
|
||
`class_teacher_name` varchar(50) DEFAULT NULL COMMENT '班主任姓名 - 预留,数据从班级表关联',
|
||
`dormitory_building` varchar(100) DEFAULT NULL COMMENT '宿舍楼栋 - 预留,数据从班级表关联 楼栋id',
|
||
`dormitory_room` varchar(100) DEFAULT NULL COMMENT '宿舍房间号 - 预留,数据从班级表关联 房间id',
|
||
`ext_field1` varchar(200) DEFAULT NULL COMMENT '扩展字段1 - 床位id',
|
||
`ext_field2` varchar(200) DEFAULT NULL COMMENT '扩展字段2',
|
||
`ext_field3` varchar(200) DEFAULT NULL COMMENT '扩展字段3',
|
||
`ext_field4` varchar(200) DEFAULT NULL COMMENT '扩展字段4',
|
||
`ext_field5` varchar(500) DEFAULT NULL COMMENT '扩展字段5',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
|
||
PRIMARY KEY (`id`) USING BTREE,
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_deleted` (`deleted`) USING BTREE,
|
||
KEY `idx_name` (`name`) USING BTREE,
|
||
KEY `idx_student_status` (`student_status`) USING BTREE,
|
||
KEY `idx_info_status` (`info_status`) USING BTREE,
|
||
KEY `idx_enrollment_year` (`enrollment_year`) USING BTREE,
|
||
KEY `idx_last_batch_id` (`last_batch_id`) USING BTREE,
|
||
KEY `idx_phone` (`phone`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||
KEY `idx_status_filter` (`tenant_id`,`student_status`,`info_status`,`deleted`) USING BTREE,
|
||
KEY `uk_student_no_tenant` (`student_no`,`tenant_id`) USING BTREE,
|
||
KEY `uk_id_card_tenant` (`id_card`,`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生信息表';
|
||
|
||
-- ----------------------------
|
||
-- Table structure for xg_student_msg_batch
|
||
-- ----------------------------
|
||
DROP TABLE IF EXISTS `xg_student_msg_batch`;
|
||
CREATE TABLE `xg_student_msg_batch` (
|
||
`id` bigint(20) NOT NULL COMMENT '主键ID(雪花ID)',
|
||
`tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
|
||
`create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
|
||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
|
||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
|
||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||
`deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||
`student_no` varchar(32) NOT NULL COMMENT '学号',
|
||
`id_card` varchar(18) DEFAULT NULL COMMENT '身份证号',
|
||
`name` varchar(50) NOT NULL COMMENT '姓名',
|
||
`name_english` varchar(100) DEFAULT NULL COMMENT '英文姓名',
|
||
`former_name` varchar(50) DEFAULT NULL COMMENT '曾用名',
|
||
`gender` char(1) NOT NULL COMMENT '性别:0-男,1-女',
|
||
`birth_date` date DEFAULT NULL COMMENT '出生日期',
|
||
`nationality` varchar(20) DEFAULT NULL COMMENT '民族 ',
|
||
`native_place` varchar(20) DEFAULT NULL COMMENT '籍贯',
|
||
`political_status` varchar(20) DEFAULT NULL COMMENT '政治面貌',
|
||
`hukou_location` varchar(1000) DEFAULT NULL COMMENT '户籍所在地',
|
||
`home_address` varchar(1000) DEFAULT NULL COMMENT '家庭地址',
|
||
`current_address` varchar(1000) DEFAULT NULL COMMENT '现住址',
|
||
`postal_code` varchar(10) DEFAULT NULL COMMENT '邮政编码',
|
||
`photo_url` varchar(500) DEFAULT NULL COMMENT '照片URL',
|
||
`photo_path` varchar(500) DEFAULT NULL COMMENT '学生照片存储路径',
|
||
`phone` varchar(20) DEFAULT NULL COMMENT '手机号码',
|
||
`is_boarder` tinyint(1) DEFAULT '0' COMMENT '是否住校:0-否,1-是',
|
||
`education_level` varchar(20) DEFAULT NULL COMMENT '文化程度',
|
||
`household_register_type` varchar(20) DEFAULT NULL COMMENT '户口类型:农业、非农业',
|
||
`religion` varchar(200) DEFAULT NULL COMMENT '宗教信仰',
|
||
`source_region` varchar(100) DEFAULT NULL COMMENT '生源地区(省市县)',
|
||
`graduate_school` varchar(100) DEFAULT NULL COMMENT '毕业院校',
|
||
`email` varchar(100) DEFAULT NULL COMMENT '电子邮箱',
|
||
`qq` varchar(20) DEFAULT NULL COMMENT 'QQ号码',
|
||
`wechat` varchar(50) DEFAULT NULL COMMENT '微信号',
|
||
`marital_status` varchar(10) DEFAULT NULL COMMENT '婚姻状况:1 未婚、2 已婚、3 离异、4 丧偶 ',
|
||
`emergency_contact_name` varchar(50) DEFAULT NULL COMMENT '紧急联系人姓名',
|
||
`emergency_contact_phone` varchar(20) DEFAULT NULL COMMENT '紧急联系人电话',
|
||
`emergency_contact_relation` varchar(100) DEFAULT NULL COMMENT '紧急联系人关系',
|
||
`is_poor_student` tinyint(1) DEFAULT '0' COMMENT '是否贫困生:0-否,1-是',
|
||
`is_minority` tinyint(1) DEFAULT '0' COMMENT '是否少数民族:0-否,1-是',
|
||
`is_disabled` tinyint(1) DEFAULT '0' COMMENT '是否残疾:0-否,1-是',
|
||
`is_orphan` tinyint(1) DEFAULT '0' COMMENT '是否孤儿:0-否,1-是',
|
||
`is_left_behind_child` tinyint(1) DEFAULT '0' COMMENT '是否留守儿童:0-否,1-是',
|
||
`is_single_child` tinyint(1) DEFAULT '0' COMMENT '是否独生子女:0-否,1-是',
|
||
`is_low_income` tinyint(1) DEFAULT '0' COMMENT '是否低保:0-否,1-是',
|
||
`has_loan` tinyint(1) DEFAULT '0' COMMENT '是否有助学贷款:0-否,1-是',
|
||
`loan_amount` decimal(10,2) DEFAULT NULL COMMENT '助学贷款金额',
|
||
`specialties` text COMMENT '特长爱好',
|
||
`awards` text COMMENT '获奖情况',
|
||
`violations` text COMMENT '违纪记录',
|
||
`social_activities` text COMMENT '社会活动',
|
||
`father_name` varchar(50) DEFAULT NULL COMMENT '父亲姓名',
|
||
`father_phone` varchar(20) DEFAULT NULL COMMENT '父亲电话',
|
||
`father_work_unit` varchar(1000) DEFAULT NULL COMMENT '父亲工作单位',
|
||
`mother_name` varchar(50) DEFAULT NULL COMMENT '母亲姓名',
|
||
`mother_phone` varchar(20) DEFAULT NULL COMMENT '母亲电话',
|
||
`mother_work_unit` varchar(1000) DEFAULT NULL COMMENT '母亲工作单位',
|
||
`guardian_name` varchar(50) DEFAULT NULL COMMENT '监护人姓名',
|
||
`guardian_phone` varchar(20) DEFAULT NULL COMMENT '监护人电话',
|
||
`guardian_relation` varchar(20) DEFAULT NULL COMMENT '监护人关系',
|
||
`family_income` decimal(12,2) DEFAULT NULL COMMENT '家庭年收入',
|
||
`per_capita_income` decimal(12,2) DEFAULT NULL COMMENT '人均收入',
|
||
`income_source` varchar(100) DEFAULT NULL COMMENT '收入来源',
|
||
`family_economic_status` varchar(20) DEFAULT NULL COMMENT '家庭经济状况:富裕、一般、困难、特困',
|
||
`family_members` tinyint(2) DEFAULT NULL COMMENT '家庭成员数量',
|
||
`height` decimal(10,2) DEFAULT NULL COMMENT '身高(cm)',
|
||
`weight` decimal(10,2) DEFAULT NULL COMMENT '体重(kg)',
|
||
`blood_type` varchar(10) DEFAULT NULL COMMENT '血型',
|
||
`health_status` varchar(1000) DEFAULT NULL COMMENT '健康状况',
|
||
`special_condition` varchar(1000) DEFAULT NULL COMMENT '特殊体质或疾病',
|
||
`medical_history` varchar(1000) DEFAULT NULL COMMENT '病史',
|
||
`allergies` varchar(1000) DEFAULT NULL COMMENT '过敏史',
|
||
`disability_type` varchar(50) DEFAULT NULL COMMENT '残疾类型 1 - 视力残疾 2 - 听力残疾 3 - 智力残疾 9 - 其他残疾',
|
||
`disability_level` varchar(20) DEFAULT NULL COMMENT '残疾等级',
|
||
`admission_category` varchar(20) DEFAULT NULL COMMENT '录取类别:统招、自主招生、专项计划等',
|
||
`student_status` char(1) DEFAULT '1' COMMENT '学籍状态:1-在籍,2-休学,3-复学,4-退学,5-毕业',
|
||
`enrollment_year` int(4) DEFAULT NULL COMMENT '入学年份',
|
||
`enrollment_date` date DEFAULT NULL COMMENT '入学日期',
|
||
`bank_card_no` varchar(30) DEFAULT NULL COMMENT '银行卡号',
|
||
`bank_name` varchar(100) DEFAULT NULL COMMENT '开户银行',
|
||
`bank_branch` varchar(100) DEFAULT NULL COMMENT '开户支行',
|
||
`card_holder_name` varchar(50) DEFAULT NULL COMMENT '持卡人姓名',
|
||
`info_status` char(1) DEFAULT '1' COMMENT '信息状态:1-正常,2-待审核,3-审核中,4-已驳回,5-已锁定',
|
||
`data_source` varchar(20) DEFAULT 'manual' COMMENT '数据来源:manual-手工录入,import-批量导入,sync-系统同步',
|
||
`last_batch_id` bigint(20) DEFAULT NULL COMMENT '最后修改批次ID',
|
||
`last_audit_time` datetime DEFAULT NULL COMMENT '最后审核时间',
|
||
`is_complete` tinyint(1) DEFAULT '0' COMMENT '信息是否完整:0-不完整,1-完整',
|
||
`completion_rate` decimal(10,2) DEFAULT '0.00' COMMENT '完整度百分比',
|
||
`school_system` int(2) DEFAULT '4' COMMENT '学制(年)- 预留,数据从班级表关联',
|
||
`academic_level` varchar(20) DEFAULT NULL COMMENT '学历层次 - 预留,数据从班级表关联',
|
||
`training_type` varchar(20) DEFAULT NULL COMMENT '培养方式:全日制、在职、函授、夜大等 - 预留,数据从班级表关联',
|
||
`major_id` varchar(100) DEFAULT NULL COMMENT '专业id - 预留,数据从班级表关联',
|
||
`major_name` varchar(100) DEFAULT NULL COMMENT '专业名称 - 预留,数据从班级表关联',
|
||
`class_id` varchar(100) DEFAULT NULL COMMENT '班级id - 预留,数据从班级表关联',
|
||
`class_name` varchar(100) DEFAULT NULL COMMENT '班级名称 - 预留,数据从班级表关联',
|
||
`grade` varchar(10) DEFAULT NULL COMMENT '年级 - 预留,数据从班级表关联',
|
||
`college_id` varchar(100) DEFAULT NULL COMMENT '学院id - 预留,数据从班级表关联',
|
||
`college_name` varchar(100) DEFAULT NULL COMMENT '学院名称 - 预留,数据从班级表关联',
|
||
`counselor_id` bigint(20) DEFAULT NULL COMMENT '辅导员ID - 预留,数据从班级表关联',
|
||
`counselor_name` varchar(50) DEFAULT NULL COMMENT '辅导员姓名 - 预留,数据从班级表关联',
|
||
`class_teacher_id` bigint(20) DEFAULT NULL COMMENT '班主任ID - 预留,数据从班级表关联',
|
||
`class_teacher_name` varchar(50) DEFAULT NULL COMMENT '班主任姓名 - 预留,数据从班级表关联',
|
||
`dormitory_building` varchar(100) DEFAULT NULL COMMENT '宿舍楼栋 - 预留,数据从班级表关联 楼栋id',
|
||
`dormitory_room` varchar(100) DEFAULT NULL COMMENT '宿舍房间号 - 预留,数据从班级表关联 房间id',
|
||
`ext_field1` varchar(200) DEFAULT NULL COMMENT '扩展字段1 - 床位id',
|
||
`ext_field2` varchar(200) DEFAULT NULL COMMENT '扩展字段2',
|
||
`ext_field3` varchar(200) DEFAULT NULL COMMENT '扩展字段3',
|
||
`ext_field4` varchar(200) DEFAULT NULL COMMENT '扩展字段4',
|
||
`ext_field5` varchar(500) DEFAULT NULL COMMENT '扩展字段5',
|
||
`remark` varchar(500) DEFAULT NULL COMMENT '备注信息',
|
||
`batch_id` bigint(20) NOT NULL COMMENT '正在进行中的批次id',
|
||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE,
|
||
KEY `idx_deleted` (`deleted`) USING BTREE,
|
||
KEY `idx_name` (`name`) USING BTREE,
|
||
KEY `idx_student_status` (`student_status`) USING BTREE,
|
||
KEY `idx_info_status` (`info_status`) USING BTREE,
|
||
KEY `idx_enrollment_year` (`enrollment_year`) USING BTREE,
|
||
KEY `idx_last_batch_id` (`last_batch_id`) USING BTREE,
|
||
KEY `idx_phone` (`phone`) USING BTREE,
|
||
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||
KEY `idx_status_filter` (`tenant_id`,`student_status`,`info_status`,`deleted`) USING BTREE,
|
||
KEY `uk_student_no_tenant` (`student_no`,`tenant_id`) USING BTREE,
|
||
KEY `uk_id_card_tenant` (`id_card`,`tenant_id`) USING BTREE
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生信息批次收集表';
|
||
|
||
SET FOREIGN_KEY_CHECKS = 1;
|