
DROP SEQUENCE IF EXISTS "public"."tbl_work_flow_button_id_seq";
CREATE SEQUENCE "public"."tbl_work_flow_button_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1;
SELECT setval('"public"."tbl_work_flow_button_id_seq"', 7, true);
ALTER SEQUENCE "public"."tbl_work_flow_button_id_seq" OWNER TO "postgres";


DROP SEQUENCE IF EXISTS "public"."tbl_work_flow_cc_item_id_seq";
CREATE SEQUENCE "public"."tbl_work_flow_cc_item_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1;
ALTER SEQUENCE "public"."tbl_work_flow_cc_item_id_seq" OWNER TO "postgres";

DROP SEQUENCE IF EXISTS "public"."tbl_work_flow_data_id_seq";
CREATE SEQUENCE "public"."tbl_work_flow_data_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
ALTER SEQUENCE "public"."tbl_work_flow_data_id_seq" OWNER TO "postgres";

DROP SEQUENCE IF EXISTS "public"."tbl_work_flow_delay_record_id_seq";
CREATE SEQUENCE "public"."tbl_work_flow_delay_record_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
ALTER SEQUENCE "public"."tbl_work_flow_delay_record_id_seq" OWNER TO "postgres";

DROP SEQUENCE IF EXISTS "public"."tbl_work_flow_expression_id_seq";
CREATE SEQUENCE "public"."tbl_work_flow_expression_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1;
SELECT setval('"public"."tbl_work_flow_expression_id_seq"', 4, true);
ALTER SEQUENCE "public"."tbl_work_flow_expression_id_seq" OWNER TO "postgres";


DROP SEQUENCE IF EXISTS "public"."tbl_work_flow_form_id_seq";
CREATE SEQUENCE "public"."tbl_work_flow_form_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
ALTER SEQUENCE "public"."tbl_work_flow_form_id_seq" OWNER TO "postgres";

DROP SEQUENCE IF EXISTS "public"."tbl_work_flow_form_link_id_seq";
CREATE SEQUENCE "public"."tbl_work_flow_form_link_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1;
ALTER SEQUENCE "public"."tbl_work_flow_form_link_id_seq" OWNER TO "postgres";

DROP SEQUENCE IF EXISTS "public"."tbl_work_flow_listener_id_seq";
CREATE SEQUENCE "public"."tbl_work_flow_listener_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1;
SELECT setval('"public"."tbl_work_flow_listener_id_seq"', 20, true);
ALTER SEQUENCE "public"."tbl_work_flow_listener_id_seq" OWNER TO "postgres";

DROP SEQUENCE IF EXISTS "public"."tbl_work_flow_record_id_seq";
CREATE SEQUENCE "public"."tbl_work_flow_record_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
ALTER SEQUENCE "public"."tbl_work_flow_record_id_seq" OWNER TO "postgres";

DROP SEQUENCE IF EXISTS "public"."tbl_work_flow_sub_data_id_seq";
CREATE SEQUENCE "public"."tbl_work_flow_sub_data_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
ALTER SEQUENCE "public"."tbl_work_flow_sub_data_id_seq" OWNER TO "postgres";

DROP SEQUENCE IF EXISTS "public"."tbl_work_flow_version_record_id_seq";
CREATE SEQUENCE "public"."tbl_work_flow_version_record_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
ALTER SEQUENCE "public"."tbl_work_flow_version_record_id_seq" OWNER TO "postgres";

DROP SEQUENCE IF EXISTS "public"."tbl_questionnaire_id_seq";
CREATE SEQUENCE "public"."tbl_questionnaire_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
ALTER SEQUENCE "public"."tbl_questionnaire_id_seq" OWNER TO "postgres";

DROP SEQUENCE IF EXISTS "public"."tbl_questionnaire_module_id_seq";
CREATE SEQUENCE "public"."tbl_questionnaire_module_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
ALTER SEQUENCE "public"."tbl_questionnaire_module_id_seq" OWNER TO "postgres";

DROP SEQUENCE IF EXISTS "public"."tbl_questionnaire_result_id_seq";
CREATE SEQUENCE "public"."tbl_questionnaire_result_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1;
ALTER SEQUENCE "public"."tbl_questionnaire_result_id_seq" OWNER TO "postgres";


