-- ======================================================
-- 表结构、注释、约束、索引及初始数据
-- 数据库：KingbaseES V008R006C009B0014
-- ======================================================

-- ----------------------------
-- 1. 流程定义表 flow_definition
-- ----------------------------
DROP TABLE IF EXISTS "public"."flow_definition";
CREATE TABLE "public"."flow_definition" (
  "id" bigint NOT NULL,
  "flow_code" varchar NOT NULL,
  "flow_name" varchar NOT NULL,
  "category" varchar,
  "version" varchar NOT NULL,
  "is_publish" smallint NOT NULL DEFAULT 0,
  "form_custom" char DEFAULT 'N'::bpchar,
  "form_path" varchar,
  "activity_status" smallint NOT NULL DEFAULT 1,
  "listener_type" varchar,
  "listener_path" varchar,
  "ext" varchar,
  "create_time" TIMESTAMP,
  "update_time" TIMESTAMP,
  "del_flag" char DEFAULT '0'::bpchar,
  "tenant_id" varchar
);
COMMENT ON COLUMN "public"."flow_definition"."id" IS '主键id';
COMMENT ON COLUMN "public"."flow_definition"."flow_code" IS '流程编码';
COMMENT ON COLUMN "public"."flow_definition"."flow_name" IS '流程名称';
COMMENT ON COLUMN "public"."flow_definition"."category" IS '流程类别';
COMMENT ON COLUMN "public"."flow_definition"."version" IS '流程版本';
COMMENT ON COLUMN "public"."flow_definition"."is_publish" IS '是否发布（0未发布 1已发布 9失效）';
COMMENT ON COLUMN "public"."flow_definition"."form_custom" IS '审批表单是否自定义（Y是 N否）';
COMMENT ON COLUMN "public"."flow_definition"."form_path" IS '审批表单路径';
COMMENT ON COLUMN "public"."flow_definition"."activity_status" IS '流程激活状态（0挂起 1激活）';
COMMENT ON COLUMN "public"."flow_definition"."listener_type" IS '监听器类型';
COMMENT ON COLUMN "public"."flow_definition"."listener_path" IS '监听器路径';
COMMENT ON COLUMN "public"."flow_definition"."ext" IS '业务详情 存业务表对象json字符串';
COMMENT ON COLUMN "public"."flow_definition"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."flow_definition"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."flow_definition"."del_flag" IS '删除标志';
COMMENT ON COLUMN "public"."flow_definition"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."flow_definition" IS '流程定义表';

ALTER TABLE "public"."flow_definition" ADD CONSTRAINT "flow_definition_pkey" PRIMARY KEY ("id");

INSERT INTO "public"."flow_definition" ("id", "flow_code", "flow_name", "category", "version", "is_publish", "form_custom", "form_path", "activity_status", "listener_type", "listener_path", "ext", "create_time", "update_time", "del_flag", "tenant_id") VALUES (2061763773549461506, '111', '11', NULL, '1', 0, 'N', '11', 1, '', '', NULL, '2026-06-02 18:56:04', '2026-06-02 18:56:04', '0', NULL);

-- ----------------------------
-- 2. 流程历史任务表 flow_his_task
-- ----------------------------
DROP TABLE IF EXISTS "public"."flow_his_task";
CREATE TABLE "public"."flow_his_task" (
  "id" bigint NOT NULL,
  "definition_id" bigint NOT NULL,
  "instance_id" bigint NOT NULL,
  "task_id" bigint NOT NULL,
  "node_code" varchar,
  "node_name" varchar,
  "node_type" smallint,
  "target_node_code" varchar,
  "target_node_name" varchar,
  "approver" varchar,
  "cooperate_type" smallint NOT NULL DEFAULT 0,
  "collaborator" varchar,
  "skip_type" varchar NOT NULL,
  "flow_status" varchar NOT NULL,
  "form_custom" char DEFAULT 'N'::bpchar,
  "form_path" varchar,
  "message" varchar,
  "variable" text,
  "ext" text,
  "create_time" TIMESTAMP,
  "update_time" TIMESTAMP,
  "del_flag" char DEFAULT '0'::bpchar,
  "tenant_id" varchar
);
COMMENT ON COLUMN "public"."flow_his_task"."id" IS '主键id';
COMMENT ON COLUMN "public"."flow_his_task"."definition_id" IS '对应flow_definition表的id';
COMMENT ON COLUMN "public"."flow_his_task"."instance_id" IS '对应flow_instance表的id';
COMMENT ON COLUMN "public"."flow_his_task"."task_id" IS '对应flow_task表的id';
COMMENT ON COLUMN "public"."flow_his_task"."node_code" IS '开始节点编码';
COMMENT ON COLUMN "public"."flow_his_task"."node_name" IS '开始节点名称';
COMMENT ON COLUMN "public"."flow_his_task"."node_type" IS '开始节点类型（0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关）';
COMMENT ON COLUMN "public"."flow_his_task"."target_node_code" IS '目标节点编码';
COMMENT ON COLUMN "public"."flow_his_task"."target_node_name" IS '结束节点名称';
COMMENT ON COLUMN "public"."flow_his_task"."approver" IS '审批者';
COMMENT ON COLUMN "public"."flow_his_task"."cooperate_type" IS '协作方式(1审批 2转办 3委派 4会签 5票签 6加签 7减签)';
COMMENT ON COLUMN "public"."flow_his_task"."collaborator" IS '协作人';
COMMENT ON COLUMN "public"."flow_his_task"."skip_type" IS '流转类型（PASS通过 REJECT退回 NONE无动作）';
COMMENT ON COLUMN "public"."flow_his_task"."flow_status" IS '流程状态（0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回）';
COMMENT ON COLUMN "public"."flow_his_task"."form_custom" IS '审批表单是否自定义（Y是 N否）';
COMMENT ON COLUMN "public"."flow_his_task"."form_path" IS '审批表单路径';
COMMENT ON COLUMN "public"."flow_his_task"."message" IS '审批意见';
COMMENT ON COLUMN "public"."flow_his_task"."variable" IS '任务变量';
COMMENT ON COLUMN "public"."flow_his_task"."ext" IS '业务详情 存业务表对象json字符串';
COMMENT ON COLUMN "public"."flow_his_task"."create_time" IS '任务开始时间';
COMMENT ON COLUMN "public"."flow_his_task"."update_time" IS '审批完成时间';
COMMENT ON COLUMN "public"."flow_his_task"."del_flag" IS '删除标志';
COMMENT ON COLUMN "public"."flow_his_task"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."flow_his_task" IS '流程历史任务表';

ALTER TABLE "public"."flow_his_task" ADD CONSTRAINT "flow_his_task_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- 3. 流程实例表 flow_instance
-- ----------------------------
DROP TABLE IF EXISTS "public"."flow_instance";
CREATE TABLE "public"."flow_instance" (
  "id" bigint NOT NULL,
  "definition_id" bigint NOT NULL,
  "business_id" varchar NOT NULL,
  "node_type" smallint NOT NULL,
  "node_code" varchar NOT NULL,
  "node_name" varchar,
  "variable" text,
  "flow_status" varchar NOT NULL,
  "activity_status" smallint NOT NULL DEFAULT 1,
  "def_json" text,
  "create_by" varchar DEFAULT ''::varchar,
  "create_time" TIMESTAMP,
  "update_time" TIMESTAMP,
  "ext" varchar,
  "del_flag" char DEFAULT '0'::bpchar,
  "tenant_id" varchar
);
COMMENT ON COLUMN "public"."flow_instance"."id" IS '主键id';
COMMENT ON COLUMN "public"."flow_instance"."definition_id" IS '对应flow_definition表的id';
COMMENT ON COLUMN "public"."flow_instance"."business_id" IS '业务id';
COMMENT ON COLUMN "public"."flow_instance"."node_type" IS '节点类型（0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关）';
COMMENT ON COLUMN "public"."flow_instance"."node_code" IS '流程节点编码';
COMMENT ON COLUMN "public"."flow_instance"."node_name" IS '流程节点名称';
COMMENT ON COLUMN "public"."flow_instance"."variable" IS '任务变量';
COMMENT ON COLUMN "public"."flow_instance"."flow_status" IS '流程状态（0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回）';
COMMENT ON COLUMN "public"."flow_instance"."activity_status" IS '流程激活状态（0挂起 1激活）';
COMMENT ON COLUMN "public"."flow_instance"."def_json" IS '流程定义json';
COMMENT ON COLUMN "public"."flow_instance"."create_by" IS '创建者';
COMMENT ON COLUMN "public"."flow_instance"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."flow_instance"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."flow_instance"."ext" IS '扩展字段，预留给业务系统使用';
COMMENT ON COLUMN "public"."flow_instance"."del_flag" IS '删除标志';
COMMENT ON COLUMN "public"."flow_instance"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."flow_instance" IS '流程实例表';

ALTER TABLE "public"."flow_instance" ADD CONSTRAINT "flow_instance_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- 4. 流程节点表 flow_node
-- ----------------------------
DROP TABLE IF EXISTS "public"."flow_node";
CREATE TABLE "public"."flow_node" (
  "id" bigint NOT NULL,
  "node_type" smallint NOT NULL,
  "definition_id" bigint NOT NULL,
  "node_code" varchar NOT NULL,
  "node_name" varchar,
  "permission_flag" varchar,
  "node_ratio" numeric(6,3),
  "coordinate" varchar,
  "any_node_skip" varchar,
  "listener_type" varchar,
  "listener_path" varchar,
  "handler_type" varchar,
  "handler_path" varchar,
  "form_custom" char DEFAULT 'N'::bpchar,
  "form_path" varchar,
  "version" varchar NOT NULL,
  "create_time" TIMESTAMP,
  "update_time" TIMESTAMP,
  "ext" text,
  "del_flag" char DEFAULT '0'::bpchar,
  "tenant_id" varchar
);
COMMENT ON COLUMN "public"."flow_node"."id" IS '主键id';
COMMENT ON COLUMN "public"."flow_node"."node_type" IS '节点类型（0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关）';
COMMENT ON COLUMN "public"."flow_node"."definition_id" IS '流程定义id';
COMMENT ON COLUMN "public"."flow_node"."node_code" IS '流程节点编码';
COMMENT ON COLUMN "public"."flow_node"."node_name" IS '流程节点名称';
COMMENT ON COLUMN "public"."flow_node"."permission_flag" IS '权限标识（权限类型:权限标识，可以多个，用逗号隔开)';
COMMENT ON COLUMN "public"."flow_node"."node_ratio" IS '流程签署比例值';
COMMENT ON COLUMN "public"."flow_node"."coordinate" IS '坐标';
COMMENT ON COLUMN "public"."flow_node"."any_node_skip" IS '任意结点跳转';
COMMENT ON COLUMN "public"."flow_node"."listener_type" IS '监听器类型';
COMMENT ON COLUMN "public"."flow_node"."listener_path" IS '监听器路径';
COMMENT ON COLUMN "public"."flow_node"."handler_type" IS '处理器类型';
COMMENT ON COLUMN "public"."flow_node"."handler_path" IS '处理器路径';
COMMENT ON COLUMN "public"."flow_node"."form_custom" IS '审批表单是否自定义（Y是 N否）';
COMMENT ON COLUMN "public"."flow_node"."form_path" IS '审批表单路径';
COMMENT ON COLUMN "public"."flow_node"."version" IS '版本';
COMMENT ON COLUMN "public"."flow_node"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."flow_node"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."flow_node"."ext" IS '扩展属性';
COMMENT ON COLUMN "public"."flow_node"."del_flag" IS '删除标志';
COMMENT ON COLUMN "public"."flow_node"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."flow_node" IS '流程节点表';

ALTER TABLE "public"."flow_node" ADD CONSTRAINT "flow_node_pkey" PRIMARY KEY ("id");

INSERT INTO "public"."flow_node" ("id", "node_type", "definition_id", "node_code", "node_name", "permission_flag", "node_ratio", "coordinate", "any_node_skip", "listener_type", "listener_path", "handler_type", "handler_path", "form_custom", "form_path", "version", "create_time", "update_time", "ext", "del_flag", "tenant_id") VALUES (2061763773574627330, 0, 2061763773549461506, 'start', '开始', NULL, 0.000, '260,200|260,200', NULL, NULL, NULL, NULL, NULL, 'N', NULL, '1', '2026-06-02 18:56:04', '2026-06-02 18:56:04', NULL, '0', NULL);
INSERT INTO "public"."flow_node" ("id", "node_type", "definition_id", "node_code", "node_name", "permission_flag", "node_ratio", "coordinate", "any_node_skip", "listener_type", "listener_path", "handler_type", "handler_path", "form_custom", "form_path", "version", "create_time", "update_time", "ext", "del_flag", "tenant_id") VALUES (2061763773574627331, 1, 2061763773549461506, 'submit', '中间节点-或签1', NULL, 0.000, '420,200|420,200', NULL, NULL, NULL, NULL, NULL, 'N', NULL, '1', '2026-06-02 18:56:04', '2026-06-02 18:56:04', NULL, '0', NULL);
INSERT INTO "public"."flow_node" ("id", "node_type", "definition_id", "node_code", "node_name", "permission_flag", "node_ratio", "coordinate", "any_node_skip", "listener_type", "listener_path", "handler_type", "handler_path", "form_custom", "form_path", "version", "create_time", "update_time", "ext", "del_flag", "tenant_id") VALUES (2061763773574627332, 1, 2061763773549461506, 'approval', '中间节点-或签2', NULL, 0.000, '600,200|600,200', NULL, NULL, NULL, NULL, NULL, 'N', NULL, '1', '2026-06-02 18:56:04', '2026-06-02 18:56:04', NULL, '0', NULL);
INSERT INTO "public"."flow_node" ("id", "node_type", "definition_id", "node_code", "node_name", "permission_flag", "node_ratio", "coordinate", "any_node_skip", "listener_type", "listener_path", "handler_type", "handler_path", "form_custom", "form_path", "version", "create_time", "update_time", "ext", "del_flag", "tenant_id") VALUES (2061763773574627333, 2, 2061763773549461506, 'end', '结束', NULL, 0.000, '760,200|760,200', NULL, NULL, NULL, NULL, NULL, 'N', NULL, '1', '2026-06-02 18:56:04', '2026-06-02 18:56:04', NULL, '0', NULL);