-- ----------------------------
-- Table structure for tbl_work_flow_button
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_work_flow_button";
CREATE TABLE "public"."tbl_work_flow_button" (
 "id" int4 NOT NULL DEFAULT nextval('tbl_work_flow_button_id_seq'::regclass),
 "code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
 "name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
 "sort" int2,
 "flow_status" int4,
 "is_enable" bool DEFAULT true,
 "type" varchar(255) COLLATE "pg_catalog"."default",
 "is_danger" bool DEFAULT false,
 "is_ghost" bool DEFAULT false,
 "create_time" timestamp(6),
 "update_time" timestamp(6)
)
;
COMMENT ON COLUMN "public"."tbl_work_flow_button"."code" IS '编码';
COMMENT ON COLUMN "public"."tbl_work_flow_button"."name" IS '按钮名称';
COMMENT ON COLUMN "public"."tbl_work_flow_button"."sort" IS '排序';
COMMENT ON COLUMN "public"."tbl_work_flow_button"."flow_status" IS '流程状态';
COMMENT ON COLUMN "public"."tbl_work_flow_button"."is_enable" IS '是否启用';
COMMENT ON COLUMN "public"."tbl_work_flow_button"."type" IS '按钮类型';
COMMENT ON COLUMN "public"."tbl_work_flow_button"."is_danger" IS '是否危险属性';
COMMENT ON COLUMN "public"."tbl_work_flow_button"."is_ghost" IS '是否幽灵属性';
COMMENT ON COLUMN "public"."tbl_work_flow_button"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_work_flow_button"."update_time" IS '更新时间';

-- ----------------------------
-- Records of tbl_work_flow_button
-- ----------------------------
INSERT INTO "public"."tbl_work_flow_button" VALUES (1, 'flow_agree', '提交', 0, NULL, 't', 'primary', 'f', 'f', now(), now());
INSERT INTO "public"."tbl_work_flow_button" VALUES (2, 'flow_reject', '拒绝', 1, NULL, 't', 'primary', 't', 'f', now(), now());
INSERT INTO "public"."tbl_work_flow_button" VALUES (3, 'flow_transfer', '转办', 2, NULL, 't', 'primary', 'f', 'f', now(), now());
INSERT INTO "public"."tbl_work_flow_button" VALUES (4, 'flow_delegate', '委派', 3, NULL, 't', 'primary', 'f', 'f', now(), now());
INSERT INTO "public"."tbl_work_flow_button" VALUES (5, 'flow_claim', '签收', 4, NULL, 't', 'primary', 'f', 'f', now(), now());
INSERT INTO "public"."tbl_work_flow_button" VALUES (6, 'flow_return', '退回', 5, NULL, 't', 'primary', 't', 'f', now(), now());
INSERT INTO "public"."tbl_work_flow_button" VALUES (7, 'flow_delay', '延期', 6, NULL, 't', 'primary', 't', 'f', now(), now());

-- ----------------------------
-- Uniques structure for table tbl_work_flow_button
-- ----------------------------
ALTER TABLE "public"."tbl_work_flow_button" ADD CONSTRAINT "uk_button_code" UNIQUE ("code");
ALTER TABLE "public"."tbl_work_flow_button" ADD CONSTRAINT "uk_button_name" UNIQUE ("name");

-- ----------------------------
-- Primary Key structure for table tbl_work_flow_button
-- ----------------------------
ALTER TABLE "public"."tbl_work_flow_button" ADD CONSTRAINT "tbl_work_flow_button_pkey" PRIMARY KEY ("id");



-- ----------------------------
-- Table structure for tbl_work_flow_cc_item
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_work_flow_cc_item";
CREATE TABLE "public"."tbl_work_flow_cc_item" (
"id" int8 NOT NULL DEFAULT nextval('tbl_work_flow_cc_item_id_seq'::regclass),
"definition_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"instance_id" varchar(30) COLLATE "pg_catalog"."default" NOT NULL,
"task_id" varchar(30) COLLATE "pg_catalog"."default" NOT NULL,
"task_name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"cc_title" varchar(255) COLLATE "pg_catalog"."default",
"cc_uid" int4 NOT NULL,
"cc_name" varchar(255) COLLATE "pg_catalog"."default",
"to_uid" int4 NOT NULL,
"create_time" timestamp(6),
"update_time" timestamp(6)
)
;
COMMENT ON COLUMN "public"."tbl_work_flow_cc_item"."definition_id" IS '流程定义ID';
COMMENT ON COLUMN "public"."tbl_work_flow_cc_item"."instance_id" IS '流程实例ID';
COMMENT ON COLUMN "public"."tbl_work_flow_cc_item"."task_id" IS '流程任务ID';
COMMENT ON COLUMN "public"."tbl_work_flow_cc_item"."task_name" IS '流程任务名称';
COMMENT ON COLUMN "public"."tbl_work_flow_cc_item"."cc_title" IS '抄送标题';
COMMENT ON COLUMN "public"."tbl_work_flow_cc_item"."cc_uid" IS '抄送人ID';
COMMENT ON COLUMN "public"."tbl_work_flow_cc_item"."cc_name" IS '抄送人姓名';
COMMENT ON COLUMN "public"."tbl_work_flow_cc_item"."to_uid" IS '接收人ID';
COMMENT ON COLUMN "public"."tbl_work_flow_cc_item"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_work_flow_cc_item"."update_time" IS '更新时间';