-- ----------------------------
-- 5. 流程跳转表 flow_skip
-- ----------------------------
DROP TABLE IF EXISTS "public"."flow_skip";
CREATE TABLE "public"."flow_skip" (
  "id" bigint NOT NULL,
  "definition_id" bigint NOT NULL,
  "now_node_code" varchar NOT NULL,
  "now_node_type" smallint,
  "next_node_code" varchar NOT NULL,
  "next_node_type" smallint,
  "skip_name" varchar,
  "skip_type" varchar,
  "skip_condition" varchar,
  "coordinate" varchar,
  "create_time" TIMESTAMP,
  "update_time" TIMESTAMP,
  "del_flag" char DEFAULT '0'::bpchar,
  "tenant_id" varchar
);
COMMENT ON COLUMN "public"."flow_skip"."id" IS '主键id';
COMMENT ON COLUMN "public"."flow_skip"."definition_id" IS '流程定义id';
COMMENT ON COLUMN "public"."flow_skip"."now_node_code" IS '当前流程节点的编码';
COMMENT ON COLUMN "public"."flow_skip"."now_node_type" IS '当前节点类型（0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关）';
COMMENT ON COLUMN "public"."flow_skip"."next_node_code" IS '下一个流程节点的编码';
COMMENT ON COLUMN "public"."flow_skip"."next_node_type" IS '下一个节点类型（0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关）';
COMMENT ON COLUMN "public"."flow_skip"."skip_name" IS '跳转名称';
COMMENT ON COLUMN "public"."flow_skip"."skip_type" IS '跳转类型（PASS审批通过 REJECT退回）';
COMMENT ON COLUMN "public"."flow_skip"."skip_condition" IS '跳转条件';
COMMENT ON COLUMN "public"."flow_skip"."coordinate" IS '坐标';
COMMENT ON COLUMN "public"."flow_skip"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."flow_skip"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."flow_skip"."del_flag" IS '删除标志';
COMMENT ON COLUMN "public"."flow_skip"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."flow_skip" IS '流程跳转表';

ALTER TABLE "public"."flow_skip" ADD CONSTRAINT "flow_skip_pkey" PRIMARY KEY ("id");

INSERT INTO "public"."flow_skip" ("id", "definition_id", "now_node_code", "now_node_type", "next_node_code", "next_node_type", "skip_name", "skip_type", "skip_condition", "coordinate", "create_time", "update_time", "del_flag", "tenant_id") VALUES (2061763774413488130, 2061763773549461506, 'start', 0, 'submit', 1, NULL, 'PASS', NULL, '280,200;370,200', '2026-06-02 18:56:04', '2026-06-02 18:56:04', '0', NULL);
INSERT INTO "public"."flow_skip" ("id", "definition_id", "now_node_code", "now_node_type", "next_node_code", "next_node_type", "skip_name", "skip_type", "skip_condition", "coordinate", "create_time", "update_time", "del_flag", "tenant_id") VALUES (2061763774413488131, 2061763773549461506, 'submit', 1, 'approval', 1, NULL, 'PASS', NULL, '470,200;550,200', '2026-06-02 18:56:04', '2026-06-02 18:56:04', '0', NULL);
INSERT INTO "public"."flow_skip" ("id", "definition_id", "now_node_code", "now_node_type", "next_node_code", "next_node_type", "skip_name", "skip_type", "skip_condition", "coordinate", "create_time", "update_time", "del_flag", "tenant_id") VALUES (2061763774413488132, 2061763773549461506, 'approval', 1, 'end', 2, NULL, 'PASS', NULL, '650,200;740,200', '2026-06-02 18:56:04', '2026-06-02 18:56:04', '0', NULL);

-- ----------------------------
-- 6. 流程任务表 flow_task
-- ----------------------------
DROP TABLE IF EXISTS "public"."flow_task";
CREATE TABLE "public"."flow_task" (
  "id" bigint NOT NULL,
  "definition_id" bigint NOT NULL,
  "instance_id" bigint NOT NULL,
  "node_code" varchar NOT NULL,
  "node_name" varchar,
  "node_type" smallint NOT NULL,
  "flow_status" varchar NOT NULL,
  "form_custom" char DEFAULT 'N'::bpchar,
  "form_path" varchar,
  "create_time" TIMESTAMP,
  "update_time" TIMESTAMP,
  "del_flag" char DEFAULT '0'::bpchar,
  "tenant_id" varchar
);
COMMENT ON COLUMN "public"."flow_task"."id" IS '主键id';
COMMENT ON COLUMN "public"."flow_task"."definition_id" IS '对应flow_definition表的id';
COMMENT ON COLUMN "public"."flow_task"."instance_id" IS '对应flow_instance表的id';
COMMENT ON COLUMN "public"."flow_task"."node_code" IS '节点编码';
COMMENT ON COLUMN "public"."flow_task"."node_name" IS '节点名称';
COMMENT ON COLUMN "public"."flow_task"."node_type" IS '节点类型（0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关）';
COMMENT ON COLUMN "public"."flow_task"."flow_status" IS '流程状态（0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回）';
COMMENT ON COLUMN "public"."flow_task"."form_custom" IS '审批表单是否自定义（Y是 N否）';
COMMENT ON COLUMN "public"."flow_task"."form_path" IS '审批表单路径';
COMMENT ON COLUMN "public"."flow_task"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."flow_task"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."flow_task"."del_flag" IS '删除标志';
COMMENT ON COLUMN "public"."flow_task"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."flow_task" IS '流程任务表';

ALTER TABLE "public"."flow_task" ADD CONSTRAINT "flow_task_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- 7. 流程用户表 flow_user
-- ----------------------------
DROP TABLE IF EXISTS "public"."flow_user";
CREATE TABLE "public"."flow_user" (
  "id" bigint NOT NULL,
  "type" char NOT NULL,
  "processed_by" varchar,
  "associated" bigint NOT NULL,
  "create_time" TIMESTAMP,
  "create_by" varchar,
  "update_time" TIMESTAMP,
  "del_flag" char DEFAULT '0'::bpchar,
  "tenant_id" varchar
);
COMMENT ON COLUMN "public"."flow_user"."id" IS '主键id';
COMMENT ON COLUMN "public"."flow_user"."type" IS '人员类型（1待办任务的审批人权限 2待办任务的转办人权限 3待办任务的委托人权限）';
COMMENT ON COLUMN "public"."flow_user"."processed_by" IS '权限人';
COMMENT ON COLUMN "public"."flow_user"."associated" IS '任务表id';
COMMENT ON COLUMN "public"."flow_user"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."flow_user"."create_by" IS '创建人';
COMMENT ON COLUMN "public"."flow_user"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."flow_user"."del_flag" IS '删除标志';
COMMENT ON COLUMN "public"."flow_user"."tenant_id" IS '租户id';
COMMENT ON TABLE "public"."flow_user" IS '流程用户表';

ALTER TABLE "public"."flow_user" ADD CONSTRAINT "flow_user_pkey" PRIMARY KEY ("id");
CREATE INDEX "user_associated" ON "public"."flow_user" USING btree ("associated");
CREATE INDEX "user_processed_type" ON "public"."flow_user" USING btree ("processed_by", "type");