-- ----------------------------
-- Indexes structure for table tbl_work_flow_cc_item
-- ----------------------------
CREATE INDEX "tbl_work_flow_cc_item_instance_id_idx" ON "public"."tbl_work_flow_cc_item" USING btree (
"instance_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

CREATE INDEX "tbl_work_flow_cc_item_task_id_idx" ON "public"."tbl_work_flow_cc_item" USING btree (
"task_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

CREATE INDEX "tbl_work_flow_cc_item_to_uid_idx" ON "public"."tbl_work_flow_cc_item" USING btree (
"to_uid" "pg_catalog"."int4_ops" ASC NULLS LAST
);

-- ----------------------------
-- Uniques structure for table tbl_work_flow_cc_item
-- ----------------------------
ALTER TABLE "public"."tbl_work_flow_cc_item" ADD CONSTRAINT "tbl_work_flow_cc_item_task_id_to_uid_key" UNIQUE ("task_id", "to_uid");

-- ----------------------------
-- Primary Key structure for table tbl_work_flow_cc_item
-- ----------------------------
ALTER TABLE "public"."tbl_work_flow_cc_item" ADD CONSTRAINT "tbl_work_flow_cc_item_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_work_flow_data
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_work_flow_data";
CREATE TABLE "public"."tbl_work_flow_data" (
"id" int8 NOT NULL DEFAULT nextval('tbl_work_flow_data_id_seq'::regclass),
"definition_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"definition_key" varchar(255) COLLATE "pg_catalog"."default",
"deploy_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"instance_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"form_data_json" jsonb,
"creator_uid" int4 NOT NULL,
"creator_name" varchar(255) COLLATE "pg_catalog"."default",
"creator_oid" int4 NOT NULL,
"status" int4,
"create_time" timestamp(6),
"update_time" timestamp(6),
"is_expired" bool,
"deadline_time" varchar(50) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."tbl_work_flow_data"."definition_id" IS '流程定义ID';
COMMENT ON COLUMN "public"."tbl_work_flow_data"."definition_key" IS '流程定义Key';
COMMENT ON COLUMN "public"."tbl_work_flow_data"."deploy_id" IS '流程部署ID';
COMMENT ON COLUMN "public"."tbl_work_flow_data"."instance_id" IS '流程实例ID';
COMMENT ON COLUMN "public"."tbl_work_flow_data"."form_data_json" IS '表单数据';
COMMENT ON COLUMN "public"."tbl_work_flow_data"."creator_uid" IS '创建人ID';
COMMENT ON COLUMN "public"."tbl_work_flow_data"."creator_name" IS '创建人姓名';
COMMENT ON COLUMN "public"."tbl_work_flow_data"."creator_oid" IS '创建人所属部门';
COMMENT ON COLUMN "public"."tbl_work_flow_data"."status" IS '流程状态';
COMMENT ON COLUMN "public"."tbl_work_flow_data"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_work_flow_data"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."tbl_work_flow_data"."is_expired" IS '是否超期';
COMMENT ON COLUMN "public"."tbl_work_flow_data"."deadline_time" IS '截止时间';

-- ----------------------------
-- Primary Key structure for table tbl_work_flow_data
-- ----------------------------
ALTER TABLE "public"."tbl_work_flow_data" ADD CONSTRAINT "tbl_work_flow_data_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_work_flow_delay_record
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_work_flow_delay_record";
CREATE TABLE "public"."tbl_work_flow_delay_record" (
"id" int8 NOT NULL DEFAULT nextval('tbl_work_flow_delay_record_id_seq'::regclass),
"biz_id" int4 NOT NULL,
"instance_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"old_deadline" varchar(255) COLLATE "pg_catalog"."default",
"new_deadline" varchar(255) COLLATE "pg_catalog"."default",
"applicant_uid" int4,
"applicant_oid" int4,
"applicant_name" varchar(255) COLLATE "pg_catalog"."default",
"applicant_tel" varchar(255) COLLATE "pg_catalog"."default",
"reason" text COLLATE "pg_catalog"."default",
"reviewer_uid" int4,
"reviewer_oid" int4,
"reviewer_role_id" int4,
"reviewer_name" varchar(255) COLLATE "pg_catalog"."default",
"reviewer_tel" varchar(255) COLLATE "pg_catalog"."default",
"audit_time" varchar(255) COLLATE "pg_catalog"."default",
"comment" text COLLATE "pg_catalog"."default",
"status" int2 NOT NULL DEFAULT 0,
"type" int2 NOT NULL DEFAULT 0,
"create_time" timestamp(6),
"update_time" timestamp(6)
)
;
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."biz_id" IS '业务ID';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."instance_id" IS '流程实例ID';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."old_deadline" IS '原截止时间';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."new_deadline" IS '新截止时间';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."applicant_uid" IS '申请人ID';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."applicant_oid" IS '申请人所属组织ID';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."applicant_name" IS '申请人姓名';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."applicant_tel" IS '申请人联系电话';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."reason" IS '申请原因说明';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."reviewer_uid" IS '审核人ID';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."reviewer_oid" IS '审核人所属组织ID';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."reviewer_role_id" IS '审核人角色ID';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."reviewer_name" IS '审核人姓名';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."reviewer_tel" IS '审核人联系电话';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."audit_time" IS '审核时间';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."comment" IS '审核意见';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."status" IS '审核状态，0-待审核|1-审核通过|2-审核未通过';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."type" IS '延期类型，0-节点延期|1-全局延期';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_work_flow_delay_record"."update_time" IS '更新时间';

-- ----------------------------
-- Primary Key structure for table tbl_work_flow_delay_record
-- ----------------------------
ALTER TABLE "public"."tbl_work_flow_delay_record" ADD CONSTRAINT "bl_work_flow_delay_record_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_work_flow_expression
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_work_flow_expression";
CREATE TABLE "public"."tbl_work_flow_expression" (
"id" int4 NOT NULL DEFAULT nextval('tbl_work_flow_expression_id_seq'::regclass),
"name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"expression" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"is_system" bool NOT NULL DEFAULT false,
"type" int2 NOT NULL,
"create_time" timestamp(6),
"update_time" timestamp(6)
)
;
COMMENT ON COLUMN "public"."tbl_work_flow_expression"."name" IS '名称';
COMMENT ON COLUMN "public"."tbl_work_flow_expression"."expression" IS '表达式';
COMMENT ON COLUMN "public"."tbl_work_flow_expression"."is_system" IS '是否系统内置';
COMMENT ON COLUMN "public"."tbl_work_flow_expression"."type" IS '类型，0-人员配置 1-流转条件 2-表单默认值';
COMMENT ON COLUMN "public"."tbl_work_flow_expression"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_work_flow_expression"."update_time" IS '更新时间';

-- ----------------------------
-- Records of tbl_work_flow_expression
-- ----------------------------
INSERT INTO "public"."tbl_work_flow_expression" VALUES (1, '发起人ID', '${initiator}', 't', 0, now(), now());
INSERT INTO "public"."tbl_work_flow_expression" VALUES (2, '操作人姓名', 'OPERATOR_NAME', 't', 2, now(), now());
INSERT INTO "public"."tbl_work_flow_expression" VALUES (3, '操作人联系电话', 'OPERATOR_TEL', 't', 2, now(), now());
INSERT INTO "public"."tbl_work_flow_expression" VALUES (4, '操作人所属组织', 'OPERATOR_ORG_NAME', 't', 2, now(), now());

-- ----------------------------
-- Uniques structure for table tbl_work_flow_expression
-- ----------------------------
ALTER TABLE "public"."tbl_work_flow_expression" ADD CONSTRAINT "uk_expression_name" UNIQUE ("name");

-- ----------------------------
-- Primary Key structure for table tbl_work_flow_expression
-- ----------------------------
ALTER TABLE "public"."tbl_work_flow_expression" ADD CONSTRAINT "tbl_work_flow_expression_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_work_flow_form
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_work_flow_form";
CREATE TABLE "public"."tbl_work_flow_form" (
"id" int8 NOT NULL DEFAULT nextval('tbl_work_flow_form_id_seq'::regclass),
"definition_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"definition_key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"element_key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"form_id" int4 NOT NULL,
"form_auth_json" json,
"is_start_form" bool DEFAULT false,
"create_time" timestamp(6),
"update_time" timestamp(6)
)
;
COMMENT ON COLUMN "public"."tbl_work_flow_form"."definition_id" IS '流程定义ID';
COMMENT ON COLUMN "public"."tbl_work_flow_form"."definition_key" IS '流程定义key';
COMMENT ON COLUMN "public"."tbl_work_flow_form"."element_key" IS '流程元素唯一标识';
COMMENT ON COLUMN "public"."tbl_work_flow_form"."form_id" IS '表单ID';
COMMENT ON COLUMN "public"."tbl_work_flow_form"."form_auth_json" IS '表单权限json';
COMMENT ON COLUMN "public"."tbl_work_flow_form"."is_start_form" IS '是否为发起表单';
COMMENT ON COLUMN "public"."tbl_work_flow_form"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_work_flow_form"."update_time" IS '更新时间';

-- ----------------------------
-- Primary Key structure for table tbl_work_flow_form
-- ----------------------------
ALTER TABLE "public"."tbl_work_flow_form" ADD CONSTRAINT "tbl_work_flow_form_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_work_flow_form_link
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_work_flow_form_link";
CREATE TABLE "public"."tbl_work_flow_form_link" (
"id" int4 NOT NULL DEFAULT nextval('tbl_work_flow_form_link_id_seq'::regclass),
"form_id" int4 NOT NULL,
"menu_id" int4 NOT NULL,
"definition_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"definition_key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"create_time" timestamp(6),
"update_time" timestamp(6)
)
;
COMMENT ON COLUMN "public"."tbl_work_flow_form_link"."form_id" IS '表单ID';
COMMENT ON COLUMN "public"."tbl_work_flow_form_link"."menu_id" IS '系统菜单ID';
COMMENT ON COLUMN "public"."tbl_work_flow_form_link"."definition_id" IS '流程定义ID';
COMMENT ON COLUMN "public"."tbl_work_flow_form_link"."definition_key" IS '流程定义key';
COMMENT ON COLUMN "public"."tbl_work_flow_form_link"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_work_flow_form_link"."update_time" IS '更新时间';

-- ----------------------------
-- Uniques structure for table tbl_work_flow_form_link
-- ----------------------------
ALTER TABLE "public"."tbl_work_flow_form_link" ADD CONSTRAINT "uk_form_id_menu_id" UNIQUE ("form_id", "menu_id", "definition_id");

-- ----------------------------
-- Primary Key structure for table tbl_work_flow_form_link
-- ----------------------------
ALTER TABLE "public"."tbl_work_flow_form_link" ADD CONSTRAINT "tbl_work_flow_form_link_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_work_flow_listener
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_work_flow_listener";
CREATE TABLE "public"."tbl_work_flow_listener" (
"id" int4 NOT NULL DEFAULT nextval('tbl_work_flow_listener_id_seq'::regclass),
"listener_name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"listener_type" varchar(16) COLLATE "pg_catalog"."default" NOT NULL,
"listener_event" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"listener_value" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"listener_value_type" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"remark" text COLLATE "pg_catalog"."default",
"is_enable" bool DEFAULT true,
"create_time" timestamp(6),
"update_time" timestamp(6)
)
;
COMMENT ON COLUMN "public"."tbl_work_flow_listener"."listener_name" IS '监听名称';
COMMENT ON COLUMN "public"."tbl_work_flow_listener"."listener_type" IS '监听类型';
COMMENT ON COLUMN "public"."tbl_work_flow_listener"."listener_event" IS '事件';
COMMENT ON COLUMN "public"."tbl_work_flow_listener"."listener_value" IS '执行内容';
COMMENT ON COLUMN "public"."tbl_work_flow_listener"."listener_value_type" IS '执行类型';
COMMENT ON COLUMN "public"."tbl_work_flow_listener"."remark" IS '描述';
COMMENT ON COLUMN "public"."tbl_work_flow_listener"."is_enable" IS '是否启用';
COMMENT ON COLUMN "public"."tbl_work_flow_listener"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_work_flow_listener"."update_time" IS '更新时间';

-- ----------------------------
-- Records of tbl_work_flow_listener
-- ----------------------------
INSERT INTO "public"."tbl_work_flow_listener" VALUES (1, '分配组织', '0', 'create', '${workFlowDynamicAllocationListener.setOrg(task, Integer oid, Long roleId)}', '表达式', '参数解释：默认参数|组织OID|角色ID,可以为null', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (2, '分配用户', '0', 'create', '${workFlowDynamicAllocationListener.setAssignees(task, Integer oid, Long roleId)}', '表达式', '参数解释：默认参数|组织OID|角色ID,可以为null', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (3, '分配用户（指定变量名称）', '0', 'create', '${workFlowDynamicAllocationListener.setAssignee(task, String variableName)}', '表达式', '参数解释：默认参数|表单字段名称，注意需要加单引号', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (4, '分配用户或组织（配合动态表单组件使用）', '0', 'create', '${workFlowDynamicAllocationListener.setAssigneesOrOrg(task, Long roleId)}', '表达式', '参数解释：默认参数|角色ID,可以为null', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (5, '由下而上逐级分配处理人', '0', 'create', '${workFlowDynamicAllocationListener.setParentOrgAssignee(task,Boolean isFirstUserTask, Long roleId)}', '表达式', '参数解释：默认参数|是否为流程中第一个用户节点|角色ID,可以为null', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (6, '清除当前节点历史填写的表单数据', '0', 'create', '${workFlowCleanHistoricalFormDataListener.notify(task)}', '表达式', '参数解释：默认参数，仅清除当前节点拥有读写权限的表单字段数据', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (7, '回退次数限制', '0', 'create', '${workFlowTaskReturnLimitListener.execute(task, Integer limitType, Integer limitCount, boolean expression)}', '表达式', '参数解释：默认参数|限制类型（0-用户、1-组织）|限制次数|布尔表达式，为true时生效', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (8, '自定义操作次数限制', '0', 'complete', '${workFlowCustomOperateLimitListener.execute(task, Integer limitType, Integer limitCount, boolean expression)}', '表达式', '参数解释：默认参数|限制类型（0-用户、1-组织）|限制次数|布尔表达式，为true时生效', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (9, '用户任务签收超时', '0', 'create', '${workFlowTaskTimeOutListener.claim(task, Integer minutes)}', '表达式', '参数解释：默认参数|超时时长（单位分钟）', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (10, '用户任务完成超时', '0', 'create', '${workFlowTaskTimeOutListener.complete(task, Integer minutes)}', '表达式', '参数解释：默认参数|超时时长（单位分钟）', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (11, '任务延期申请审核人配置', '0', 'create', '${workFlowTaskDelayReviewerConfigListener.setUid(task, Integer uid)}', '表达式', '参数解释：默认参数|用户ID', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (12, '任务延期申请审核组织配置', '0', 'create', '${workFlowTaskDelayReviewerConfigListener.setOid(task, Integer oid, Integer roleId)}', '表达式', '参数解释：默认参数|组织OID|角色ID，注意组织和角色均可以为空，但两者必须有一个不能为空', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (13, '待办消息提醒', '0', 'create', '${workFlowTodoMsgNoticeListener.notify(task)}', '表达式', '参数解释：默认参数', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (14, '签收发送短信消息通知（阿里云短信）', '0', 'create', '${workFlowAliyunSmsMsgNoticeListener.sendClaimMsg(task, String smsJson)}', '表达式', '参数解释：默认参数|短信信息，json形式："{\"templateCode\":\"短信模板CODE\",\"templateParam\":\"{\\\"变量1\\\":\\\"hello\\\",\\\"变量2\\\":\\\"world\\\"}\",\"signName\": \"短信签名\",\"phoneNumbers\":\"手机号\"}"', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (15, '发送短信消息通知（阿里云短信）', '0', 'create', '${workFlowAliyunSmsMsgNoticeListener.sendMsg(task, boolean expression, String smsJson)}', '表达式', '参数解释：默认参数|布尔表达式，为true时生效|短信信息，json形式："{\"templateCode\":\"短信模板CODE\",\"templateParam\":\"{\\\"变量1\\\":\\\"hello\\\",\\\"变量2\\\":\\\"world\\\"}\",\"signName\": \"短信签名\",\"phoneNumbers\":\"手机号\"}"', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (16, '浙政钉文本消息（工作通知消息）', '0', 'create', '${workFlowDingMsgNoticeListener.sendGovTextMsg(task, String receiverIds, String content)}', '表达式', '参数解释：默认参数|接收人用户ID(accountId)，若未指定消息接收人，则默认发送消息给当前节点的所有用户|消息内容', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (17, '浙政钉链接消息（工作通知消息）', '0', 'create', '${workFlowDingMsgNoticeListener.sendGovLinkMsg(task, String receiverIds, String title, String text, String messageUrl, String picUrl)}', '表达式', '参数解释：默认参数|接收人用户ID(accountId)，若未指定消息接收人，则默认发送消息给当前节点的所有用户|消息标题|消息描述|消息点击链接地址，当发送消息为小程序时支持小程序跳转链接|图片地址', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (18, '浙政钉MarkDown消息（工作通知消息）', '0', 'create', '${workFlowDingMsgNoticeListener.sendGovMarkDownMsg(task, String receiverIds, String title, String text)}', '表达式', '参数解释：默认参数|接收人用户ID(accountId)，若未指定消息接收人，则默认发送消息给当前节点的所有用户|标题|markdown的文本', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (19, '自动办结（无办结人时（含候选人和候选组））', '0', 'create', '${workFlowAutoCompleteListener.notify(task)}', '表达式', '参数解释：默认参数', 't', now(), now());
INSERT INTO "public"."tbl_work_flow_listener" VALUES (20, '分配用户（多实例）', '2', '无', '${workFlowMultiInstanceListener.execute(String variable)}', '表达式', '参数解释：变量名称，支持表单变量、自定义变量', 't', now(), now());

-- ----------------------------
-- Primary Key structure for table tbl_work_flow_listener
-- ----------------------------
ALTER TABLE "public"."tbl_work_flow_listener" ADD CONSTRAINT "tbl_work_flow_listener_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_work_flow_record
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_work_flow_record";
CREATE TABLE "public"."tbl_work_flow_record" (
"id" int8 NOT NULL DEFAULT nextval('tbl_work_flow_record_id_seq'::regclass),
"deploy_id" varchar(30) COLLATE "pg_catalog"."default",
"instance_id" varchar(30) COLLATE "pg_catalog"."default",
"execution_id" varchar(30) COLLATE "pg_catalog"."default",
"task_id" varchar(30) COLLATE "pg_catalog"."default",
"task_name" varchar(255) COLLATE "pg_catalog"."default",
"activity_id" varchar COLLATE "pg_catalog"."default",
"activity_type" varchar(255) COLLATE "pg_catalog"."default",
"operator_uid" int4,
"operator_name" varchar(255) COLLATE "pg_catalog"."default",
"operator_oid" int4,
"operator_org_name" varchar(255) COLLATE "pg_catalog"."default",
"action" int4,
"action_code" varchar(255) COLLATE "pg_catalog"."default",
"action_desc" varchar(255) COLLATE "pg_catalog"."default",
"receive_time" varchar(30) COLLATE "pg_catalog"."default",
"complete_time" varchar(30) COLLATE "pg_catalog"."default",
"comment" text COLLATE "pg_catalog"."default" DEFAULT ''::text,
"create_time" timestamp(6),
"update_time" timestamp(6),
"deadline_time" varchar(20) COLLATE "pg_catalog"."default",
"deadline_time_type" varchar(20) COLLATE "pg_catalog"."default",
"is_expired" bool DEFAULT false
)
;
COMMENT ON COLUMN "public"."tbl_work_flow_record"."deploy_id" IS '流程部署ID';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."instance_id" IS '流程实例ID';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."execution_id" IS '流程执行实例ID';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."task_id" IS '流程任务ID';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."task_name" IS '流程任务名称';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."activity_id" IS '流程活动ID';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."activity_type" IS '流程活动名称';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."operator_uid" IS '操作人ID';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."operator_name" IS '操作人姓名';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."operator_oid" IS '操作人所属组织OID';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."operator_org_name" IS '操作人所属组织名称';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."action" IS '处理动作';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."action_code" IS '处理动作编码';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."action_desc" IS '处理动作描述';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."receive_time" IS '接收时间';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."complete_time" IS '办结时间';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."comment" IS '审核意见';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."deadline_time" IS '截止时间';
COMMENT ON COLUMN "public"."tbl_work_flow_record"."deadline_time_type" IS '截止时间类型';

-- ----------------------------
-- Indexes structure for table tbl_work_flow_record
-- ----------------------------
CREATE INDEX "tbl_work_flow_record_instance_id_idx" ON "public"."tbl_work_flow_record" USING btree (
"instance_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table tbl_work_flow_record
-- ----------------------------
ALTER TABLE "public"."tbl_work_flow_record" ADD CONSTRAINT "tbl_work_flow_record_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_work_flow_sub_data
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_work_flow_sub_data";
CREATE TABLE "public"."tbl_work_flow_sub_data" (
"id" int8 NOT NULL DEFAULT nextval('tbl_work_flow_sub_data_id_seq'::regclass),
"instance_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"task_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"task_key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"form_data_json" jsonb NOT NULL,
"operator_uid" int4 NOT NULL,
"operator_name" varchar(255) COLLATE "pg_catalog"."default",
"operator_oid" int4 NOT NULL,
"create_time" timestamp(6),
"update_time" timestamp(6)
)
;
COMMENT ON COLUMN "public"."tbl_work_flow_sub_data"."instance_id" IS '流程实例ID';
COMMENT ON COLUMN "public"."tbl_work_flow_sub_data"."task_id" IS '流程任务ID';
COMMENT ON COLUMN "public"."tbl_work_flow_sub_data"."task_key" IS '流程任务key';
COMMENT ON COLUMN "public"."tbl_work_flow_sub_data"."form_data_json" IS '表单数据';
COMMENT ON COLUMN "public"."tbl_work_flow_sub_data"."operator_uid" IS '操作人ID';
COMMENT ON COLUMN "public"."tbl_work_flow_sub_data"."operator_name" IS '操作人姓名';
COMMENT ON COLUMN "public"."tbl_work_flow_sub_data"."operator_oid" IS '操作人所属组织';
COMMENT ON COLUMN "public"."tbl_work_flow_sub_data"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_work_flow_sub_data"."update_time" IS '更新时间';

-- ----------------------------
-- Primary Key structure for table tbl_work_flow_sub_data
-- ----------------------------
ALTER TABLE "public"."tbl_work_flow_sub_data" ADD CONSTRAINT "tbl_work_flow_sub_data_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_work_flow_version_record
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_work_flow_version_record";
CREATE TABLE "public"."tbl_work_flow_version_record" (
"id" int8 NOT NULL DEFAULT nextval('tbl_work_flow_version_record_id_seq'::regclass),
"definition_name" varchar(255) COLLATE "pg_catalog"."default",
"definition_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"definition_key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"version" int4 NOT NULL,
"operator_name" varchar(255) COLLATE "pg_catalog"."default",
"operator_account" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"operator_uid" int4 NOT NULL,
"create_time" timestamp(6),
"update_time" timestamp(6)
)
;
COMMENT ON COLUMN "public"."tbl_work_flow_version_record"."definition_name" IS '流程定义名称';
COMMENT ON COLUMN "public"."tbl_work_flow_version_record"."definition_id" IS '流程定义ID';
COMMENT ON COLUMN "public"."tbl_work_flow_version_record"."definition_key" IS '流程定义key';
COMMENT ON COLUMN "public"."tbl_work_flow_version_record"."version" IS '流程定义版本号';
COMMENT ON COLUMN "public"."tbl_work_flow_version_record"."operator_name" IS '操作人姓名';
COMMENT ON COLUMN "public"."tbl_work_flow_version_record"."operator_account" IS '操作人账号';
COMMENT ON COLUMN "public"."tbl_work_flow_version_record"."operator_uid" IS '操作人ID';
COMMENT ON COLUMN "public"."tbl_work_flow_version_record"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_work_flow_version_record"."update_time" IS '更新时间';

-- ----------------------------
-- Indexes structure for table tbl_work_flow_version_record
-- ----------------------------
CREATE INDEX "tbl_work_flow_version_record_definition_key_idx" ON "public"."tbl_work_flow_version_record" USING btree (
"definition_key" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

CREATE INDEX "tbl_work_flow_version_record_version_idx" ON "public"."tbl_work_flow_version_record" USING btree (
"version" "pg_catalog"."int4_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table tbl_work_flow_version_record
-- ----------------------------
ALTER TABLE "public"."tbl_work_flow_version_record" ADD CONSTRAINT "tbl_work_flow_version_record_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_questionnaire
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_questionnaire";
CREATE TABLE "public"."tbl_questionnaire" (
"id" int4 NOT NULL DEFAULT nextval('tbl_questionnaire_id_seq'::regclass),
"name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"status" int2 DEFAULT 0,
"create_time" timestamp(6),
"update_time" timestamp(6),
"start_time" timestamp(6),
"end_time" timestamp(6),
"uuid" varchar COLLATE "pg_catalog"."default",
"create_by" int4
)
;
COMMENT ON COLUMN "public"."tbl_questionnaire"."name" IS '问卷名称';
COMMENT ON COLUMN "public"."tbl_questionnaire"."status" IS '问卷状态（0-未发布，1-已发布，2已过期）';
COMMENT ON COLUMN "public"."tbl_questionnaire"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_questionnaire"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."tbl_questionnaire"."start_time" IS '有效开始时间';
COMMENT ON COLUMN "public"."tbl_questionnaire"."end_time" IS '有效截至时间';
COMMENT ON COLUMN "public"."tbl_questionnaire"."uuid" IS '唯一id';
COMMENT ON COLUMN "public"."tbl_questionnaire"."create_by" IS '创建人';

-- ----------------------------
-- Primary Key structure for table tbl_questionnaire
-- ----------------------------
ALTER TABLE "public"."tbl_questionnaire" ADD CONSTRAINT "tbl_questionnaire_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_questionnaire_module
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_questionnaire_module";
CREATE TABLE "public"."tbl_questionnaire_module" (
"id" int4 NOT NULL DEFAULT nextval('tbl_questionnaire_module_id_seq'::regclass),
"questionnaire_id" int4 NOT NULL,
"form_object" jsonb,
"sort" int4 NOT NULL,
"create_time" timestamp(6),
"update_time" timestamp(6),
"attribute" varchar(255) COLLATE "pg_catalog"."default",
"value" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."tbl_questionnaire_module"."questionnaire_id" IS '问卷id';
COMMENT ON COLUMN "public"."tbl_questionnaire_module"."form_object" IS '表单对象';
COMMENT ON COLUMN "public"."tbl_questionnaire_module"."sort" IS '排序字段';
COMMENT ON COLUMN "public"."tbl_questionnaire_module"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."tbl_questionnaire_module"."update_time" IS '更新时间';
COMMENT ON COLUMN "public"."tbl_questionnaire_module"."attribute" IS '表单自定义属性';
COMMENT ON COLUMN "public"."tbl_questionnaire_module"."value" IS '表单的默认赋值';

-- ----------------------------
-- Primary Key structure for table tbl_questionnaire_module
-- ----------------------------
ALTER TABLE "public"."tbl_questionnaire_module" ADD CONSTRAINT "tbl_questionnaire_module_pkey" PRIMARY KEY ("id");


-- ----------------------------
-- Table structure for tbl_questionnaire_result
-- ----------------------------
DROP TABLE IF EXISTS "public"."tbl_questionnaire_result";
CREATE TABLE "public"."tbl_questionnaire_result" (
"id" int4 NOT NULL DEFAULT nextval('tbl_questionnaire_result_id_seq'::regclass),
"questionnaire_id" int4,
"result" jsonb,
"uid" int4,
"create_time" timestamp(6) DEFAULT now(),
"web_id" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."tbl_questionnaire_result"."result" IS '表单的属性:值，以json对象保存';
COMMENT ON COLUMN "public"."tbl_questionnaire_result"."uid" IS '填写人uid';
COMMENT ON COLUMN "public"."tbl_questionnaire_result"."web_id" IS '浏览器id';

-- ----------------------------
-- Primary Key structure for table tbl_questionnaire_result
-- ----------------------------
ALTER TABLE "public"."tbl_questionnaire_result" ADD CONSTRAINT "tbl_questionnaire_result_pkey" PRIMARY KEY ("id");