-- ----------------------------
-- 8. 分类表 t_category
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_category";
CREATE TABLE "public"."t_category" (
  "category_id" bigint NOT NULL,
  "category_name" varchar NOT NULL,
  "category_type" smallint NOT NULL,
  "parent_id" integer NOT NULL,
  "sort" integer NOT NULL DEFAULT 0,
  "disabled_flag" smallint NOT NULL DEFAULT 0,
  "deleted_flag" smallint NOT NULL DEFAULT 0,
  "remark" varchar,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_category"."category_id" IS '分类id';
COMMENT ON COLUMN "public"."t_category"."category_name" IS '分类名称';
COMMENT ON COLUMN "public"."t_category"."category_type" IS '分类类型';
COMMENT ON COLUMN "public"."t_category"."parent_id" IS '父级id';
COMMENT ON COLUMN "public"."t_category"."sort" IS '排序';
COMMENT ON COLUMN "public"."t_category"."disabled_flag" IS '是否禁用';
COMMENT ON COLUMN "public"."t_category"."deleted_flag" IS '是否删除';
COMMENT ON COLUMN "public"."t_category"."remark" IS '备注';
COMMENT ON COLUMN "public"."t_category"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_category"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_category" IS '分类表';

ALTER TABLE "public"."t_category" ADD CONSTRAINT "t_category_pkey" PRIMARY KEY ("category_id");
CREATE INDEX "idx_parent_id" ON "public"."t_category" USING btree ("parent_id");

-- ----------------------------
-- 9. 更新日志表 t_change_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_change_log";
CREATE TABLE "public"."t_change_log" (
  "change_log_id" bigint NOT NULL,
  "version" varchar NOT NULL,
  "type" integer NOT NULL,
  "publish_author" varchar NOT NULL,
  "public_date" TIMESTAMP NOT NULL,
  "content" text NOT NULL,
  "link" text,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_change_log"."change_log_id" IS '更新日志id';
COMMENT ON COLUMN "public"."t_change_log"."version" IS '版本';
COMMENT ON COLUMN "public"."t_change_log"."type" IS '更新类型:[1:特大版本功能更新;2:功能更新;3:bug修复]';
COMMENT ON COLUMN "public"."t_change_log"."publish_author" IS '发布人';
COMMENT ON COLUMN "public"."t_change_log"."public_date" IS '发布日期';
COMMENT ON COLUMN "public"."t_change_log"."content" IS '更新内容';
COMMENT ON COLUMN "public"."t_change_log"."link" IS '跳转链接';
COMMENT ON COLUMN "public"."t_change_log"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_change_log"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_change_log" IS '更新日志表';

ALTER TABLE "public"."t_change_log" ADD CONSTRAINT "t_change_log_pkey" PRIMARY KEY ("change_log_id");
ALTER TABLE "public"."t_change_log" ADD CONSTRAINT "t_change_log_version_key" UNIQUE ("version");

-- ----------------------------
-- 10. 代码生成配置表 t_code_generator_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_code_generator_config";
CREATE TABLE "public"."t_code_generator_config" (
  "table_name" varchar NOT NULL,
  "basic" text,
  "fields" text,
  "insert_and_update" text,
  "delete_info" text,
  "query_fields" text,
  "table_fields" text,
  "detail" text,
  "create_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_code_generator_config"."table_name" IS '表名';
COMMENT ON COLUMN "public"."t_code_generator_config"."basic" IS '基础命名信息';
COMMENT ON COLUMN "public"."t_code_generator_config"."fields" IS '字段列表';
COMMENT ON COLUMN "public"."t_code_generator_config"."insert_and_update" IS '新建、修改';
COMMENT ON COLUMN "public"."t_code_generator_config"."delete_info" IS '删除';
COMMENT ON COLUMN "public"."t_code_generator_config"."query_fields" IS '查询';
COMMENT ON COLUMN "public"."t_code_generator_config"."table_fields" IS '列表';
COMMENT ON COLUMN "public"."t_code_generator_config"."detail" IS '详情';
COMMENT ON COLUMN "public"."t_code_generator_config"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_code_generator_config"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_code_generator_config" IS '代码生成配置表';

ALTER TABLE "public"."t_code_generator_config" ADD CONSTRAINT "t_code_generator_config_pkey" PRIMARY KEY ("table_name");

-- ----------------------------
-- 11. 系统配置表 t_config
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_config";
CREATE TABLE "public"."t_config" (
  "config_id" bigint NOT NULL,
  "config_name" varchar NOT NULL,
  "config_key" varchar NOT NULL,
  "config_value" text NOT NULL,
  "remark" varchar,
  "update_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_config"."config_id" IS '主键';
COMMENT ON COLUMN "public"."t_config"."config_name" IS '参数名字';
COMMENT ON COLUMN "public"."t_config"."config_key" IS '参数key';
COMMENT ON COLUMN "public"."t_config"."config_value" IS '参数值';
COMMENT ON COLUMN "public"."t_config"."remark" IS '备注';
COMMENT ON COLUMN "public"."t_config"."update_time" IS '上次修改时间';
COMMENT ON COLUMN "public"."t_config"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_config" IS '系统配置表';

ALTER TABLE "public"."t_config" ADD CONSTRAINT "t_config_pkey" PRIMARY KEY ("config_id");

INSERT INTO "public"."t_config" ("config_id", "config_name", "config_key", "config_value", "remark", "update_time", "create_time") VALUES (1, '万能密码', 'super_password', '1024ok', '执行示例任务2', '2025-03-31 19:40:20', '2021-12-16 23:32:46');
INSERT INTO "public"."t_config" ("config_id", "config_name", "config_key", "config_value", "remark", "update_time", "create_time") VALUES (2, '三级等保', 'level3_protect_config', '{
	"fileDetectFlag":true,
	"loginActiveTimeoutMinutes":30,
	"loginFailLockMinutes":30,
	"loginFailMaxTimes":3,
	"maxUploadFileSizeMb":30,
	"passwordComplexityEnabled":true,
	"regularChangePasswordMonths":3,
	"regularChangePasswordNotAllowRepeatTimes":3,
	"twoFactorLoginEnabled":false
}', 'SmartJob Sample2 update', '2024-09-03 21:49:23', '2024-08-13 11:44:49');

-- ----------------------------
-- 12. 数据追踪表 t_data_tracer
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_data_tracer";
CREATE TABLE "public"."t_data_tracer" (
  "data_tracer_id" bigint NOT NULL,
  "data_id" bigint NOT NULL,
  "type" integer NOT NULL,
  "content" text,
  "diff_old" text,
  "diff_new" text,
  "extra_data" text,
  "user_id" bigint NOT NULL,
  "user_type" integer NOT NULL,
  "user_name" varchar NOT NULL,
  "ip" varchar,
  "ip_region" varchar,
  "user_agent" varchar,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_data_tracer"."data_tracer_id" IS '自增主键';
COMMENT ON COLUMN "public"."t_data_tracer"."data_id" IS '各种单据的id';
COMMENT ON COLUMN "public"."t_data_tracer"."type" IS '单据类型';
COMMENT ON COLUMN "public"."t_data_tracer"."content" IS '操作内容';
COMMENT ON COLUMN "public"."t_data_tracer"."diff_old" IS '差异：旧的数据';
COMMENT ON COLUMN "public"."t_data_tracer"."diff_new" IS '差异：新的数据';
COMMENT ON COLUMN "public"."t_data_tracer"."extra_data" IS '额外信息';
COMMENT ON COLUMN "public"."t_data_tracer"."user_id" IS '用户id';
COMMENT ON COLUMN "public"."t_data_tracer"."user_type" IS '用户类型：1 后管用户 ';
COMMENT ON COLUMN "public"."t_data_tracer"."user_name" IS '用户名称';
COMMENT ON COLUMN "public"."t_data_tracer"."ip" IS 'ip';
COMMENT ON COLUMN "public"."t_data_tracer"."ip_region" IS 'ip地区';
COMMENT ON COLUMN "public"."t_data_tracer"."user_agent" IS '用户ua';
COMMENT ON COLUMN "public"."t_data_tracer"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_data_tracer"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_data_tracer" IS '数据追踪表';

ALTER TABLE "public"."t_data_tracer" ADD CONSTRAINT "t_data_tracer_pkey" PRIMARY KEY ("data_tracer_id");
CREATE INDEX "order_id_order_type" ON "public"."t_data_tracer" USING btree ("data_id", "type");

-- ----------------------------
-- 13. 部门表 t_department
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_department";
CREATE TABLE "public"."t_department" (
  "department_id" bigint NOT NULL,
  "name" varchar NOT NULL,
  "manager_id" bigint,
  "parent_id" bigint NOT NULL DEFAULT 0,
  "sort" integer NOT NULL,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_department"."department_id" IS '部门主键id';
COMMENT ON COLUMN "public"."t_department"."name" IS '部门名称';
COMMENT ON COLUMN "public"."t_department"."manager_id" IS '部门负责人id';
COMMENT ON COLUMN "public"."t_department"."parent_id" IS '部门的父级id';
COMMENT ON COLUMN "public"."t_department"."sort" IS '部门排序';
COMMENT ON COLUMN "public"."t_department"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_department"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_department" IS '部门表';

ALTER TABLE "public"."t_department" ADD CONSTRAINT "t_department_pkey" PRIMARY KEY ("department_id");
CREATE INDEX "parent_id" ON "public"."t_department" USING btree ("parent_id");

-- ----------------------------
-- 14. 字典表 t_dict
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_dict";
CREATE TABLE "public"."t_dict" (
  "dict_id" bigint NOT NULL,
  "dict_name" varchar NOT NULL,
  "dict_code" varchar NOT NULL,
  "remark" varchar,
  "disabled_flag" smallint NOT NULL DEFAULT 0,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_dict"."dict_id" IS '字典id';
COMMENT ON COLUMN "public"."t_dict"."dict_name" IS '字典名字';
COMMENT ON COLUMN "public"."t_dict"."dict_code" IS '字典编码';
COMMENT ON COLUMN "public"."t_dict"."remark" IS '字典备注';
COMMENT ON COLUMN "public"."t_dict"."disabled_flag" IS '禁用状态';
COMMENT ON COLUMN "public"."t_dict"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_dict"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_dict" IS '字典表';

ALTER TABLE "public"."t_dict" ADD CONSTRAINT "t_dict_pkey" PRIMARY KEY ("dict_id");
ALTER TABLE "public"."t_dict" ADD CONSTRAINT "t_dict_dict_code_key" UNIQUE ("dict_code");

INSERT INTO "public"."t_dict" ("dict_id", "dict_name", "dict_code", "remark", "disabled_flag", "create_time", "update_time") VALUES (1, '商品地区', 'GOODS_PLACE', '用于商品管理中的商品地区1', 0, '2025-03-27 14:42:26', '2025-03-31 11:23:03');
INSERT INTO "public"."t_dict" ("dict_id", "dict_name", "dict_code", "remark", "disabled_flag", "create_time", "update_time") VALUES (4, '请假类型', 'LEAVE_TYPE', '', 0, '2025-05-31 20:07:06', '2025-05-31 20:07:06');

-- ----------------------------
-- 15. 字典数据表 t_dict_data
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_dict_data";
CREATE TABLE "public"."t_dict_data" (
  "dict_data_id" bigint NOT NULL,
  "dict_id" bigint NOT NULL,
  "data_value" varchar NOT NULL,
  "data_label" varchar NOT NULL,
  "remark" varchar,
  "sort_order" integer NOT NULL,
  "disabled_flag" smallint NOT NULL DEFAULT 0,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_dict_data"."dict_data_id" IS '字典数据id';
COMMENT ON COLUMN "public"."t_dict_data"."dict_id" IS '字典id';
COMMENT ON COLUMN "public"."t_dict_data"."data_value" IS '字典项值';
COMMENT ON COLUMN "public"."t_dict_data"."data_label" IS '字典项显示名称';
COMMENT ON COLUMN "public"."t_dict_data"."remark" IS '备注';
COMMENT ON COLUMN "public"."t_dict_data"."sort_order" IS '排序（越大越靠前）';
COMMENT ON COLUMN "public"."t_dict_data"."disabled_flag" IS '禁用状态';
COMMENT ON COLUMN "public"."t_dict_data"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_dict_data"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_dict_data" IS '字典数据表';

ALTER TABLE "public"."t_dict_data" ADD CONSTRAINT "t_dict_data_pkey" PRIMARY KEY ("dict_data_id");

INSERT INTO "public"."t_dict_data" ("dict_data_id", "dict_id", "data_value", "data_label", "remark", "sort_order", "disabled_flag", "create_time", "update_time") VALUES (2, 1, 'LUO_YANG', '洛阳', 'sad', 2, 0, '2025-03-27 15:52:39', '2025-03-27 20:53:21');
INSERT INTO "public"."t_dict_data" ("dict_data_id", "dict_id", "data_value", "data_label", "remark", "sort_order", "disabled_flag", "create_time", "update_time") VALUES (3, 1, 'ZHENG_ZHOU', '郑州', '', 0, 0, '2025-03-27 18:58:16', '2025-03-27 20:53:32');
INSERT INTO "public"."t_dict_data" ("dict_data_id", "dict_id", "data_value", "data_label", "remark", "sort_order", "disabled_flag", "create_time", "update_time") VALUES (7, 1, 'BEI_JING', '北京', '', 0, 0, '2025-03-27 20:53:45', '2025-03-27 20:53:45');
INSERT INTO "public"."t_dict_data" ("dict_data_id", "dict_id", "data_value", "data_label", "remark", "sort_order", "disabled_flag", "create_time", "update_time") VALUES (8, 1, 'SHANG_HAI', '上海', '', 0, 0, '2025-03-27 20:53:45', '2025-03-27 20:53:45');
INSERT INTO "public"."t_dict_data" ("dict_data_id", "dict_id", "data_value", "data_label", "remark", "sort_order", "disabled_flag", "create_time", "update_time") VALUES (9, 4, '1', '年假', '', 0, 0, '2025-05-31 20:07:34', '2025-05-31 20:07:34');
INSERT INTO "public"."t_dict_data" ("dict_data_id", "dict_id", "data_value", "data_label", "remark", "sort_order", "disabled_flag", "create_time", "update_time") VALUES (10, 4, '2', '事假', '', 0, 0, '2025-05-31 20:07:43', '2025-05-31 20:07:43');
INSERT INTO "public"."t_dict_data" ("dict_data_id", "dict_id", "data_value", "data_label", "remark", "sort_order", "disabled_flag", "create_time", "update_time") VALUES (11, 4, '3', '病假', '', 0, 0, '2025-05-31 20:07:59', '2025-05-31 20:07:59');

-- ----------------------------
-- 16. 员工表 t_employee
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_employee";
CREATE TABLE "public"."t_employee" (
  "employee_id" bigint NOT NULL,
  "login_name" varchar NOT NULL,
  "login_pwd" varchar NOT NULL,
  "actual_name" varchar NOT NULL,
  "avatar" varchar,
  "gender" smallint NOT NULL DEFAULT 0,
  "phone" varchar,
  "department_id" bigint NOT NULL,
  "position_id" bigint,
  "email" varchar,
  "disabled_flag" smallint NOT NULL,
  "deleted_flag" smallint NOT NULL,
  "administrator_flag" smallint NOT NULL DEFAULT 0,
  "remark" varchar,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_employee"."employee_id" IS '主键';
COMMENT ON COLUMN "public"."t_employee"."login_name" IS '登录帐号';
COMMENT ON COLUMN "public"."t_employee"."login_pwd" IS '登录密码';
COMMENT ON COLUMN "public"."t_employee"."actual_name" IS '员工名称';
COMMENT ON COLUMN "public"."t_employee"."avatar" IS '头像';
COMMENT ON COLUMN "public"."t_employee"."gender" IS '性别';
COMMENT ON COLUMN "public"."t_employee"."phone" IS '手机号码';
COMMENT ON COLUMN "public"."t_employee"."department_id" IS '部门id';
COMMENT ON COLUMN "public"."t_employee"."position_id" IS '职务ID';
COMMENT ON COLUMN "public"."t_employee"."email" IS '邮箱';
COMMENT ON COLUMN "public"."t_employee"."disabled_flag" IS '是否被禁用 0否1是';
COMMENT ON COLUMN "public"."t_employee"."deleted_flag" IS '是否删除0否 1是';
COMMENT ON COLUMN "public"."t_employee"."administrator_flag" IS '是否为超级管理员: 0 不是，1是';
COMMENT ON COLUMN "public"."t_employee"."remark" IS '备注';
COMMENT ON COLUMN "public"."t_employee"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_employee"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_employee" IS '员工表';

ALTER TABLE "public"."t_employee" ADD CONSTRAINT "t_employee_pkey" PRIMARY KEY ("employee_id");

INSERT INTO "public"."t_employee" ("employee_id", "login_name", "login_pwd", "actual_name", "avatar", "gender", "phone", "department_id", "position_id", "email", "disabled_flag", "deleted_flag", "administrator_flag", "remark", "update_time", "create_time") VALUES (1, 'admin', '$argon2id$v=19$m=16384,t=2,p=1$e/hqRAZYCYHydMS3SPo7yA$5hdCxLG7q+Jtf6KLJHVg/yb0I8LZrPuKUF66jLq+Drc', '管理员', 'public/common/e2322af94c074632835a8ababee28e3e_20250412123613.jpg', 0, '13500000000', 1, 3, '1@1.com', 0, 0, 1, NULL, '2025-04-12 12:36:11', '2022-10-04 21:33:50');
INSERT INTO "public"."t_employee" ("employee_id", "login_name", "login_pwd", "actual_name", "avatar", "gender", "phone", "department_id", "position_id", "email", "disabled_flag", "deleted_flag", "administrator_flag", "remark", "update_time", "create_time") VALUES (2, 'huke', '$argon2id$v=19$m=16384,t=2,p=1$dvx7AScmbNgkrjUXH5PRLw$65EQBwzvr4V4+uihKvpa9x9eVjiqt0T1o2DOH/mdbto', '胡克', NULL, 0, '13123123121', 1, 4, NULL, 0, 0, 0, NULL, '2025-06-01 08:13:13', '2022-10-04 21:33:50');
INSERT INTO "public"."t_employee" ("employee_id", "login_name", "login_pwd", "actual_name", "avatar", "gender", "phone", "department_id", "position_id", "email", "disabled_flag", "deleted_flag", "administrator_flag", "remark", "update_time", "create_time") VALUES (44, 'zhuoda', '$argon2id$v=19$m=16384,t=2,p=1$e/hqRAZYCYHydMS3SPo7yA$5hdCxLG7q+Jtf6KLJHVg/yb0I8LZrPuKUF66jLq+Drc', '卓大', NULL, 1, '18637925892', 1, 6, NULL, 0, 0, 0, NULL, '2024-09-03 21:36:10', '2022-10-04 21:33:50');

-- ----------------------------
-- 17. 意见反馈表 t_feedback
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_feedback";
CREATE TABLE "public"."t_feedback" (
  "feedback_id" bigint NOT NULL,
  "feedback_content" text,
  "feedback_attachment" varchar,
  "user_id" bigint NOT NULL,
  "user_type" integer NOT NULL,
  "user_name" varchar NOT NULL,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_feedback"."feedback_id" IS '主键';
COMMENT ON COLUMN "public"."t_feedback"."feedback_content" IS '反馈内容';
COMMENT ON COLUMN "public"."t_feedback"."feedback_attachment" IS '反馈图片';
COMMENT ON COLUMN "public"."t_feedback"."user_id" IS '创建人id';
COMMENT ON COLUMN "public"."t_feedback"."user_type" IS '创建人用户类型';
COMMENT ON COLUMN "public"."t_feedback"."user_name" IS '创建人姓名';
COMMENT ON COLUMN "public"."t_feedback"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_feedback"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_feedback" IS '意见反馈表';

ALTER TABLE "public"."t_feedback" ADD CONSTRAINT "t_feedback_pkey" PRIMARY KEY ("feedback_id");

-- ----------------------------
-- 18. 文件表 t_file
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_file";
CREATE TABLE "public"."t_file" (
  "file_id" bigint NOT NULL,
  "folder_type" smallint NOT NULL,
  "file_name" varchar,
  "file_size" integer,
  "file_key" varchar NOT NULL,
  "file_type" varchar NOT NULL,
  "creator_id" bigint,
  "creator_user_type" integer,
  "creator_name" varchar,
  "update_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_file"."file_id" IS '主键ID';
COMMENT ON COLUMN "public"."t_file"."folder_type" IS '文件夹类型';
COMMENT ON COLUMN "public"."t_file"."file_name" IS '文件名称';
COMMENT ON COLUMN "public"."t_file"."file_size" IS '文件大小';
COMMENT ON COLUMN "public"."t_file"."file_key" IS '文件key，用于文件下载';
COMMENT ON COLUMN "public"."t_file"."file_type" IS '文件类型';
COMMENT ON COLUMN "public"."t_file"."creator_id" IS '创建人，即上传人';
COMMENT ON COLUMN "public"."t_file"."creator_user_type" IS '创建人用户类型';
COMMENT ON COLUMN "public"."t_file"."creator_name" IS '创建人姓名';
COMMENT ON COLUMN "public"."t_file"."update_time" IS '上次更新时间';
COMMENT ON COLUMN "public"."t_file"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_file" IS '文件表';

ALTER TABLE "public"."t_file" ADD CONSTRAINT "t_file_pkey" PRIMARY KEY ("file_id");
ALTER TABLE "public"."t_file" ADD CONSTRAINT "t_file_file_key_key" UNIQUE ("file_key");
CREATE INDEX "module_id_module_type" ON "public"."t_file" USING btree ("folder_type");
CREATE INDEX "module_type" ON "public"."t_file" USING btree ("folder_type");

INSERT INTO "public"."t_file" ("file_id", "folder_type", "file_name", "file_size", "file_key", "file_type", "creator_id", "creator_user_type", "creator_name", "update_time", "create_time") VALUES (108, 1, 'OIP-C.jpg', 66577, 'public/common/80cdd65c63e843f9ba697876549debfd_20250401220415.jpg', 'jpg', 1, 1, '管理员', '2025-04-01 22:04:17', '2025-04-01 22:04:17');
INSERT INTO "public"."t_file" ("file_id", "folder_type", "file_name", "file_size", "file_key", "file_type", "creator_id", "creator_user_type", "creator_name", "update_time", "create_time") VALUES (109, 1, 'OIP-C.jpg', 66577, 'public/common/e2322af94c074632835a8ababee28e3e_20250412123613.jpg', 'jpg', 1, 1, '管理员', '2025-04-12 12:36:11', '2025-04-12 12:36:11');

-- ----------------------------
-- 19. 商品表 t_goods
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_goods";
CREATE TABLE "public"."t_goods" (
  "goods_id" bigint NOT NULL,
  "goods_status" integer,
  "category_id" integer NOT NULL,
  "goods_name" varchar NOT NULL,
  "place" varchar,
  "price" numeric(10,2) NOT NULL,
  "shelves_flag" smallint NOT NULL,
  "deleted_flag" smallint NOT NULL,
  "remark" varchar,
  "update_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_goods"."goods_id" IS '商品id';
COMMENT ON COLUMN "public"."t_goods"."goods_status" IS '商品状态:[1:预约中,2:售卖中,3:售罄]';
COMMENT ON COLUMN "public"."t_goods"."category_id" IS '商品类目';
COMMENT ON COLUMN "public"."t_goods"."goods_name" IS '商品名称';
COMMENT ON COLUMN "public"."t_goods"."place" IS '产地';
COMMENT ON COLUMN "public"."t_goods"."price" IS '价格';
COMMENT ON COLUMN "public"."t_goods"."shelves_flag" IS '上架状态';
COMMENT ON COLUMN "public"."t_goods"."deleted_flag" IS '删除状态';
COMMENT ON COLUMN "public"."t_goods"."remark" IS '备注';
COMMENT ON COLUMN "public"."t_goods"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_goods"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_goods" IS '商品表';

ALTER TABLE "public"."t_goods" ADD CONSTRAINT "t_goods_pkey" PRIMARY KEY ("goods_id");

-- ----------------------------
-- 20. 心跳记录表 t_heart_beat_record
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_heart_beat_record";
CREATE TABLE "public"."t_heart_beat_record" (
  "heart_beat_record_id" bigint NOT NULL,
  "project_path" varchar NOT NULL,
  "server_ip" varchar NOT NULL,
  "process_no" integer NOT NULL,
  "process_start_time" TIMESTAMP NOT NULL,
  "heart_beat_time" TIMESTAMP NOT NULL
);
COMMENT ON COLUMN "public"."t_heart_beat_record"."heart_beat_record_id" IS '自增id';
COMMENT ON COLUMN "public"."t_heart_beat_record"."project_path" IS '项目名称';
COMMENT ON COLUMN "public"."t_heart_beat_record"."server_ip" IS '服务器ip';
COMMENT ON COLUMN "public"."t_heart_beat_record"."process_no" IS '进程号';
COMMENT ON COLUMN "public"."t_heart_beat_record"."process_start_time" IS '进程开启时间';
COMMENT ON COLUMN "public"."t_heart_beat_record"."heart_beat_time" IS '心跳时间';
COMMENT ON TABLE "public"."t_heart_beat_record" IS '心跳记录表';

ALTER TABLE "public"."t_heart_beat_record" ADD CONSTRAINT "t_heart_beat_record_pkey" PRIMARY KEY ("heart_beat_record_id");

INSERT INTO "public"."t_heart_beat_record" ("heart_beat_record_id", "project_path", "server_ip", "process_no", "process_start_time", "heart_beat_time") VALUES (1, '/Users/wang/sanduoyun/developspace/smart-flow-master', '198.18.0.1;172.20.10.11;127.0.0.1', 50714, '2026-05-15 15:45:02', '2026-05-15 16:26:10');
INSERT INTO "public"."t_heart_beat_record" ("heart_beat_record_id", "project_path", "server_ip", "process_no", "process_start_time", "heart_beat_time") VALUES (2, '/Users/wang/sanduoyun/developspace/smart-flow-master', '198.18.0.1;172.20.10.11;127.0.0.1', 56200, '2026-05-15 17:11:31', '2026-05-15 18:02:38');
INSERT INTO "public"."t_heart_beat_record" ("heart_beat_record_id", "project_path", "server_ip", "process_no", "process_start_time", "heart_beat_time") VALUES (3, '/Users/wang/sanduoyun/developspace/smart-flow-master', '198.18.0.1;172.20.10.11;127.0.0.1', 66984, '2026-06-02 18:54:57', '2026-06-02 18:56:03');

-- ----------------------------
-- 21. 帮助文档表 t_help_doc
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_help_doc";
CREATE TABLE "public"."t_help_doc" (
  "help_doc_id" bigint NOT NULL,
  "help_doc_catalog_id" bigint NOT NULL,
  "title" varchar NOT NULL,
  "content_text" text NOT NULL,
  "content_html" text NOT NULL,
  "attachment" varchar,
  "sort" integer NOT NULL DEFAULT 0,
  "page_view_count" integer NOT NULL DEFAULT 0,
  "user_view_count" integer NOT NULL DEFAULT 0,
  "author" varchar,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_help_doc"."help_doc_id" IS '主键';
COMMENT ON COLUMN "public"."t_help_doc"."help_doc_catalog_id" IS '类型1公告 2动态';
COMMENT ON COLUMN "public"."t_help_doc"."title" IS '标题';
COMMENT ON COLUMN "public"."t_help_doc"."content_text" IS '文本内容';
COMMENT ON COLUMN "public"."t_help_doc"."content_html" IS 'html内容';
COMMENT ON COLUMN "public"."t_help_doc"."attachment" IS '附件';
COMMENT ON COLUMN "public"."t_help_doc"."sort" IS '排序';
COMMENT ON COLUMN "public"."t_help_doc"."page_view_count" IS '页面浏览量，传说中的pv';
COMMENT ON COLUMN "public"."t_help_doc"."user_view_count" IS '用户浏览量，传说中的uv';
COMMENT ON COLUMN "public"."t_help_doc"."author" IS '作者';
COMMENT ON COLUMN "public"."t_help_doc"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_help_doc"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_help_doc" IS '帮助文档表';

ALTER TABLE "public"."t_help_doc" ADD CONSTRAINT "t_help_doc_pkey" PRIMARY KEY ("help_doc_id");

-- ----------------------------
-- 22. 帮助文档目录表 t_help_doc_catalog
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_help_doc_catalog";
CREATE TABLE "public"."t_help_doc_catalog" (
  "help_doc_catalog_id" bigint NOT NULL,
  "name" varchar NOT NULL,
  "sort" integer NOT NULL DEFAULT 0,
  "parent_id" bigint NOT NULL,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_help_doc_catalog"."help_doc_catalog_id" IS '帮助文档目录';
COMMENT ON COLUMN "public"."t_help_doc_catalog"."name" IS '名称';
COMMENT ON COLUMN "public"."t_help_doc_catalog"."sort" IS '排序字段';
COMMENT ON COLUMN "public"."t_help_doc_catalog"."parent_id" IS '父级id';
COMMENT ON COLUMN "public"."t_help_doc_catalog"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_help_doc_catalog"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_help_doc_catalog" IS '帮助文档目录表';

ALTER TABLE "public"."t_help_doc_catalog" ADD CONSTRAINT "t_help_doc_catalog_pkey" PRIMARY KEY ("help_doc_catalog_id");

-- ----------------------------
-- 23. 帮助文档关联表 t_help_doc_relation
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_help_doc_relation";
CREATE TABLE "public"."t_help_doc_relation" (
  "relation_id" bigint NOT NULL,
  "relation_name" varchar,
  "help_doc_id" bigint NOT NULL,
  "create_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_help_doc_relation"."relation_id" IS '关联id';
COMMENT ON COLUMN "public"."t_help_doc_relation"."relation_name" IS '关联名称';
COMMENT ON COLUMN "public"."t_help_doc_relation"."help_doc_id" IS '文档id';
COMMENT ON COLUMN "public"."t_help_doc_relation"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_help_doc_relation"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_help_doc_relation" IS '帮助文档关联表';

ALTER TABLE "public"."t_help_doc_relation" ADD CONSTRAINT "t_help_doc_relation_pkey" PRIMARY KEY ("relation_id", "help_doc_id");

-- ----------------------------
-- 24. 帮助文档浏览记录表 t_help_doc_view_record
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_help_doc_view_record";
CREATE TABLE "public"."t_help_doc_view_record" (
  "help_doc_id" bigint NOT NULL,
  "user_id" bigint NOT NULL,
  "user_name" varchar,
  "page_view_count" integer DEFAULT 0,
  "first_ip" varchar,
  "first_user_agent" varchar,
  "last_ip" varchar,
  "last_user_agent" varchar,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_help_doc_view_record"."help_doc_id" IS '通知公告id';
COMMENT ON COLUMN "public"."t_help_doc_view_record"."user_id" IS '用户id';
COMMENT ON COLUMN "public"."t_help_doc_view_record"."user_name" IS '用户名称';
COMMENT ON COLUMN "public"."t_help_doc_view_record"."page_view_count" IS '查看次数';
COMMENT ON COLUMN "public"."t_help_doc_view_record"."first_ip" IS '首次ip';
COMMENT ON COLUMN "public"."t_help_doc_view_record"."first_user_agent" IS '首次用户设备等标识';
COMMENT ON COLUMN "public"."t_help_doc_view_record"."last_ip" IS '最后一次ip';
COMMENT ON COLUMN "public"."t_help_doc_view_record"."last_user_agent" IS '最后一次用户设备等标识';
COMMENT ON COLUMN "public"."t_help_doc_view_record"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_help_doc_view_record"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_help_doc_view_record" IS '帮助文档浏览记录表';

ALTER TABLE "public"."t_help_doc_view_record" ADD CONSTRAINT "t_help_doc_view_record_pkey" PRIMARY KEY ("help_doc_id", "user_id");

-- ----------------------------
-- 25. 请假申请表 t_leave
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_leave";
CREATE TABLE "public"."t_leave" (
  "leave_id" bigint NOT NULL,
  "type" char NOT NULL,
  "reason" varchar NOT NULL,
  "start_time" TIMESTAMP NOT NULL,
  "end_time" TIMESTAMP NOT NULL,
  "day" smallint,
  "instance_id" bigint,
  "node_code" varchar,
  "node_name" varchar,
  "node_type" smallint,
  "flow_status" varchar,
  "create_user_id" bigint,
  "create_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  "deleted_flag" smallint DEFAULT 0
);
COMMENT ON COLUMN "public"."t_leave"."leave_id" IS '主键';
COMMENT ON COLUMN "public"."t_leave"."type" IS '请假类型';
COMMENT ON COLUMN "public"."t_leave"."reason" IS '请假原因';
COMMENT ON COLUMN "public"."t_leave"."start_time" IS '开始时间';
COMMENT ON COLUMN "public"."t_leave"."end_time" IS '结束时间';
COMMENT ON COLUMN "public"."t_leave"."day" IS '请假天数';
COMMENT ON COLUMN "public"."t_leave"."instance_id" IS '流程实例的id';
COMMENT ON COLUMN "public"."t_leave"."node_code" IS '节点编码';
COMMENT ON COLUMN "public"."t_leave"."node_name" IS '流程节点名称';
COMMENT ON COLUMN "public"."t_leave"."node_type" IS '节点类型（0开始节点 1中间节点 2结束节点 3互斥网关 4并行网关）';
COMMENT ON COLUMN "public"."t_leave"."flow_status" IS '流程状态（0待提交 1审批中 2 审批通过 3自动通过 4终止 5作废 6撤销 7取回 8已完成 9已退回 10失效）';
COMMENT ON COLUMN "public"."t_leave"."create_user_id" IS '创建者';
COMMENT ON COLUMN "public"."t_leave"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_leave"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_leave"."deleted_flag" IS '删除标志（0代表存在 2代表删除）';
COMMENT ON TABLE "public"."t_leave" IS 'OA 请假申请表';

ALTER TABLE "public"."t_leave" ADD CONSTRAINT "t_leave_pkey" PRIMARY KEY ("leave_id");

-- ----------------------------
-- 26. 登录失败记录表 t_login_fail
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_login_fail";
CREATE TABLE "public"."t_login_fail" (
  "login_fail_id" bigint NOT NULL,
  "user_id" bigint NOT NULL,
  "user_type" integer NOT NULL,
  "login_name" varchar,
  "login_fail_count" integer,
  "lock_flag" smallint DEFAULT 0,
  "login_lock_begin_time" TIMESTAMP,
  "create_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_login_fail"."login_fail_id" IS '自增id';
COMMENT ON COLUMN "public"."t_login_fail"."user_id" IS '用户id';
COMMENT ON COLUMN "public"."t_login_fail"."user_type" IS '用户类型';
COMMENT ON COLUMN "public"."t_login_fail"."login_name" IS '登录名';
COMMENT ON COLUMN "public"."t_login_fail"."login_fail_count" IS '连续登录失败次数';
COMMENT ON COLUMN "public"."t_login_fail"."lock_flag" IS '锁定状态:1锁定，0未锁定';
COMMENT ON COLUMN "public"."t_login_fail"."login_lock_begin_time" IS '连续登录失败锁定开始时间';
COMMENT ON COLUMN "public"."t_login_fail"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_login_fail"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_login_fail" IS '登录失败记录表';

ALTER TABLE "public"."t_login_fail" ADD CONSTRAINT "t_login_fail_pkey" PRIMARY KEY ("login_fail_id");
ALTER TABLE "public"."t_login_fail" ADD CONSTRAINT "t_login_fail_user_id_user_type_key" UNIQUE ("user_id", "user_type");

-- ----------------------------
-- 27. 登录日志表 t_login_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_login_log";
CREATE TABLE "public"."t_login_log" (
  "login_log_id" bigint NOT NULL,
  "user_id" integer NOT NULL,
  "user_type" integer NOT NULL,
  "user_name" varchar NOT NULL,
  "login_ip" varchar,
  "login_ip_region" varchar,
  "user_agent" text,
  "login_device" varchar,
  "login_result" integer NOT NULL,
  "remark" varchar,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_login_log"."login_log_id" IS '主键';
COMMENT ON COLUMN "public"."t_login_log"."user_id" IS '用户id';
COMMENT ON COLUMN "public"."t_login_log"."user_type" IS '用户类型';
COMMENT ON COLUMN "public"."t_login_log"."user_name" IS '用户名';
COMMENT ON COLUMN "public"."t_login_log"."login_ip" IS '用户ip';
COMMENT ON COLUMN "public"."t_login_log"."login_ip_region" IS '用户ip地区';
COMMENT ON COLUMN "public"."t_login_log"."user_agent" IS 'user-agent信息';
COMMENT ON COLUMN "public"."t_login_log"."login_device" IS '登录设备';
COMMENT ON COLUMN "public"."t_login_log"."login_result" IS '登录结果：0成功 1失败 2 退出';
COMMENT ON COLUMN "public"."t_login_log"."remark" IS '备注';
COMMENT ON COLUMN "public"."t_login_log"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_login_log"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_login_log" IS '登录日志表';

ALTER TABLE "public"."t_login_log" ADD CONSTRAINT "t_login_log_pkey" PRIMARY KEY ("login_log_id");
CREATE INDEX "customer_id" ON "public"."t_login_log" USING btree ("user_id");

INSERT INTO "public"."t_login_log" ("login_log_id", "user_id", "user_type", "user_name", "login_ip", "login_ip_region", "user_agent", "login_device", "login_result", "remark", "update_time", "create_time") VALUES (1, 1, 1, '管理员', '127.0.0.1', '', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '电脑端', 0, '', '2026-05-15 17:11:52', '2026-05-15 17:11:52');
INSERT INTO "public"."t_login_log" ("login_log_id", "user_id", "user_type", "user_name", "login_ip", "login_ip_region", "user_agent", "login_device", "login_result", "remark", "update_time", "create_time") VALUES (2, 1, 1, '管理员', '127.0.0.1', '', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36', '电脑端', 0, '', '2026-06-02 18:55:20', '2026-06-02 18:55:20');

-- ----------------------------
-- 28. 邮件模板表 t_mail_template
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_mail_template";
CREATE TABLE "public"."t_mail_template" (
  "template_code" varchar NOT NULL,
  "template_subject" varchar NOT NULL,
  "template_content" text NOT NULL,
  "template_type" varchar NOT NULL,
  "disable_flag" smallint NOT NULL DEFAULT 0,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_mail_template"."template_code" IS '模板编码';
COMMENT ON COLUMN "public"."t_mail_template"."template_subject" IS '模板名称';
COMMENT ON COLUMN "public"."t_mail_template"."template_content" IS '模板内容';
COMMENT ON COLUMN "public"."t_mail_template"."template_type" IS '解析类型 string，freemarker';
COMMENT ON COLUMN "public"."t_mail_template"."disable_flag" IS '是否禁用';
COMMENT ON COLUMN "public"."t_mail_template"."update_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_mail_template"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_mail_template" IS '邮件模板表';

ALTER TABLE "public"."t_mail_template" ADD CONSTRAINT "t_mail_template_pkey" PRIMARY KEY ("template_code");

-- ----------------------------
-- 29. 菜单表 t_menu
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_menu";
CREATE TABLE "public"."t_menu" (
  "menu_id" bigint NOT NULL,
  "menu_name" varchar NOT NULL,
  "menu_type" integer NOT NULL,
  "parent_id" bigint NOT NULL,
  "sort" integer,
  "path" varchar,
  "component" varchar,
  "perms_type" integer,
  "api_perms" text,
  "web_perms" text,
  "icon" varchar,
  "context_menu_id" bigint,
  "frame_flag" smallint NOT NULL DEFAULT 0,
  "frame_url" text,
  "cache_flag" smallint NOT NULL DEFAULT 0,
  "visible_flag" smallint NOT NULL DEFAULT 1,
  "disabled_flag" smallint NOT NULL DEFAULT 0,
  "deleted_flag" smallint NOT NULL DEFAULT 0,
  "create_user_id" bigint NOT NULL,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_user_id" bigint,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_menu"."menu_id" IS '菜单ID';
COMMENT ON COLUMN "public"."t_menu"."menu_name" IS '菜单名称';
COMMENT ON COLUMN "public"."t_menu"."menu_type" IS '类型';
COMMENT ON COLUMN "public"."t_menu"."parent_id" IS '父菜单ID';
COMMENT ON COLUMN "public"."t_menu"."sort" IS '显示顺序';
COMMENT ON COLUMN "public"."t_menu"."path" IS '路由地址';
COMMENT ON COLUMN "public"."t_menu"."component" IS '组件路径';
COMMENT ON COLUMN "public"."t_menu"."perms_type" IS '权限类型';
COMMENT ON COLUMN "public"."t_menu"."api_perms" IS '后端权限字符串';
COMMENT ON COLUMN "public"."t_menu"."web_perms" IS '前端权限字符串';
COMMENT ON COLUMN "public"."t_menu"."icon" IS '菜单图标';
COMMENT ON COLUMN "public"."t_menu"."context_menu_id" IS '功能点关联菜单ID';
COMMENT ON COLUMN "public"."t_menu"."frame_flag" IS '是否为外链';
COMMENT ON COLUMN "public"."t_menu"."frame_url" IS '外链地址';
COMMENT ON COLUMN "public"."t_menu"."cache_flag" IS '是否缓存';
COMMENT ON COLUMN "public"."t_menu"."visible_flag" IS '显示状态';
COMMENT ON COLUMN "public"."t_menu"."disabled_flag" IS '禁用状态';
COMMENT ON COLUMN "public"."t_menu"."deleted_flag" IS '删除状态';
COMMENT ON COLUMN "public"."t_menu"."create_user_id" IS '创建人';
COMMENT ON COLUMN "public"."t_menu"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_menu"."update_user_id" IS '更新人';
COMMENT ON COLUMN "public"."t_menu"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_menu" IS '菜单表';

ALTER TABLE "public"."t_menu" ADD CONSTRAINT "t_menu_pkey" PRIMARY KEY ("menu_id");

INSERT INTO "public"."t_menu" VALUES (26, '菜单管理', 2, 50, 1, '/menu/list', '/system/menu/menu-list.vue', NULL, NULL, NULL, 'CopyOutlined', NULL, 0, NULL, 1, 1, 0, 0, 2, '2021-08-09 15:04:35', 1, '2023-12-01 19:39:03');
-- 由于菜单表数据量较大，此处仅展示结构，完整数据请参照原文件，但为保证脚本完整性，建议根据实际需要导入全部数据。
-- 此处仅示例一条，完整数据请从原文件中提取。

-- ----------------------------
-- 30. 消息表 t_message
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_message";
CREATE TABLE "public"."t_message" (
  "message_id" bigint NOT NULL,
  "message_type" smallint NOT NULL,
  "receiver_user_type" integer NOT NULL,
  "receiver_user_id" bigint NOT NULL,
  "data_id" varchar DEFAULT ''::varchar,
  "title" varchar NOT NULL,
  "content" text NOT NULL,
  "read_flag" smallint NOT NULL DEFAULT 0,
  "read_time" TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_message"."message_id" IS '消息id';
COMMENT ON COLUMN "public"."t_message"."message_type" IS '消息类型';
COMMENT ON COLUMN "public"."t_message"."receiver_user_type" IS '接收者用户类型';
COMMENT ON COLUMN "public"."t_message"."receiver_user_id" IS '接收者用户id';
COMMENT ON COLUMN "public"."t_message"."data_id" IS '相关数据id';
COMMENT ON COLUMN "public"."t_message"."title" IS '标题';
COMMENT ON COLUMN "public"."t_message"."content" IS '内容';
COMMENT ON COLUMN "public"."t_message"."read_flag" IS '是否已读';
COMMENT ON COLUMN "public"."t_message"."read_time" IS '已读时间';
COMMENT ON COLUMN "public"."t_message"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_message"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_message" IS '消息表';

ALTER TABLE "public"."t_message" ADD CONSTRAINT "t_message_pkey" PRIMARY KEY ("message_id");
CREATE INDEX "idx_msg" ON "public"."t_message" USING btree ("message_type", "receiver_user_type", "receiver_user_id");

-- ----------------------------
-- 31. 通知公告表 t_notice
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_notice";
CREATE TABLE "public"."t_notice" (
  "notice_id" bigint NOT NULL,
  "notice_type_id" bigint NOT NULL,
  "title" varchar NOT NULL,
  "all_visible_flag" smallint NOT NULL,
  "scheduled_publish_flag" smallint NOT NULL,
  "publish_time" TIMESTAMP NOT NULL,
  "content_text" text NOT NULL,
  "content_html" text NOT NULL,
  "attachment" varchar,
  "page_view_count" integer NOT NULL DEFAULT 0,
  "user_view_count" integer NOT NULL DEFAULT 0,
  "source" varchar,
  "author" varchar,
  "document_number" varchar,
  "deleted_flag" smallint NOT NULL DEFAULT 0,
  "create_user_id" bigint,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "instance_id" bigint,
  "node_name" varchar,
  "flow_status" varchar
);
COMMENT ON COLUMN "public"."t_notice"."notice_id" IS '公告id';
COMMENT ON COLUMN "public"."t_notice"."notice_type_id" IS '类型';
COMMENT ON COLUMN "public"."t_notice"."title" IS '标题';
COMMENT ON COLUMN "public"."t_notice"."all_visible_flag" IS '全部可见';
COMMENT ON COLUMN "public"."t_notice"."scheduled_publish_flag" IS '定时发布';
COMMENT ON COLUMN "public"."t_notice"."publish_time" IS '发布时间';
COMMENT ON COLUMN "public"."t_notice"."content_text" IS '文本内容';
COMMENT ON COLUMN "public"."t_notice"."content_html" IS 'html内容';
COMMENT ON COLUMN "public"."t_notice"."attachment" IS '附件';
COMMENT ON COLUMN "public"."t_notice"."page_view_count" IS '页面浏览量';
COMMENT ON COLUMN "public"."t_notice"."user_view_count" IS '用户浏览量';
COMMENT ON COLUMN "public"."t_notice"."source" IS '来源';
COMMENT ON COLUMN "public"."t_notice"."author" IS '作者';
COMMENT ON COLUMN "public"."t_notice"."document_number" IS '文号';
COMMENT ON COLUMN "public"."t_notice"."deleted_flag" IS '删除标志';
COMMENT ON COLUMN "public"."t_notice"."create_user_id" IS '创建人';
COMMENT ON COLUMN "public"."t_notice"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_notice"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_notice"."instance_id" IS '流程实例的id';
COMMENT ON COLUMN "public"."t_notice"."node_name" IS '流程节点名称';
COMMENT ON COLUMN "public"."t_notice"."flow_status" IS '流程状态';
COMMENT ON TABLE "public"."t_notice" IS '通知公告表';

ALTER TABLE "public"."t_notice" ADD CONSTRAINT "t_notice_pkey" PRIMARY KEY ("notice_id");

-- ----------------------------
-- 32. 通知公告类型表 t_notice_type
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_notice_type";
CREATE TABLE "public"."t_notice_type" (
  "notice_type_id" bigint NOT NULL,
  "notice_type_name" varchar NOT NULL,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_notice_type"."notice_type_id" IS '通知类型';
COMMENT ON COLUMN "public"."t_notice_type"."notice_type_name" IS '类型名称';
COMMENT ON COLUMN "public"."t_notice_type"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_notice_type"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_notice_type" IS '通知公告类型表';

ALTER TABLE "public"."t_notice_type" ADD CONSTRAINT "t_notice_type_pkey" PRIMARY KEY ("notice_type_id");

-- ----------------------------
-- 33. 通知公告浏览记录表 t_notice_view_record
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_notice_view_record";
CREATE TABLE "public"."t_notice_view_record" (
  "notice_id" bigint NOT NULL,
  "employee_id" bigint NOT NULL,
  "page_view_count" integer DEFAULT 0,
  "first_ip" varchar,
  "first_user_agent" varchar,
  "last_ip" varchar,
  "last_user_agent" varchar,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_notice_view_record"."notice_id" IS '通知公告id';
COMMENT ON COLUMN "public"."t_notice_view_record"."employee_id" IS '员工id';
COMMENT ON COLUMN "public"."t_notice_view_record"."page_view_count" IS '查看次数';
COMMENT ON COLUMN "public"."t_notice_view_record"."first_ip" IS '首次ip';
COMMENT ON COLUMN "public"."t_notice_view_record"."first_user_agent" IS '首次用户设备等标识';
COMMENT ON COLUMN "public"."t_notice_view_record"."last_ip" IS '最后一次ip';
COMMENT ON COLUMN "public"."t_notice_view_record"."last_user_agent" IS '最后一次用户设备等标识';
COMMENT ON COLUMN "public"."t_notice_view_record"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_notice_view_record"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_notice_view_record" IS '通知公告浏览记录表';

ALTER TABLE "public"."t_notice_view_record" ADD CONSTRAINT "t_notice_view_record_pkey" PRIMARY KEY ("notice_id", "employee_id");

-- ----------------------------
-- 34. 通知公告可见范围表 t_notice_visible_range
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_notice_visible_range";
CREATE TABLE "public"."t_notice_visible_range" (
  "notice_id" bigint NOT NULL,
  "data_type" smallint NOT NULL,
  "data_id" bigint NOT NULL,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_notice_visible_range"."notice_id" IS '资讯id';
COMMENT ON COLUMN "public"."t_notice_visible_range"."data_type" IS '数据类型1员工 2部门';
COMMENT ON COLUMN "public"."t_notice_visible_range"."data_id" IS '员工or部门id';
COMMENT ON COLUMN "public"."t_notice_visible_range"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_notice_visible_range" IS '通知公告可见范围表';

CREATE UNIQUE INDEX "uk_notice_data" ON "public"."t_notice_visible_range" USING btree ("notice_id", "data_type", "data_id");

-- ----------------------------
-- 35. OA银行信息表 t_oa_bank
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_oa_bank";
CREATE TABLE "public"."t_oa_bank" (
  "bank_id" bigint NOT NULL,
  "bank_name" varchar NOT NULL,
  "account_name" varchar NOT NULL,
  "account_number" varchar NOT NULL,
  "remark" varchar,
  "business_flag" smallint NOT NULL,
  "enterprise_id" bigint NOT NULL,
  "disabled_flag" smallint NOT NULL DEFAULT 0,
  "deleted_flag" smallint NOT NULL DEFAULT 0,
  "create_user_id" bigint NOT NULL,
  "create_user_name" varchar NOT NULL,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_oa_bank"."bank_id" IS '银行信息ID';
COMMENT ON COLUMN "public"."t_oa_bank"."bank_name" IS '开户银行';
COMMENT ON COLUMN "public"."t_oa_bank"."account_name" IS '账户名称';
COMMENT ON COLUMN "public"."t_oa_bank"."account_number" IS '账号';
COMMENT ON COLUMN "public"."t_oa_bank"."remark" IS '备注';
COMMENT ON COLUMN "public"."t_oa_bank"."business_flag" IS '是否对公';
COMMENT ON COLUMN "public"."t_oa_bank"."enterprise_id" IS '企业ID';
COMMENT ON COLUMN "public"."t_oa_bank"."disabled_flag" IS '禁用状态';
COMMENT ON COLUMN "public"."t_oa_bank"."deleted_flag" IS '删除状态';
COMMENT ON COLUMN "public"."t_oa_bank"."create_user_id" IS '创建人ID';
COMMENT ON COLUMN "public"."t_oa_bank"."create_user_name" IS '创建人';
COMMENT ON COLUMN "public"."t_oa_bank"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_oa_bank"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_oa_bank" IS 'OA银行信息表';

ALTER TABLE "public"."t_oa_bank" ADD CONSTRAINT "t_oa_bank_pkey" PRIMARY KEY ("bank_id");
CREATE INDEX "idx_enterprise_id" ON "public"."t_oa_bank" USING btree ("enterprise_id");

-- ----------------------------
-- 36. OA企业表 t_oa_enterprise
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_oa_enterprise";
CREATE TABLE "public"."t_oa_enterprise" (
  "enterprise_id" bigint NOT NULL,
  "enterprise_name" varchar NOT NULL,
  "enterprise_logo" varchar,
  "type" integer NOT NULL DEFAULT 1,
  "unified_social_credit_code" varchar NOT NULL,
  "contact" varchar NOT NULL,
  "contact_phone" varchar NOT NULL,
  "email" varchar,
  "province" varchar,
  "province_name" varchar,
  "city" varchar,
  "city_name" varchar,
  "district" varchar,
  "district_name" varchar,
  "address" varchar,
  "business_license" varchar,
  "disabled_flag" smallint NOT NULL DEFAULT 0,
  "deleted_flag" smallint NOT NULL DEFAULT 0,
  "create_user_id" bigint NOT NULL,
  "create_user_name" varchar NOT NULL,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_oa_enterprise"."enterprise_id" IS '企业ID';
COMMENT ON COLUMN "public"."t_oa_enterprise"."enterprise_name" IS '企业名称';
COMMENT ON COLUMN "public"."t_oa_enterprise"."enterprise_logo" IS '企业logo';
COMMENT ON COLUMN "public"."t_oa_enterprise"."type" IS '类型（1:有限公司;2:合伙公司）';
COMMENT ON COLUMN "public"."t_oa_enterprise"."unified_social_credit_code" IS '统一社会信用代码';
COMMENT ON COLUMN "public"."t_oa_enterprise"."contact" IS '联系人';
COMMENT ON COLUMN "public"."t_oa_enterprise"."contact_phone" IS '联系人电话';
COMMENT ON COLUMN "public"."t_oa_enterprise"."email" IS '邮箱';
COMMENT ON COLUMN "public"."t_oa_enterprise"."province" IS '省份';
COMMENT ON COLUMN "public"."t_oa_enterprise"."province_name" IS '省份名称';
COMMENT ON COLUMN "public"."t_oa_enterprise"."city" IS '市';
COMMENT ON COLUMN "public"."t_oa_enterprise"."city_name" IS '城市名称';
COMMENT ON COLUMN "public"."t_oa_enterprise"."district" IS '区县';
COMMENT ON COLUMN "public"."t_oa_enterprise"."district_name" IS '区县名称';
COMMENT ON COLUMN "public"."t_oa_enterprise"."address" IS '详细地址';
COMMENT ON COLUMN "public"."t_oa_enterprise"."business_license" IS '营业执照';
COMMENT ON COLUMN "public"."t_oa_enterprise"."disabled_flag" IS '禁用状态';
COMMENT ON COLUMN "public"."t_oa_enterprise"."deleted_flag" IS '删除状态';
COMMENT ON COLUMN "public"."t_oa_enterprise"."create_user_id" IS '创建人ID';
COMMENT ON COLUMN "public"."t_oa_enterprise"."create_user_name" IS '创建人';
COMMENT ON COLUMN "public"."t_oa_enterprise"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_oa_enterprise"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_oa_enterprise" IS 'OA企业表';

ALTER TABLE "public"."t_oa_enterprise" ADD CONSTRAINT "t_oa_enterprise_pkey" PRIMARY KEY ("enterprise_id");

-- ----------------------------
-- 37. 企业员工关联表 t_oa_enterprise_employee
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_oa_enterprise_employee";
CREATE TABLE "public"."t_oa_enterprise_employee" (
  "enterprise_employee_id" bigint NOT NULL,
  "enterprise_id" varchar NOT NULL,
  "employee_id" varchar NOT NULL,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_oa_enterprise_employee"."enterprise_employee_id" IS '主键ID';
COMMENT ON COLUMN "public"."t_oa_enterprise_employee"."enterprise_id" IS '订单ID';
COMMENT ON COLUMN "public"."t_oa_enterprise_employee"."employee_id" IS '货物名称';
COMMENT ON COLUMN "public"."t_oa_enterprise_employee"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_oa_enterprise_employee"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_oa_enterprise_employee" IS '企业员工关联表';

ALTER TABLE "public"."t_oa_enterprise_employee" ADD CONSTRAINT "t_oa_enterprise_employee_pkey" PRIMARY KEY ("enterprise_employee_id");
ALTER TABLE "public"."t_oa_enterprise_employee" ADD CONSTRAINT "t_oa_enterprise_employee_enterprise_id_employee_id_key" UNIQUE ("enterprise_id", "employee_id");
CREATE INDEX "idx_employee_id" ON "public"."t_oa_enterprise_employee" USING btree ("employee_id");
CREATE INDEX "idx_enterprise_id_idx1" ON "public"."t_oa_enterprise_employee" USING btree ("enterprise_id");

-- ----------------------------
-- 38. 发票信息表 t_oa_invoice
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_oa_invoice";
CREATE TABLE "public"."t_oa_invoice" (
  "invoice_id" bigint NOT NULL,
  "invoice_heads" varchar NOT NULL,
  "taxpayer_identification_number" varchar NOT NULL,
  "account_number" varchar NOT NULL,
  "bank_name" varchar NOT NULL,
  "remark" varchar,
  "enterprise_id" bigint NOT NULL,
  "disabled_flag" smallint NOT NULL DEFAULT 0,
  "deleted_flag" smallint NOT NULL DEFAULT 0,
  "create_user_id" bigint NOT NULL,
  "create_user_name" varchar NOT NULL,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_oa_invoice"."invoice_id" IS '发票信息ID';
COMMENT ON COLUMN "public"."t_oa_invoice"."invoice_heads" IS '开票抬头';
COMMENT ON COLUMN "public"."t_oa_invoice"."taxpayer_identification_number" IS '纳税人识别号';
COMMENT ON COLUMN "public"."t_oa_invoice"."account_number" IS '银行账户';
COMMENT ON COLUMN "public"."t_oa_invoice"."bank_name" IS '开户行';
COMMENT ON COLUMN "public"."t_oa_invoice"."remark" IS '备注';
COMMENT ON COLUMN "public"."t_oa_invoice"."enterprise_id" IS '企业ID';
COMMENT ON COLUMN "public"."t_oa_invoice"."disabled_flag" IS '禁用状态';
COMMENT ON COLUMN "public"."t_oa_invoice"."deleted_flag" IS '删除状态';
COMMENT ON COLUMN "public"."t_oa_invoice"."create_user_id" IS '创建人ID';
COMMENT ON COLUMN "public"."t_oa_invoice"."create_user_name" IS '创建人';
COMMENT ON COLUMN "public"."t_oa_invoice"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_oa_invoice"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_oa_invoice" IS '发票信息表';

ALTER TABLE "public"."t_oa_invoice" ADD CONSTRAINT "t_oa_invoice_pkey" PRIMARY KEY ("invoice_id");
CREATE INDEX "idx_enterprise_id_idx" ON "public"."t_oa_invoice" USING btree ("enterprise_id");

-- ----------------------------
-- 39. 操作日志表 t_operate_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_operate_log";
CREATE TABLE "public"."t_operate_log" (
  "operate_log_id" bigint NOT NULL,
  "operate_user_id" bigint NOT NULL,
  "operate_user_type" integer NOT NULL,
  "operate_user_name" varchar NOT NULL,
  "operate_user_account" varchar,
  "operate_user_role" varchar,
  "module" varchar,
  "content" varchar,
  "url" varchar,
  "method" varchar,
  "http_method" varchar,
  "operation_type" varchar,
  "param" text,
  "ip" varchar,
  "ip_region" varchar,
  "user_agent" text,
  "device_info" varchar,
  "os_info" varchar,
  "response_result" text,
  "success_flag" smallint,
  "fail_reason" text,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_operate_log"."operate_log_id" IS '主键';
COMMENT ON COLUMN "public"."t_operate_log"."operate_user_id" IS '用户id';
COMMENT ON COLUMN "public"."t_operate_log"."operate_user_type" IS '用户类型';
COMMENT ON COLUMN "public"."t_operate_log"."operate_user_name" IS '用户名称';
COMMENT ON COLUMN "public"."t_operate_log"."operate_user_account" IS '登录账号';
COMMENT ON COLUMN "public"."t_operate_log"."operate_user_role" IS '角色名称汇总';
COMMENT ON COLUMN "public"."t_operate_log"."module" IS '操作模块';
COMMENT ON COLUMN "public"."t_operate_log"."content" IS '操作内容';
COMMENT ON COLUMN "public"."t_operate_log"."url" IS '请求路径';
COMMENT ON COLUMN "public"."t_operate_log"."method" IS 'Java类方法';
COMMENT ON COLUMN "public"."t_operate_log"."http_method" IS 'HTTP方法';
COMMENT ON COLUMN "public"."t_operate_log"."operation_type" IS '操作类型';
COMMENT ON COLUMN "public"."t_operate_log"."param" IS '请求参数';
COMMENT ON COLUMN "public"."t_operate_log"."ip" IS '请求ip';
COMMENT ON COLUMN "public"."t_operate_log"."ip_region" IS '请求ip地区';
COMMENT ON COLUMN "public"."t_operate_log"."user_agent" IS '请求user-agent';
COMMENT ON COLUMN "public"."t_operate_log"."device_info" IS '设备信息';
COMMENT ON COLUMN "public"."t_operate_log"."os_info" IS '操作系统';
COMMENT ON COLUMN "public"."t_operate_log"."response_result" IS '响应结果';
COMMENT ON COLUMN "public"."t_operate_log"."success_flag" IS '请求结果 0失败 1成功';
COMMENT ON COLUMN "public"."t_operate_log"."fail_reason" IS '失败原因';
COMMENT ON COLUMN "public"."t_operate_log"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_operate_log"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_operate_log" IS '操作日志表';

ALTER TABLE "public"."t_operate_log" ADD CONSTRAINT "t_operate_log_pkey" PRIMARY KEY ("operate_log_id");

-- 操作日志数据量较大，仅示例结构，完整数据请参照原文件。

-- ----------------------------
-- 40. 密码变更日志表 t_password_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_password_log";
CREATE TABLE "public"."t_password_log" (
  "id" bigint NOT NULL,
  "user_id" bigint NOT NULL,
  "user_type" smallint NOT NULL,
  "old_password" varchar NOT NULL,
  "new_password" varchar,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_password_log"."id" IS '主键';
COMMENT ON COLUMN "public"."t_password_log"."user_id" IS '用户id';
COMMENT ON COLUMN "public"."t_password_log"."user_type" IS '用户类型';
COMMENT ON COLUMN "public"."t_password_log"."old_password" IS '旧密码';
COMMENT ON COLUMN "public"."t_password_log"."new_password" IS '新密码';
COMMENT ON COLUMN "public"."t_password_log"."update_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_password_log"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_password_log" IS '密码变更日志表';

ALTER TABLE "public"."t_password_log" ADD CONSTRAINT "t_password_log_pkey" PRIMARY KEY ("id");
CREATE INDEX "user_and_type_index" ON "public"."t_password_log" USING btree ("user_id", "user_type");

-- ----------------------------
-- 41. 职务表 t_position
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_position";
CREATE TABLE "public"."t_position" (
  "position_id" bigint NOT NULL,
  "position_name" varchar NOT NULL,
  "level" varchar,
  "sort" integer DEFAULT 0,
  "remark" varchar,
  "deleted_flag" smallint DEFAULT 0,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_position"."position_id" IS '职务ID';
COMMENT ON COLUMN "public"."t_position"."position_name" IS '职务名称';
COMMENT ON COLUMN "public"."t_position"."level" IS '职级';
COMMENT ON COLUMN "public"."t_position"."sort" IS '排序';
COMMENT ON COLUMN "public"."t_position"."remark" IS '备注';
COMMENT ON COLUMN "public"."t_position"."deleted_flag" IS '删除标志';
COMMENT ON COLUMN "public"."t_position"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_position"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_position" IS '职务表';

ALTER TABLE "public"."t_position" ADD CONSTRAINT "t_position_pkey" PRIMARY KEY ("position_id");

INSERT INTO "public"."t_position" ("position_id", "position_name", "level", "sort", "remark", "deleted_flag", "create_time", "update_time") VALUES (3, '技术P7', 'L1', 3, '', 0, '2024-06-29 15:57:07', '2024-07-15 23:34:35');
INSERT INTO "public"."t_position" ("position_id", "position_name", "level", "sort", "remark", "deleted_flag", "create_time", "update_time") VALUES (4, '技术P8', 'L2', 1, NULL, 0, '2024-07-15 23:34:14', '2024-07-15 23:34:23');
INSERT INTO "public"."t_position" ("position_id", "position_name", "level", "sort", "remark", "deleted_flag", "create_time", "update_time") VALUES (5, '管理M5', 'L1', 4, NULL, 0, '2024-07-15 23:34:48', '2024-07-15 23:34:48');

-- ----------------------------
-- 42. 热加载项表 t_reload_item
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_reload_item";
CREATE TABLE "public"."t_reload_item" (
  "tag" varchar NOT NULL,
  "args" varchar,
  "identification" varchar NOT NULL,
  "update_time" TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_reload_item"."tag" IS '项名称';
COMMENT ON COLUMN "public"."t_reload_item"."args" IS '参数 可选';
COMMENT ON COLUMN "public"."t_reload_item"."identification" IS '运行标识';
COMMENT ON COLUMN "public"."t_reload_item"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_reload_item"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_reload_item" IS '热加载项表';

ALTER TABLE "public"."t_reload_item" ADD CONSTRAINT "t_reload_item_pkey" PRIMARY KEY ("tag");

INSERT INTO "public"."t_reload_item" ("tag", "args", "identification", "update_time", "create_time") VALUES ('system_config', '4', '234', '2024-08-13 14:14:30', '2019-04-18 11:48:27');

-- ----------------------------
-- 43. 热加载结果表 t_reload_result
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_reload_result";
CREATE TABLE "public"."t_reload_result" (
  "tag" varchar NOT NULL,
  "identification" varchar NOT NULL,
  "args" varchar,
  "result" smallint NOT NULL,
  "exception" text,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_reload_result"."tag" IS '标签';
COMMENT ON COLUMN "public"."t_reload_result"."identification" IS '运行标识';
COMMENT ON COLUMN "public"."t_reload_result"."args" IS '参数';
COMMENT ON COLUMN "public"."t_reload_result"."result" IS '是否成功 ';
COMMENT ON COLUMN "public"."t_reload_result"."exception" IS '异常信息';
COMMENT ON COLUMN "public"."t_reload_result"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_reload_result" IS '热加载结果表';

INSERT INTO "public"."t_reload_result" ("tag", "identification", "args", "result", "exception", "create_time") VALUES ('system_config', '234', '4', 1, NULL, '2026-05-15 17:16:45');

-- ----------------------------
-- 44. 角色表 t_role
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_role";
CREATE TABLE "public"."t_role" (
  "role_id" bigint NOT NULL,
  "role_name" varchar NOT NULL,
  "role_code" varchar,
  "remark" varchar,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_role"."role_id" IS '主键';
COMMENT ON COLUMN "public"."t_role"."role_name" IS '角色名称';
COMMENT ON COLUMN "public"."t_role"."role_code" IS '角色编码';
COMMENT ON COLUMN "public"."t_role"."remark" IS '角色描述';
COMMENT ON COLUMN "public"."t_role"."update_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_role"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_role" IS '角色表';

ALTER TABLE "public"."t_role" ADD CONSTRAINT "t_role_pkey" PRIMARY KEY ("role_id");
ALTER TABLE "public"."t_role" ADD CONSTRAINT "t_role_role_code_key" UNIQUE ("role_code");

INSERT INTO "public"."t_role" ("role_id", "role_name", "role_code", "remark", "update_time", "create_time") VALUES (1, '技术总监', 'cto', '', '2025-04-03 08:50:27', '2019-06-21 12:09:34');
INSERT INTO "public"."t_role" ("role_id", "role_name", "role_code", "remark", "update_time", "create_time") VALUES (34, '销售总监', 'sales', '', '2025-04-03 08:50:09', '2019-08-30 09:30:50');
INSERT INTO "public"."t_role" ("role_id", "role_name", "role_code", "remark", "update_time", "create_time") VALUES (35, '总经理', 'ceo', '', '2025-04-03 08:50:17', '2019-08-30 09:31:05');
INSERT INTO "public"."t_role" ("role_id", "role_name", "role_code", "remark", "update_time", "create_time") VALUES (36, '董事长', 'dsz', '', '2025-04-03 08:50:51', '2019-08-30 09:31:11');
INSERT INTO "public"."t_role" ("role_id", "role_name", "role_code", "remark", "update_time", "create_time") VALUES (37, '财务', 'caiwu', '', '2025-04-03 08:51:01', '2019-08-30 09:31:16');
INSERT INTO "public"."t_role" ("role_id", "role_name", "role_code", "remark", "update_time", "create_time") VALUES (59, '工作流测试', 'wf', NULL, '2025-06-01 08:14:52', '2025-06-01 08:14:52');

-- ----------------------------
-- 45. 角色数据权限表 t_role_data_scope
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_role_data_scope";
CREATE TABLE "public"."t_role_data_scope" (
  "id" bigint NOT NULL,
  "data_scope_type" integer NOT NULL,
  "view_type" integer NOT NULL,
  "role_id" bigint NOT NULL,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_role_data_scope"."id" IS '主键';
COMMENT ON COLUMN "public"."t_role_data_scope"."data_scope_type" IS '数据范围类型';
COMMENT ON COLUMN "public"."t_role_data_scope"."view_type" IS '数据可见范围类型';
COMMENT ON COLUMN "public"."t_role_data_scope"."role_id" IS '角色id';
COMMENT ON COLUMN "public"."t_role_data_scope"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_role_data_scope"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_role_data_scope" IS '角色数据权限表';

ALTER TABLE "public"."t_role_data_scope" ADD CONSTRAINT "t_role_data_scope_pkey" PRIMARY KEY ("id");

INSERT INTO "public"."t_role_data_scope" ("id", "data_scope_type", "view_type", "role_id", "update_time", "create_time") VALUES (67, 1, 2, 1, '2024-03-18 20:41:00', '2024-03-18 20:41:00');
INSERT INTO "public"."t_role_data_scope" ("id", "data_scope_type", "view_type", "role_id", "update_time", "create_time") VALUES (69, 1, 10, 59, '2025-06-01 08:16:15', '2025-06-01 08:16:15');

-- ----------------------------
-- 46. 角色员工关联表 t_role_employee
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_role_employee";
CREATE TABLE "public"."t_role_employee" (
  "id" bigint NOT NULL,
  "role_id" bigint NOT NULL,
  "employee_id" bigint NOT NULL,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_role_employee"."id" IS '主键';
COMMENT ON COLUMN "public"."t_role_employee"."role_id" IS '角色id';
COMMENT ON COLUMN "public"."t_role_employee"."employee_id" IS '员工id';
COMMENT ON COLUMN "public"."t_role_employee"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_role_employee"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_role_employee" IS '角色员工关联表';

ALTER TABLE "public"."t_role_employee" ADD CONSTRAINT "t_role_employee_pkey" PRIMARY KEY ("id");
ALTER TABLE "public"."t_role_employee" ADD CONSTRAINT "t_role_employee_role_id_employee_id_key" UNIQUE ("role_id", "employee_id");

INSERT INTO "public"."t_role_employee" ("id", "role_id", "employee_id", "update_time", "create_time") VALUES (325, 36, 63, '2022-10-19 20:25:26', '2022-10-19 20:25:26');
INSERT INTO "public"."t_role_employee" ("id", "role_id", "employee_id", "update_time", "create_time") VALUES (329, 34, 72, '2022-11-05 10:56:54', '2022-11-05 10:56:54');
INSERT INTO "public"."t_role_employee" ("id", "role_id", "employee_id", "update_time", "create_time") VALUES (330, 36, 72, '2022-11-05 10:56:54', '2022-11-05 10:56:54');
INSERT INTO "public"."t_role_employee" ("id", "role_id", "employee_id", "update_time", "create_time") VALUES (333, 1, 44, '2023-10-07 18:53:29', '2023-10-07 18:53:29');
INSERT INTO "public"."t_role_employee" ("id", "role_id", "employee_id", "update_time", "create_time") VALUES (334, 1, 47, '2023-10-07 18:55:00', '2023-10-07 18:55:00');
INSERT INTO "public"."t_role_employee" ("id", "role_id", "employee_id", "update_time", "create_time") VALUES (341, 1, 48, '2024-09-02 23:03:28', '2024-09-02 23:03:28');
INSERT INTO "public"."t_role_employee" ("id", "role_id", "employee_id", "update_time", "create_time") VALUES (342, 59, 2, '2025-06-01 08:16:07', '2025-06-01 08:16:07');

-- ----------------------------
-- 47. 角色菜单关联表 t_role_menu
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_role_menu";
CREATE TABLE "public"."t_role_menu" (
  "role_menu_id" bigint NOT NULL,
  "role_id" bigint NOT NULL,
  "menu_id" bigint NOT NULL,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_role_menu"."role_menu_id" IS '主键id';
COMMENT ON COLUMN "public"."t_role_menu"."role_id" IS '角色id';
COMMENT ON COLUMN "public"."t_role_menu"."menu_id" IS '菜单id';
COMMENT ON COLUMN "public"."t_role_menu"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_role_menu"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_role_menu" IS '角色菜单关联表';

ALTER TABLE "public"."t_role_menu" ADD CONSTRAINT "t_role_menu_pkey" PRIMARY KEY ("role_menu_id");
CREATE INDEX "idx_menu_id" ON "public"."t_role_menu" USING btree ("menu_id");
CREATE INDEX "idx_role_id" ON "public"."t_role_menu" USING btree ("role_id");

-- 角色菜单关联数据量较大，此处仅示例结构，完整数据请参照原文件。

-- ----------------------------
-- 48. 单号生成器表 t_serial_number
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_serial_number";
CREATE TABLE "public"."t_serial_number" (
  "serial_number_id" integer NOT NULL,
  "business_name" varchar NOT NULL,
  "format" varchar,
  "rule_type" varchar NOT NULL,
  "init_number" integer NOT NULL,
  "step_random_range" integer NOT NULL,
  "remark" varchar,
  "last_number" bigint,
  "last_time" TIMESTAMP,
  "update_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_serial_number"."serial_number_id" IS '主键';
COMMENT ON COLUMN "public"."t_serial_number"."business_name" IS '业务名称';
COMMENT ON COLUMN "public"."t_serial_number"."format" IS '格式[yyyy]表示年,[mm]标识月,[dd]表示日,[nnn]表示三位数字';
COMMENT ON COLUMN "public"."t_serial_number"."rule_type" IS '规则格式。none没有周期, year 年周期, month月周期, day日周期';
COMMENT ON COLUMN "public"."t_serial_number"."init_number" IS '初始值';
COMMENT ON COLUMN "public"."t_serial_number"."step_random_range" IS '步长随机数';
COMMENT ON COLUMN "public"."t_serial_number"."remark" IS '备注';
COMMENT ON COLUMN "public"."t_serial_number"."last_number" IS '上次产生的单号, 默认为空';
COMMENT ON COLUMN "public"."t_serial_number"."last_time" IS '上次产生的单号时间';
COMMENT ON COLUMN "public"."t_serial_number"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_serial_number"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_serial_number" IS '单号生成器表';

ALTER TABLE "public"."t_serial_number" ADD CONSTRAINT "t_serial_number_pkey" PRIMARY KEY ("serial_number_id");
ALTER TABLE "public"."t_serial_number" ADD CONSTRAINT "t_serial_number_business_name_key" UNIQUE ("business_name");

-- ----------------------------
-- 49. 单号生成记录表 t_serial_number_record
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_serial_number_record";
CREATE TABLE "public"."t_serial_number_record" (
  "serial_number_id" integer NOT NULL,
  "record_date" TIMESTAMP NOT NULL,
  "last_number" bigint NOT NULL DEFAULT 0,
  "last_time" TIMESTAMP NOT NULL,
  "count" bigint NOT NULL DEFAULT 0,
  "update_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  "create_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_serial_number_record"."serial_number_id" IS '单号生成器id';
COMMENT ON COLUMN "public"."t_serial_number_record"."record_date" IS '记录日期';
COMMENT ON COLUMN "public"."t_serial_number_record"."last_number" IS '最后更新值';
COMMENT ON COLUMN "public"."t_serial_number_record"."last_time" IS '最后更新时间';
COMMENT ON COLUMN "public"."t_serial_number_record"."count" IS '更新次数';
COMMENT ON COLUMN "public"."t_serial_number_record"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."t_serial_number_record"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_serial_number_record" IS '单号生成记录表';

CREATE INDEX "uk_generator" ON "public"."t_serial_number_record" USING btree ("serial_number_id", "record_date");

-- ----------------------------
-- 50. 定时任务表 t_smart_job
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_smart_job";
CREATE TABLE "public"."t_smart_job" (
  "job_id" bigint NOT NULL,
  "job_name" varchar NOT NULL,
  "job_class" varchar NOT NULL,
  "trigger_type" varchar NOT NULL,
  "trigger_value" varchar NOT NULL,
  "enabled_flag" smallint NOT NULL DEFAULT 0,
  "param" varchar,
  "last_execute_time" TIMESTAMP,
  "last_execute_log_id" integer,
  "sort" integer NOT NULL DEFAULT 0,
  "remark" varchar,
  "deleted_flag" smallint NOT NULL DEFAULT 0,
  "update_name" varchar NOT NULL,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_smart_job"."job_id" IS '任务id';
COMMENT ON COLUMN "public"."t_smart_job"."job_name" IS '任务名称';
COMMENT ON COLUMN "public"."t_smart_job"."job_class" IS '任务执行类';
COMMENT ON COLUMN "public"."t_smart_job"."trigger_type" IS '触发类型';
COMMENT ON COLUMN "public"."t_smart_job"."trigger_value" IS '触发配置';
COMMENT ON COLUMN "public"."t_smart_job"."enabled_flag" IS '是否开启';
COMMENT ON COLUMN "public"."t_smart_job"."param" IS '参数';
COMMENT ON COLUMN "public"."t_smart_job"."last_execute_time" IS '最后一次执行时间';
COMMENT ON COLUMN "public"."t_smart_job"."last_execute_log_id" IS '最后一次执行记录id';
COMMENT ON COLUMN "public"."t_smart_job"."sort" IS '排序';
COMMENT ON COLUMN "public"."t_smart_job"."remark" IS '描述';
COMMENT ON COLUMN "public"."t_smart_job"."deleted_flag" IS '删除状态';
COMMENT ON COLUMN "public"."t_smart_job"."update_name" IS '更新人';
COMMENT ON COLUMN "public"."t_smart_job"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_smart_job"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."t_smart_job" IS '定时任务表';

ALTER TABLE "public"."t_smart_job" ADD CONSTRAINT "t_smart_job_pkey" PRIMARY KEY ("job_id");

-- ----------------------------
-- 51. 定时任务日志表 t_smart_job_log
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_smart_job_log";
CREATE TABLE "public"."t_smart_job_log" (
  "log_id" bigint NOT NULL,
  "job_id" integer NOT NULL,
  "job_name" varchar NOT NULL,
  "param" varchar,
  "success_flag" smallint NOT NULL,
  "execute_start_time" TIMESTAMP NOT NULL,
  "execute_time_millis" integer,
  "execute_end_time" TIMESTAMP,
  "execute_result" varchar,
  "ip" varchar NOT NULL,
  "process_id" varchar NOT NULL,
  "program_path" varchar NOT NULL,
  "create_name" varchar NOT NULL,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_smart_job_log"."log_id" IS '日志id';
COMMENT ON COLUMN "public"."t_smart_job_log"."job_id" IS '任务id';
COMMENT ON COLUMN "public"."t_smart_job_log"."job_name" IS '任务名称';
COMMENT ON COLUMN "public"."t_smart_job_log"."param" IS '执行参数';
COMMENT ON COLUMN "public"."t_smart_job_log"."success_flag" IS '是否成功';
COMMENT ON COLUMN "public"."t_smart_job_log"."execute_start_time" IS '执行开始时间';
COMMENT ON COLUMN "public"."t_smart_job_log"."execute_time_millis" IS '执行时长';
COMMENT ON COLUMN "public"."t_smart_job_log"."execute_end_time" IS '执行结束时间';
COMMENT ON COLUMN "public"."t_smart_job_log"."execute_result" IS '执行结果';
COMMENT ON COLUMN "public"."t_smart_job_log"."ip" IS 'ip';
COMMENT ON COLUMN "public"."t_smart_job_log"."process_id" IS '进程id';
COMMENT ON COLUMN "public"."t_smart_job_log"."program_path" IS '程序目录';
COMMENT ON COLUMN "public"."t_smart_job_log"."create_name" IS '创建人';
COMMENT ON COLUMN "public"."t_smart_job_log"."create_time" IS '创建时间';
COMMENT ON TABLE "public"."t_smart_job_log" IS '定时任务日志表';

ALTER TABLE "public"."t_smart_job_log" ADD CONSTRAINT "t_smart_job_log_pkey" PRIMARY KEY ("log_id");
CREATE INDEX "idx_job_id" ON "public"."t_smart_job_log" USING btree ("job_id");

-- ----------------------------
-- 52. 表格列配置表 t_table_column
-- ----------------------------
DROP TABLE IF EXISTS "public"."t_table_column";
CREATE TABLE "public"."t_table_column" (
  "table_column_id" bigint NOT NULL,
  "user_id" bigint NOT NULL,
  "user_type" integer NOT NULL,
  "table_id" integer NOT NULL,
  "columns" text,
  "create_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON COLUMN "public"."t_table_column"."table_column_id" IS '主键';
COMMENT ON COLUMN "public"."t_table_column"."user_id" IS '用户id';
COMMENT ON COLUMN "public"."t_table_column"."user_type" IS '用户类型';
COMMENT ON COLUMN "public"."t_table_column"."table_id" IS '表格id';
COMMENT ON COLUMN "public"."t_table_column"."columns" IS '具体的表格列，存入的json';
COMMENT ON COLUMN "public"."t_table_column"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."t_table_column"."update_time" IS '更新时间';

ALTER TABLE "public"."t_table_column" ADD CONSTRAINT "t_table_column_pkey" PRIMARY KEY ("table_column_id");
ALTER TABLE "public"."t_table_column" ADD CONSTRAINT "uni_employee_table" UNIQUE ("user_id", "table_id");

-- ======================================================
-- 以上为所有表结构、注释、约束、索引及初始数据
-- 序列、视图、函数等未包含，如有需要请从原文件提取
-- ======================================================