-- ----------------------------
-- Table structure for state_agreement
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_agreement";
CREATE TABLE "public"."state_agreement" (
  "id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "state_household_id" varchar(255) COLLATE "pg_catalog"."default",
  "append_file_name" varchar(512) COLLATE "pg_catalog"."default",
  "agreement_file_type" int2,
  "money" numeric(255,4) DEFAULT NULL::numeric,
  "sign_at" timestamp(6),
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "del_flag" int2,
  "effective_date" timestamp(6),
  "audit_status" int2,
  "workflow_id" varchar(32) COLLATE "pg_catalog"."default",
  "agreement_number" varchar(255) COLLATE "pg_catalog"."default",
  "file_url" text COLLATE "pg_catalog"."default",
  "exchange_location" varchar(255) COLLATE "pg_catalog"."default",
  "exchange_street" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."state_agreement" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_agreement"."append_file_name" IS '附件名字';
COMMENT ON COLUMN "public"."state_agreement"."agreement_file_type" IS '协议类型';
COMMENT ON COLUMN "public"."state_agreement"."money" IS '金额';
COMMENT ON COLUMN "public"."state_agreement"."sign_at" IS '签字时间';
COMMENT ON COLUMN "public"."state_agreement"."effective_date" IS '模拟转正式的时间 项目生效时间';
COMMENT ON COLUMN "public"."state_agreement"."audit_status" IS '审核状态';
COMMENT ON COLUMN "public"."state_agreement"."agreement_number" IS '协议编号';
COMMENT ON COLUMN "public"."state_agreement"."file_url" IS '文件地址';
COMMENT ON TABLE "public"."state_agreement" IS '补偿/安置协议';


-- ----------------------------
-- Table structure for state_apply_record
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_apply_record";
CREATE TABLE "public"."state_apply_record" (
  "id" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "del_flag" int4,
  "project_id" varchar COLLATE "pg_catalog"."default",
  "record_no" varchar COLLATE "pg_catalog"."default",
  "household_count" varchar(255) COLLATE "pg_catalog"."default",
  "amount" numeric(255,4),
  "apply_status" int4,
  "apply_user" varchar(255) COLLATE "pg_catalog"."default",
  "apply_department" varchar(255) COLLATE "pg_catalog"."default",
  "apply_type" int4,
  "file_url" text COLLATE "pg_catalog"."default",
  "transition_fee_end_date" timestamp(6),
  "transition_fee_start_date" timestamp(6)
)
;
ALTER TABLE "public"."state_apply_record" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_apply_record"."project_id" IS '项目ID';
COMMENT ON COLUMN "public"."state_apply_record"."record_no" IS '记录编号';
COMMENT ON COLUMN "public"."state_apply_record"."household_count" IS '户数';
COMMENT ON COLUMN "public"."state_apply_record"."amount" IS '金额';
COMMENT ON COLUMN "public"."state_apply_record"."apply_status" IS '申请状态';
COMMENT ON COLUMN "public"."state_apply_record"."apply_user" IS '申请人';
COMMENT ON COLUMN "public"."state_apply_record"."apply_department" IS '申请部门';
COMMENT ON COLUMN "public"."state_apply_record"."apply_type" IS '请账类型';
COMMENT ON COLUMN "public"."state_apply_record"."file_url" IS '附件地址';
COMMENT ON COLUMN "public"."state_apply_record"."transition_fee_end_date" IS '过渡费截止时间';
COMMENT ON COLUMN "public"."state_apply_record"."transition_fee_start_date" IS '过渡费开始时间';
COMMENT ON TABLE "public"."state_apply_record" IS '请款';


-- ----------------------------
-- Table structure for state_apply_record_item
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_apply_record_item";
CREATE TABLE "public"."state_apply_record_item" (
  "id" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "del_flag" int4,
  "state_household_owner" varchar(255) COLLATE "pg_catalog"."default",
  "start_distribution_time" timestamp(6),
  "estimated_end_distribution_time" date,
  "distribution_months" varchar(255) COLLATE "pg_catalog"."default",
  "additional_distribution_days" varchar(255) COLLATE "pg_catalog"."default",
  "distribution_amount" varchar(255) COLLATE "pg_catalog"."default",
  "apply_id" varchar COLLATE "pg_catalog"."default",
  "transition_fee" varchar(255) COLLATE "pg_catalog"."default",
  "state_household_id" varchar(32) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."state_apply_record_item" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_apply_record_item"."state_household_owner" IS '权利人id';
COMMENT ON COLUMN "public"."state_apply_record_item"."start_distribution_time" IS '开始发放时间';
COMMENT ON COLUMN "public"."state_apply_record_item"."estimated_end_distribution_time" IS '预计结束发放时间';
COMMENT ON COLUMN "public"."state_apply_record_item"."distribution_months" IS '发放月数';
COMMENT ON COLUMN "public"."state_apply_record_item"."additional_distribution_days" IS '额外发放天数';
COMMENT ON COLUMN "public"."state_apply_record_item"."distribution_amount" IS '发放金额';
COMMENT ON COLUMN "public"."state_apply_record_item"."apply_id" IS '请账单id';
COMMENT ON COLUMN "public"."state_apply_record_item"."transition_fee" IS '过渡费标准';
COMMENT ON COLUMN "public"."state_apply_record_item"."state_household_id" IS '房产id';
COMMENT ON TABLE "public"."state_apply_record_item" IS '请款2';

-- ----------------------------
-- Table structure for state_asset
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_asset";
CREATE TABLE "public"."state_asset" (
  "id" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "del_flag" int4,
  "state_project_id" varchar COLLATE "pg_catalog"."default",
  "virtual_money" numeric(255,4),
  "money_compensation_rate" numeric(255,2),
  "goods_compensation_rate" numeric(255,2),
  "append_file_name" varchar(255) COLLATE "pg_catalog"."default",
  "submitted_by" varchar(255) COLLATE "pg_catalog"."default",
  "status" int4,
  "workflow_id" varchar(255) COLLATE "pg_catalog"."default",
  "file_url" text COLLATE "pg_catalog"."default",
  "street" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."state_asset" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_asset"."state_project_id" IS '项目id';
COMMENT ON COLUMN "public"."state_asset"."virtual_money" IS '预算';
COMMENT ON COLUMN "public"."state_asset"."money_compensation_rate" IS '货币赔偿比例';
COMMENT ON COLUMN "public"."state_asset"."goods_compensation_rate" IS '产权置比例';
COMMENT ON COLUMN "public"."state_asset"."submitted_by" IS '上报人';
COMMENT ON COLUMN "public"."state_asset"."status" IS '审核状态(0已退回 2审核中 3已接收)';
COMMENT ON COLUMN "public"."state_asset"."file_url" IS '附件地址';
COMMENT ON COLUMN "public"."state_asset"."street" IS '房产街道';
COMMENT ON TABLE "public"."state_asset" IS '项目资金-预算';

-- ----------------------------
-- Table structure for state_household
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_household";
CREATE TABLE "public"."state_household" (
  "id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "house_using_type" int4,
  "street" varchar(255) COLLATE "pg_catalog"."default",
  "door_number" varchar(255) COLLATE "pg_catalog"."default",
  "apartment_number" varchar(255) COLLATE "pg_catalog"."default",
  "building_number" varchar(255) COLLATE "pg_catalog"."default",
  "unit" varchar(255) COLLATE "pg_catalog"."default",
  "floor" varchar(255) COLLATE "pg_catalog"."default",
  "room_number" varchar(255) COLLATE "pg_catalog"."default",
  "household_location" varchar(255) COLLATE "pg_catalog"."default",
  "real_estate_certificate_number" varchar(255) COLLATE "pg_catalog"."default",
  "using_area_certificate_number" varchar(255) COLLATE "pg_catalog"."default",
  "production_type" int2,
  "house_hold_area" numeric(50,2),
  "compensation_type" int2 DEFAULT 1,
  "compensation_money" numeric(255,0) DEFAULT 0,
  "agree_move" int2,
  "is_government_help" int2,
  "help_type" int2,
  "building_inner_area" numeric(255,2),
  "public_using_area" numeric(255,2),
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "del_flag" int2,
  "collection_status" int2,
  "state_project_id" varchar(255) COLLATE "pg_catalog"."default",
  "append_data" text COLLATE "pg_catalog"."default",
  "file_url" text COLLATE "pg_catalog"."default",
  "status" int2,
  "work_flow_id" varchar(255) COLLATE "pg_catalog"."default",
  "search_status" int2,
  "dept_id" varchar(32) COLLATE "pg_catalog"."default",
  "agreement_status" int2,
  "belonging_street_town" varchar(255) COLLATE "pg_catalog"."default",
  "stage" int4,
  "app_household_location" text COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."state_household" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_household"."house_using_type" IS '房屋使用用途';
COMMENT ON COLUMN "public"."state_household"."street" IS '街道';
COMMENT ON COLUMN "public"."state_household"."door_number" IS '门牌号';
COMMENT ON COLUMN "public"."state_household"."apartment_number" IS '附号';
COMMENT ON COLUMN "public"."state_household"."building_number" IS '栋号';
COMMENT ON COLUMN "public"."state_household"."unit" IS '单元';
COMMENT ON COLUMN "public"."state_household"."floor" IS '楼层';
COMMENT ON COLUMN "public"."state_household"."room_number" IS '房号';
COMMENT ON COLUMN "public"."state_household"."household_location" IS '最终地址';
COMMENT ON COLUMN "public"."state_household"."real_estate_certificate_number" IS '不动产权证号';
COMMENT ON COLUMN "public"."state_household"."using_area_certificate_number" IS '国土土地使用证号';
COMMENT ON COLUMN "public"."state_household"."production_type" IS '产别';
COMMENT ON COLUMN "public"."state_household"."house_hold_area" IS '建筑面积';
COMMENT ON COLUMN "public"."state_household"."compensation_type" IS '赔偿方式';
COMMENT ON COLUMN "public"."state_household"."compensation_money" IS '赔偿金额';
COMMENT ON COLUMN "public"."state_household"."agree_move" IS '是否搬迁';
COMMENT ON COLUMN "public"."state_household"."is_government_help" IS '政府援助';
COMMENT ON COLUMN "public"."state_household"."help_type" IS '救助类型';
COMMENT ON COLUMN "public"."state_household"."building_inner_area" IS '套内面积';
COMMENT ON COLUMN "public"."state_household"."public_using_area" IS '公摊面积';
COMMENT ON COLUMN "public"."state_household"."collection_status" IS '模拟征收';
COMMENT ON COLUMN "public"."state_household"."append_data" IS '房产赔偿 附加信息';
COMMENT ON COLUMN "public"."state_household"."file_url" IS '文件url';
COMMENT ON COLUMN "public"."state_household"."status" IS '审核状态';
COMMENT ON COLUMN "public"."state_household"."search_status" IS '调查状态（0未调查，1已调查，2已评估） 转征收后状态自动回到 1已调出查的状态';
COMMENT ON COLUMN "public"."state_household"."dept_id" IS '实施部门id';
COMMENT ON COLUMN "public"."state_household"."agreement_status" IS '协议审核状态';
COMMENT ON COLUMN "public"."state_household"."belonging_street_town" IS '所属镇街';
COMMENT ON COLUMN "public"."state_household"."stage" IS '1 模拟  2 征收';
COMMENT ON COLUMN "public"."state_household"."app_household_location" IS 'app端地址';
COMMENT ON TABLE "public"."state_household" IS '国有房产';

-- ----------------------------
-- Table structure for state_household_owner
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_household_owner";
CREATE TABLE "public"."state_household_owner" (
  "id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "state_household_id" varchar(255) COLLATE "pg_catalog"."default",
  "owner_name" varchar(255) COLLATE "pg_catalog"."default",
  "person_id_card" varchar(255) COLLATE "pg_catalog"."default",
  "phone_number" varchar(255) COLLATE "pg_catalog"."default",
  "append_data" text COLLATE "pg_catalog"."default",
  "create_time" timestamp(6),
  "create_by" varchar(255) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar COLLATE "pg_catalog"."default",
  "del_flag" int2,
  "company_social_code" varchar(255) COLLATE "pg_catalog"."default",
  "connected_person" varchar(255) COLLATE "pg_catalog"."default",
  "owner_type" int2,
  "company_agent" varchar(255) COLLATE "pg_catalog"."default",
  "is_help" int4,
  "help_type" varchar(32) COLLATE "pg_catalog"."default",
  "compensation_type" int4,
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "sex" varchar(32) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."state_household_owner" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_household_owner"."owner_name" IS '名字';
COMMENT ON COLUMN "public"."state_household_owner"."person_id_card" IS '身份证号码';
COMMENT ON COLUMN "public"."state_household_owner"."phone_number" IS '联系方式';
COMMENT ON COLUMN "public"."state_household_owner"."append_data" IS '补偿信息';
COMMENT ON COLUMN "public"."state_household_owner"."company_social_code" IS '信用码';
COMMENT ON COLUMN "public"."state_household_owner"."connected_person" IS '联系人';
COMMENT ON COLUMN "public"."state_household_owner"."owner_type" IS '权利人类型 1 私人 2 企业';
COMMENT ON COLUMN "public"."state_household_owner"."company_agent" IS '法人';
COMMENT ON COLUMN "public"."state_household_owner"."is_help" IS '1是 0否';
COMMENT ON COLUMN "public"."state_household_owner"."help_type" IS '字典表 可以多选';
COMMENT ON COLUMN "public"."state_household_owner"."compensation_type" IS '    MONKEY(1, "货币赔偿"),
    GOODS(2, "产权置换");';
COMMENT ON COLUMN "public"."state_household_owner"."remark" IS '备注';
COMMENT ON COLUMN "public"."state_household_owner"."sex" IS '1男 2 女';
COMMENT ON TABLE "public"."state_household_owner" IS '国有房产权利人';


-- ----------------------------
-- Table structure for state_process_ext_instance
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_process_ext_instance";
CREATE TABLE "public"."state_process_ext_instance" (
  "id" varchar(40) COLLATE "pg_catalog"."default" NOT NULL,
  "template_id" varchar(40) COLLATE "pg_catalog"."default",
  "process_id" varchar(255) COLLATE "pg_catalog"."default",
  "process_version" int2,
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "del_flag" int2
)
;
ALTER TABLE "public"."state_process_ext_instance" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_process_ext_instance"."id" IS 'flw实例id';
COMMENT ON COLUMN "public"."state_process_ext_instance"."template_id" IS '模版id';
COMMENT ON COLUMN "public"."state_process_ext_instance"."process_id" IS 'flw流程id';
COMMENT ON COLUMN "public"."state_process_ext_instance"."process_version" IS 'flw流程版本';


-- ----------------------------
-- Table structure for state_process_instance_action
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_process_instance_action";
CREATE TABLE "public"."state_process_instance_action" (
  "id" varchar(40) COLLATE "pg_catalog"."default" NOT NULL,
  "instance_id" varchar(40) COLLATE "pg_catalog"."default",
  "comment" varchar(50) COLLATE "pg_catalog"."default",
  "robot" bool,
  "auditor_id" varchar(255) COLLATE "pg_catalog"."default",
  "action_type" int2,
  "user_ids" varchar(255) COLLATE "pg_catalog"."default",
  "assignee_id" varchar(40) COLLATE "pg_catalog"."default",
  "node_id" varchar(100) COLLATE "pg_catalog"."default",
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "del_flag" int2 DEFAULT 0,
  "remark" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."state_process_instance_action" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_process_instance_action"."id" IS '主键';
COMMENT ON COLUMN "public"."state_process_instance_action"."instance_id" IS '流程实例id';
COMMENT ON COLUMN "public"."state_process_instance_action"."comment" IS '评论';
COMMENT ON COLUMN "public"."state_process_instance_action"."robot" IS '抄送、自动审批：true';
COMMENT ON COLUMN "public"."state_process_instance_action"."auditor_id" IS '审批办理人id';
COMMENT ON COLUMN "public"."state_process_instance_action"."action_type" IS '动作类型';
COMMENT ON COLUMN "public"."state_process_instance_action"."user_ids" IS '抄送人';
COMMENT ON COLUMN "public"."state_process_instance_action"."assignee_id" IS '分配人ID';
COMMENT ON COLUMN "public"."state_process_instance_action"."node_id" IS '节点id';
COMMENT ON COLUMN "public"."state_process_instance_action"."remark" IS '原因';
COMMENT ON TABLE "public"."state_process_instance_action" IS '工作流-实例操作记录表';

-- ----------------------------
-- Table structure for state_process_module
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_process_module";
CREATE TABLE "public"."state_process_module" (
  "id" varchar(40) COLLATE "pg_catalog"."default" NOT NULL,
  "category" varchar(255) COLLATE "pg_catalog"."default",
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "template_name" varchar(255) COLLATE "pg_catalog"."default",
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "template_id" varchar(40) COLLATE "pg_catalog"."default",
  "remark" text COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."state_process_module" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_process_module"."id" IS 'id';
COMMENT ON COLUMN "public"."state_process_module"."category" IS '规格类型';
COMMENT ON COLUMN "public"."state_process_module"."name" IS '涉及类型';
COMMENT ON COLUMN "public"."state_process_module"."template_name" IS '流程名称';
COMMENT ON COLUMN "public"."state_process_module"."template_id" IS '流程id';
COMMENT ON COLUMN "public"."state_process_module"."remark" IS '备注';

-- ----------------------------
-- Table structure for state_process_template
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_process_template";
CREATE TABLE "public"."state_process_template" (
  "id" varchar(40) COLLATE "pg_catalog"."default" NOT NULL,
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "template_key" varchar(255) COLLATE "pg_catalog"."default",
  "template_version" int2 DEFAULT 1,
  "template_name" varchar(40) COLLATE "pg_catalog"."default",
  "settings" varchar(255) COLLATE "pg_catalog"."default",
  "process" text COLLATE "pg_catalog"."default",
  "remark" varchar(255) COLLATE "pg_catalog"."default",
  "status" int2 DEFAULT 1,
  "work_flow_id" int8,
  "workflow_version" int2,
  "del_flag" int2 DEFAULT 0
)
;
ALTER TABLE "public"."state_process_template" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_process_template"."id" IS '主键';
COMMENT ON COLUMN "public"."state_process_template"."template_key" IS '模版标识';
COMMENT ON COLUMN "public"."state_process_template"."template_version" IS '版本,默认1';
COMMENT ON COLUMN "public"."state_process_template"."template_name" IS '模版名称';
COMMENT ON COLUMN "public"."state_process_template"."settings" IS '基础设置';
COMMENT ON COLUMN "public"."state_process_template"."process" IS '流程定义';
COMMENT ON COLUMN "public"."state_process_template"."remark" IS '备注';
COMMENT ON COLUMN "public"."state_process_template"."status" IS '0:停用;1:正常';
COMMENT ON COLUMN "public"."state_process_template"."work_flow_id" IS 'workflow_id';
COMMENT ON COLUMN "public"."state_process_template"."workflow_version" IS 'workflow流程版本';
COMMENT ON TABLE "public"."state_process_template" IS '工作流-模版';

-- ----------------------------
-- Table structure for state_project
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_project";
CREATE TABLE "public"."state_project" (
  "id" varchar(64) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "project_no" varchar(100) COLLATE "pg_catalog"."default",
  "project_name" varchar(255) COLLATE "pg_catalog"."default",
  "status" int4,
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "del_flag" int4,
  "street" varchar(255) COLLATE "pg_catalog"."default",
  "department" varchar(255) COLLATE "pg_catalog"."default",
  "start_time" timestamp(6),
  "file_url" text COLLATE "pg_catalog"."default",
  "is_need_evaluate" int4,
  "workflow_id" varchar(255) COLLATE "pg_catalog"."default",
  "audit_status" int4,
  "simulated_time" timestamp(6),
  "levy_time" timestamp(6),
  "process_changed_time" timestamp(0),
  "price_status" int4,
  "cancel_time" timestamp(6),
  "finished_time" timestamp(6),
  "pre_status_by_cancel" int4,
  "stage" int4
)
;
ALTER TABLE "public"."state_project" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_project"."project_no" IS '项目编号';
COMMENT ON COLUMN "public"."state_project"."project_name" IS '项目名称';
COMMENT ON COLUMN "public"."state_project"."status" IS '状态（表示阶段）     CANCELLATION(-1, "作废", "cancellation"),
    SIMULATE(0, "模拟", "simulate"),
    LEVY(1, "征收", "signed"),
    HOUSEHOLD_SURVEY(2, "入户调查","house"),
    SUCCESS(3, "完成", "settled"),';
COMMENT ON COLUMN "public"."state_project"."street" IS '所属街道';
COMMENT ON COLUMN "public"."state_project"."department" IS '实施单位';
COMMENT ON COLUMN "public"."state_project"."start_time" IS '启动时间';
COMMENT ON COLUMN "public"."state_project"."file_url" IS '文件json数据';
COMMENT ON COLUMN "public"."state_project"."is_need_evaluate" IS '是否需要二次评估  0 不需要  1需要';
COMMENT ON COLUMN "public"."state_project"."workflow_id" IS '工作流id';
COMMENT ON COLUMN "public"."state_project"."audit_status" IS '入户调查审核状态';
COMMENT ON COLUMN "public"."state_project"."simulated_time" IS '转模拟时间';
COMMENT ON COLUMN "public"."state_project"."levy_time" IS '转征收时间';
COMMENT ON COLUMN "public"."state_project"."price_status" IS '价格评估审核状态';
COMMENT ON COLUMN "public"."state_project"."cancel_time" IS '作废时间';
COMMENT ON COLUMN "public"."state_project"."finished_time" IS '完成时间';
COMMENT ON COLUMN "public"."state_project"."pre_status_by_cancel" IS '作废前状态';
COMMENT ON COLUMN "public"."state_project"."stage" IS 'app端判断是否已完成';
COMMENT ON TABLE "public"."state_project" IS '国有项目';

-- ----------------------------
-- Table structure for state_project_collection_file
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_project_collection_file";
CREATE TABLE "public"."state_project_collection_file" (
  "id" varchar(32) COLLATE "pg_catalog"."default" NOT NULL DEFAULT nextval('state_project_collection_file_id_seq'::regclass),
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "del_flag" int4,
  "file_type" int4,
  "file_url" varchar(255) COLLATE "pg_catalog"."default",
  "file_name" varchar(255) COLLATE "pg_catalog"."default",
  "project_id" varchar(255) COLLATE "pg_catalog"."default",
  "parent_id" varchar COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."state_project_collection_file" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_project_collection_file"."file_type" IS '征收文件类型  APPLICATION(0, "房屋征收申请书"),
    ECONOMIC_PLAN_APPROVAL(1, "设项目符合国民经济和社会发展规划的证明文件"),
    LAND_USE_APPROVAL(2, "建设项目符合土地利用总体规划证明文件"),
    URBAN_PLAN_APPROVAL(3, "建设项目符合城乡总体规划和专项规划的证明文件"),
    SOCIAL_PLAN_APPROVAL(4, "保障性安居工程建设、旧城区改建项目纳入国民经济和社会发展年度计划的证明文件"),
    OWNER_APPROVAL(5, "房屋所有权总面积超过三分之二且总户数超过三分之二的房屋所有权人明确同意改建的证明材料"),
    COMPENSATION_PLAN(6, "经征求公众意见后确定的房屋征收补偿方案"),
    RISK_ASSESSMENT_REPORT(7, "社会稳定风险评估报告"),
    COMPENSATION_FUNDS_PROOF(8, "征收补偿费用到位资金证明"),
    RESETTLEMENT_HOUSING_PROOF(9, "安置房房源相关材料证明"),
    COMPENSATION_AGREEMENT_PROOF(10, "房屋征收部门组织被征收人签订附生效条件的补偿协议户数达到规定比例的证明材料"),
    ACQUISITION_APPLICATION_FORM(11, "国有土地上房屋征收申报审批表"),
    OTHER_DOCUMENTS(12, "其他资料"),
    URBAN_RENEWAL_APPROVAL(13, "旧城改造批准文件"),
    GOVERNMENT_PURCHASE_APPROVAL(14, "政府同意收购相关文件或收购协议"),
    AUTHORITY_APPROVAL(15, "有权批准机关批复文件"),
    DEMOLITION_PERMIT(16, "房屋拆迁许可证"),
    DEMOLITION_NOTICE(17, "拆迁公告"),
    DEMOLITION_MAP(18, "1:500比例拆迁地形红线图"),
    LAND_CERTIFICATE_CANCEL(19, "原存量国有建设用地土地使用证和房产证注销手';
COMMENT ON COLUMN "public"."state_project_collection_file"."file_url" IS '文件地址';
COMMENT ON COLUMN "public"."state_project_collection_file"."file_name" IS '文件名字';
COMMENT ON COLUMN "public"."state_project_collection_file"."project_id" IS '项目id';
COMMENT ON COLUMN "public"."state_project_collection_file"."parent_id" IS '父id';
COMMENT ON TABLE "public"."state_project_collection_file" IS '国有项目征收文件';

-- ----------------------------
-- Table structure for state_project_compensate_standard
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_project_compensate_standard";
CREATE TABLE "public"."state_project_compensate_standard" (
  "id" varchar(40) COLLATE "pg_catalog"."default" NOT NULL,
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "del_flag" int4,
  "category" int4 DEFAULT 0,
  "compensate_type" int4,
  "unit" varchar(255) COLLATE "pg_catalog"."default",
  "compensate_standard" varchar(255) COLLATE "pg_catalog"."default",
  "standard_name" varchar(255) COLLATE "pg_catalog"."default",
  "stop_flag" int4,
  "specification" varchar(255) COLLATE "pg_catalog"."default",
  "remake" text COLLATE "pg_catalog"."default",
  "sub_type" int4
)
;
ALTER TABLE "public"."state_project_compensate_standard" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_project_compensate_standard"."category" IS '// 货币补偿类型
    MONEY_COMPENSATION(101, "货币补偿"),
    PROPERTY_SWAP(102, "产权置换"),

    // 搬迁类补偿
    PHONE_RELOCATION(201, "电话移机"),
    CABLE_TV_RELOCATION(202, "有线电视迁装"),
    BROADBAND_RELOCATION(203, "宽带迁装"),
    AIR_CONDITIONER_RELOCATION(204, "空调移机"),
    ONE_HOUSE_ONE_METER(205, "一户一表"),
    GAS_INITIAL_INSTALLATION(206, "天然气初装"),

    // 补助费类型
    TEMPORARY_HOUSING_ALLOWANCE(301, "住宅临时安置补助费"),
    NON_RESIDENTIAL_ECONOMIC_LOSS_ALLOWANCE(302, "非住宅停产、停业经济损失补助费"),
    MOVING_ALLOWANCE(303, "搬家补助费"),

    // 补贴类型
    HOUSE_PURCHASE_SUBSIDY(401, "购房补贴"),
    PROPERTY_MANAGEMENT_SUBSIDY(402, "物管费补贴"),

    // 奖励类型
    EARLY_RELOCATION_BONUS(501, "提前搬迁奖励"';
COMMENT ON COLUMN "public"."state_project_compensate_standard"."compensate_type" IS '补偿类型    HOUSE_ACQUISITION_COMPENSATION_FEE(1, "征收房屋补偿费"),     POLICY_COMPENSATION_FEE(2, "政策性补偿费"),     POLICY_SUBSIDY_FEE(3, "政策性补助费"),     POLICY_ALLOWANCE(4, "政策性补贴"),     EARLY_RELOCATION_REWARD(5, "提前搬迁奖励");';
COMMENT ON COLUMN "public"."state_project_compensate_standard"."unit" IS '单位（例如平米）';
COMMENT ON COLUMN "public"."state_project_compensate_standard"."compensate_standard" IS '补偿标准';
COMMENT ON COLUMN "public"."state_project_compensate_standard"."standard_name" IS '标准名称';
COMMENT ON COLUMN "public"."state_project_compensate_standard"."stop_flag" IS '是否停用 0 停用 1启用';
COMMENT ON COLUMN "public"."state_project_compensate_standard"."specification" IS '规格';
COMMENT ON COLUMN "public"."state_project_compensate_standard"."remake" IS '备注';
COMMENT ON COLUMN "public"."state_project_compensate_standard"."sub_type" IS '1单价2区间';
COMMENT ON TABLE "public"."state_project_compensate_standard" IS '国有项目 补偿标准';


-- ----------------------------
-- Table structure for state_project_compensation
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_project_compensation";
CREATE TABLE "public"."state_project_compensation" (
  "project_id" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "del_flag" int4,
  "compensation_type" varchar(255) COLLATE "pg_catalog"."default",
  "policy_compensation_type" varchar(255) COLLATE "pg_catalog"."default",
  "policy_subsidy" varchar(255) COLLATE "pg_catalog"."default",
  "policy_supplement" varchar(255) COLLATE "pg_catalog"."default",
  "award" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."state_project_compensation" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_project_compensation"."compensation_type" IS '赔偿标准';
COMMENT ON COLUMN "public"."state_project_compensation"."policy_compensation_type" IS '政策补偿';
COMMENT ON COLUMN "public"."state_project_compensation"."policy_subsidy" IS '补助';
COMMENT ON COLUMN "public"."state_project_compensation"."policy_supplement" IS '补贴';
COMMENT ON COLUMN "public"."state_project_compensation"."award" IS '奖励';
COMMENT ON TABLE "public"."state_project_compensation" IS '国有项目对应的补偿标准';


-- ----------------------------
-- Table structure for state_project_info
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_project_info";
CREATE TABLE "public"."state_project_info" (
  "project_id" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "del_flag" int4,
  "resettlement_type" varchar(255) COLLATE "pg_catalog"."default",
  "department_address" varchar(255) COLLATE "pg_catalog"."default",
  "scope_collection" text COLLATE "pg_catalog"."default",
  "agent_phone" varchar(255) COLLATE "pg_catalog"."default",
  "project_remake" text COLLATE "pg_catalog"."default",
  "project_type" varchar(255) COLLATE "pg_catalog"."default",
  "house_collection_department" varchar(255) COLLATE "pg_catalog"."default",
  "legal_person" varchar(255) COLLATE "pg_catalog"."default",
  "collection_enforcement_department" varchar(255) COLLATE "pg_catalog"."default",
  "charge_person" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."state_project_info" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_project_info"."resettlement_type" IS '安置类型（多个）    MONKEY(1, "货币赔偿"),
    GOODS(2, "房屋产权置换");';
COMMENT ON COLUMN "public"."state_project_info"."department_address" IS '单位地址';
COMMENT ON COLUMN "public"."state_project_info"."scope_collection" IS '征收范围存json';
COMMENT ON COLUMN "public"."state_project_info"."agent_phone" IS '经办人电话';
COMMENT ON COLUMN "public"."state_project_info"."project_remake" IS '项目备注（存建设目的）';
COMMENT ON COLUMN "public"."state_project_info"."project_type" IS '项目类型';
COMMENT ON COLUMN "public"."state_project_info"."house_collection_department" IS '房屋征收部门';
COMMENT ON COLUMN "public"."state_project_info"."legal_person" IS '法人';
COMMENT ON COLUMN "public"."state_project_info"."collection_enforcement_department" IS '征收执行部门';
COMMENT ON COLUMN "public"."state_project_info"."charge_person" IS '负责人';
COMMENT ON TABLE "public"."state_project_info" IS '国有项目详情';


-- ----------------------------
-- Table structure for state_project_notice
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_project_notice";
CREATE TABLE "public"."state_project_notice" (
  "id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL DEFAULT nextval('state_project_notice_id_seq'::regclass),
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "del_flag" int4,
  "project_id" varchar(64) COLLATE "pg_catalog"."default",
  "notice_no" varchar(255) COLLATE "pg_catalog"."default",
  "notice_name" varchar(255) COLLATE "pg_catalog"."default",
  "publishing_department" varchar(255) COLLATE "pg_catalog"."default",
  "start_time" timestamp(6),
  "end_time" timestamp(6),
  "notice_web" varchar(255) COLLATE "pg_catalog"."default",
  "notice_content" text COLLATE "pg_catalog"."default",
  "file_url" text COLLATE "pg_catalog"."default",
  "img_url" text COLLATE "pg_catalog"."default",
  "type" int4
)
;
ALTER TABLE "public"."state_project_notice" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_project_notice"."project_id" IS '项目公告';
COMMENT ON COLUMN "public"."state_project_notice"."notice_no" IS '公告编号';
COMMENT ON COLUMN "public"."state_project_notice"."notice_name" IS '公告名称';
COMMENT ON COLUMN "public"."state_project_notice"."publishing_department" IS '发布单位';
COMMENT ON COLUMN "public"."state_project_notice"."start_time" IS '开始时间';
COMMENT ON COLUMN "public"."state_project_notice"."end_time" IS '结束时间';
COMMENT ON COLUMN "public"."state_project_notice"."notice_web" IS '公式网站';
COMMENT ON COLUMN "public"."state_project_notice"."notice_content" IS '公告内容';
COMMENT ON COLUMN "public"."state_project_notice"."file_url" IS '文件地址';
COMMENT ON COLUMN "public"."state_project_notice"."img_url" IS '图片地址';
COMMENT ON COLUMN "public"."state_project_notice"."type" IS '1 正常公告 2转征收的公告';
COMMENT ON TABLE "public"."state_project_notice" IS '国有项目公告';


-- ----------------------------
-- Table structure for state_recording
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_recording";
CREATE TABLE "public"."state_recording" (
  "id" varchar(40) COLLATE "pg_catalog"."default" NOT NULL,
  "project_id" varchar(40) COLLATE "pg_catalog"."default",
  "batch_id" varchar(40) COLLATE "pg_catalog"."default",
  "object_name" varchar(255) COLLATE "pg_catalog"."default",
  "object_type" varchar(255) COLLATE "pg_catalog"."default",
  "object_state" int4,
  "creation_time" timestamp(6)
)
;
ALTER TABLE "public"."state_recording" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_recording"."project_id" IS '项目id';
COMMENT ON COLUMN "public"."state_recording"."batch_id" IS '宗地id';
COMMENT ON COLUMN "public"."state_recording"."object_name" IS '对象名称';
COMMENT ON COLUMN "public"."state_recording"."object_type" IS '对象类型';
COMMENT ON COLUMN "public"."state_recording"."object_state" IS '状态';
COMMENT ON COLUMN "public"."state_recording"."creation_time" IS '创建时间';

-- ----------------------------
-- Records of state_recording
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for state_settlement
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_settlement";
CREATE TABLE "public"."state_settlement" (
  "id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "exchange_location" varchar(255) COLLATE "pg_catalog"."default",
  "exchange_street" varchar(255) COLLATE "pg_catalog"."default",
  "exchange_money" numeric(255,4),
  "exchange_area" numeric(255,2),
  "settlement_area" numeric(255,2),
  "settlement_money" numeric(255,4),
  "paid_time" timestamp(6),
  "append" varchar(255) COLLATE "pg_catalog"."default",
  "del_flag" int2,
  "create_time" timestamp(6),
  "create_by" varchar(40) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar(40) COLLATE "pg_catalog"."default",
  "state_household_id" varchar(255) COLLATE "pg_catalog"."default",
  "settle_name" varchar(255) COLLATE "pg_catalog"."default",
  "audit_status" int2,
  "file_url" text COLLATE "pg_catalog"."default",
  "workflow_id" varchar(32) COLLATE "pg_catalog"."default",
  "task_id" varchar COLLATE "pg_catalog"."default",
  "settle_department" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "public"."state_settlement" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_settlement"."exchange_location" IS '置换后位置';
COMMENT ON COLUMN "public"."state_settlement"."exchange_street" IS '置换后街道';
COMMENT ON COLUMN "public"."state_settlement"."exchange_money" IS '置换后金额';
COMMENT ON COLUMN "public"."state_settlement"."exchange_area" IS '置换后面积';
COMMENT ON COLUMN "public"."state_settlement"."settlement_area" IS '结算面积';
COMMENT ON COLUMN "public"."state_settlement"."settlement_money" IS '结算金额';
COMMENT ON COLUMN "public"."state_settlement"."paid_time" IS '付款时间';
COMMENT ON COLUMN "public"."state_settlement"."append" IS '备注';
COMMENT ON COLUMN "public"."state_settlement"."settle_name" IS '批次名字';
COMMENT ON COLUMN "public"."state_settlement"."audit_status" IS '审核状态';
COMMENT ON COLUMN "public"."state_settlement"."file_url" IS '附件地址';
COMMENT ON COLUMN "public"."state_settlement"."settle_department" IS '安置实施单位';
COMMENT ON TABLE "public"."state_settlement" IS '国有项目安置情况';


-- ----------------------------
-- Table structure for state_task_center
-- ----------------------------
DROP TABLE IF EXISTS "public"."state_task_center";
CREATE TABLE "public"."state_task_center" (
  "id" varchar(64) COLLATE "pg_catalog"."default",
  "name" text COLLATE "pg_catalog"."default",
  "module_name" text COLLATE "pg_catalog"."default",
  "remark" text COLLATE "pg_catalog"."default",
  "category" text COLLATE "pg_catalog"."default",
  "flow_id" varchar(255) COLLATE "pg_catalog"."default",
  "variable" text COLLATE "pg_catalog"."default",
  "create_time" timestamp(6) DEFAULT now(),
  "create_by" varchar(255) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "update_by" varchar COLLATE "pg_catalog"."default",
  "del_flag" int2 DEFAULT 0,
  "type" int2
)
;
ALTER TABLE "public"."state_task_center" OWNER TO "postgres";
COMMENT ON COLUMN "public"."state_task_center"."id" IS '主键';
COMMENT ON COLUMN "public"."state_task_center"."name" IS '任务名称';
COMMENT ON COLUMN "public"."state_task_center"."module_name" IS '模块名称';
COMMENT ON COLUMN "public"."state_task_center"."remark" IS '系统摘要';
COMMENT ON COLUMN "public"."state_task_center"."category" IS '类型';
COMMENT ON COLUMN "public"."state_task_center"."flow_id" IS '工作流id';
COMMENT ON COLUMN "public"."state_task_center"."variable" IS '对应类型id';
COMMENT ON COLUMN "public"."state_task_center"."type" IS '类型 1集体 2国有';
COMMENT ON TABLE "public"."state_task_center" IS '任务';



-- ----------------------------
-- Table structure for flw_his_task_actor
-- ----------------------------
DROP TABLE IF EXISTS "public"."flw_his_task_actor";
CREATE TABLE "public"."flw_his_task_actor" (
                                               "id" int8 NOT NULL,
                                               "tenant_id" varchar(50) COLLATE "pg_catalog"."default",
                                               "instance_id" int8 NOT NULL,
                                               "task_id" int8 NOT NULL,
                                               "actor_id" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
                                               "actor_name" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
                                               "actor_type" int4 NOT NULL,
                                               "weight" int4,
                                               "agent_id" varchar(100) COLLATE "pg_catalog"."default",
                                               "agent_type" int4,
                                               "extend" text COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."flw_his_task_actor"."id" IS '主键 ID';
COMMENT ON COLUMN "public"."flw_his_task_actor"."tenant_id" IS '租户ID';
COMMENT ON COLUMN "public"."flw_his_task_actor"."instance_id" IS '流程实例ID';
COMMENT ON COLUMN "public"."flw_his_task_actor"."task_id" IS '任务ID';
COMMENT ON COLUMN "public"."flw_his_task_actor"."actor_id" IS '参与者ID';
COMMENT ON COLUMN "public"."flw_his_task_actor"."actor_name" IS '参与者名称';
COMMENT ON COLUMN "public"."flw_his_task_actor"."actor_type" IS '参与者类型 0，用户 1，角色 2，部门';
COMMENT ON COLUMN "public"."flw_his_task_actor"."weight" IS '票签权重';
COMMENT ON COLUMN "public"."flw_his_task_actor"."agent_id" IS '代理人ID';
COMMENT ON COLUMN "public"."flw_his_task_actor"."agent_type" IS '代理人类型 0，代理 1，被代理 2，认领角色 3，认领部门';
COMMENT ON COLUMN "public"."flw_his_task_actor"."extend" IS '扩展json';
COMMENT ON TABLE "public"."flw_his_task_actor" IS '历史任务参与者表';

-- ----------------------------
-- Table structure for flw_his_task
-- ----------------------------
DROP TABLE IF EXISTS "public"."flw_his_task";
CREATE TABLE "public"."flw_his_task" (
                                         "id" int8 NOT NULL,
                                         "tenant_id" varchar(50) COLLATE "pg_catalog"."default",
                                         "create_id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
                                         "create_by" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
                                         "create_time" timestamp(6) NOT NULL,
                                         "instance_id" int8 NOT NULL,
                                         "parent_task_id" int8,
                                         "call_process_id" int8,
                                         "call_instance_id" int8,
                                         "task_name" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
                                         "task_key"  varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
                                         "task_type" int2 NOT NULL,
                                         "perform_type" int2,
                                         "action_url" varchar(200) COLLATE "pg_catalog"."default",
                                         "variable" text COLLATE "pg_catalog"."default",
                                         "assignor_id" varchar(100) COLLATE "pg_catalog"."default",
                                         "assignor" varchar(255) COLLATE "pg_catalog"."default",
                                         "expire_time" timestamp(6),
                                         "remind_time" timestamp(6),
                                         "remind_repeat" int2 NOT NULL DEFAULT 0,
                                         "viewed" int2 NOT NULL DEFAULT 0,
                                         "finish_time" timestamp(6),
                                         "task_state" int2 NOT NULL DEFAULT 0,
                                         "duration" int8
)
;
COMMENT ON COLUMN "public"."flw_his_task"."id" IS '主键ID';
COMMENT ON COLUMN "public"."flw_his_task"."tenant_id" IS '租户ID';
COMMENT ON COLUMN "public"."flw_his_task"."create_id" IS '创建人ID';
COMMENT ON COLUMN "public"."flw_his_task"."create_by" IS '创建人名称';
COMMENT ON COLUMN "public"."flw_his_task"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."flw_his_task"."instance_id" IS '流程实例ID';
COMMENT ON COLUMN "public"."flw_his_task"."parent_task_id" IS '父任务ID';
COMMENT ON COLUMN "public"."flw_his_task"."call_process_id" IS '调用外部流程定义ID';
COMMENT ON COLUMN "public"."flw_his_task"."call_instance_id" IS '调用外部流程实例ID';
COMMENT ON COLUMN "public"."flw_his_task"."task_name" IS '任务名称';
COMMENT ON COLUMN "public"."flw_his_task"."task_key" IS '任务 key 唯一标识';
COMMENT ON COLUMN "public"."flw_his_task"."task_type" IS '任务类型';
COMMENT ON COLUMN "public"."flw_his_task"."perform_type" IS '参与类型';
COMMENT ON COLUMN "public"."flw_his_task"."action_url" IS '任务处理的url';
COMMENT ON COLUMN "public"."flw_his_task"."variable" IS '变量json';
COMMENT ON COLUMN "public"."flw_his_task"."assignor_id" IS '委托人ID';
COMMENT ON COLUMN "public"."flw_his_task"."assignor" IS '委托人';
COMMENT ON COLUMN "public"."flw_his_task"."expire_time" IS '任务期望完成时间';
COMMENT ON COLUMN "public"."flw_his_task"."remind_time" IS '提醒时间';
COMMENT ON COLUMN "public"."flw_his_task"."remind_repeat" IS '提醒次数';
COMMENT ON COLUMN "public"."flw_his_task"."viewed" IS '已阅 0，否 1，是';
COMMENT ON COLUMN "public"."flw_his_task"."finish_time" IS '任务完成时间';
COMMENT ON COLUMN "public"."flw_his_task"."task_state" IS '任务状态 0，活动 1，跳转 2，完成 3，拒绝 4，撤销审批  5，超时 6，终止 7，驳回终止';
COMMENT ON COLUMN "public"."flw_his_task"."duration" IS '处理耗时';
COMMENT ON TABLE "public"."flw_his_task" IS '历史任务表';

-- ----------------------------
-- Table structure for flw_task_actor
-- ----------------------------
DROP TABLE IF EXISTS "public"."flw_task_actor";
CREATE TABLE "public"."flw_task_actor" (
                                           "id" int8 NOT NULL,
                                           "tenant_id" varchar(50) COLLATE "pg_catalog"."default",
                                           "instance_id" int8 NOT NULL,
                                           "task_id" int8 NOT NULL,
                                           "actor_id" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
                                           "actor_name" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
                                           "actor_type" int4 NOT NULL,
                                           "weight" int4,
                                           "agent_id" varchar(100) COLLATE "pg_catalog"."default",
                                           "agent_type" int4,
                                           "extend" text COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."flw_task_actor"."id" IS '主键 ID';
COMMENT ON COLUMN "public"."flw_task_actor"."tenant_id" IS '租户ID';
COMMENT ON COLUMN "public"."flw_task_actor"."instance_id" IS '流程实例ID';
COMMENT ON COLUMN "public"."flw_task_actor"."task_id" IS '任务ID';
COMMENT ON COLUMN "public"."flw_task_actor"."actor_id" IS '参与者ID';
COMMENT ON COLUMN "public"."flw_task_actor"."actor_name" IS '参与者名称';
COMMENT ON COLUMN "public"."flw_task_actor"."actor_type" IS '参与者类型 0，用户 1，角色 2，部门';
COMMENT ON COLUMN "public"."flw_task_actor"."weight" IS '权重，票签任务时，该值为不同处理人员的分量比例，代理任务时，该值为 1 时为代理人';
COMMENT ON COLUMN "public"."flw_task_actor"."agent_id" IS '代理人ID';
COMMENT ON COLUMN "public"."flw_task_actor"."agent_type" IS '代理人类型 0，代理 1，被代理 2，认领角色 3，认领部门';
COMMENT ON COLUMN "public"."flw_task_actor"."extend" IS '扩展json';
COMMENT ON TABLE "public"."flw_task_actor" IS '任务参与者表';

-- ----------------------------
-- Table structure for flw_task
-- ----------------------------
DROP TABLE IF EXISTS "public"."flw_task";
CREATE TABLE "public"."flw_task" (
                                     "id" int8 NOT NULL,
                                     "tenant_id" varchar(50) COLLATE "pg_catalog"."default",
                                     "create_id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
                                     "create_by" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
                                     "create_time" timestamp(6) NOT NULL,
                                     "instance_id" int8 NOT NULL,
                                     "parent_task_id" int8,
                                     "task_name" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
                                     "task_key"  varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
                                     "task_type" int2 NOT NULL,
                                     "perform_type" int2,
                                     "action_url" varchar(200) COLLATE "pg_catalog"."default",
                                     "variable" text COLLATE "pg_catalog"."default",
                                     "assignor_id" varchar(100) COLLATE "pg_catalog"."default",
                                     "assignor" varchar(255) COLLATE "pg_catalog"."default",
                                     "expire_time" timestamp(6),
                                     "remind_time" timestamp(6),
                                     "remind_repeat" int2 NOT NULL DEFAULT 0,
                                     "viewed" int2 NOT NULL DEFAULT 0
)
;
COMMENT ON COLUMN "public"."flw_task"."id" IS '主键ID';
COMMENT ON COLUMN "public"."flw_task"."tenant_id" IS '租户ID';
COMMENT ON COLUMN "public"."flw_task"."create_id" IS '创建人ID';
COMMENT ON COLUMN "public"."flw_task"."create_by" IS '创建人名称';
COMMENT ON COLUMN "public"."flw_task"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."flw_task"."instance_id" IS '流程实例ID';
COMMENT ON COLUMN "public"."flw_task"."parent_task_id" IS '父任务ID';
COMMENT ON COLUMN "public"."flw_task"."task_name" IS '任务名称';
COMMENT ON COLUMN "public"."flw_task"."task_key" IS '任务 key 唯一标识';
COMMENT ON COLUMN "public"."flw_task"."task_type" IS '任务类型';
COMMENT ON COLUMN "public"."flw_task"."perform_type" IS '参与类型';
COMMENT ON COLUMN "public"."flw_task"."action_url" IS '任务处理的url';
COMMENT ON COLUMN "public"."flw_task"."variable" IS '变量json';
COMMENT ON COLUMN "public"."flw_task"."assignor_id" IS '委托人ID';
COMMENT ON COLUMN "public"."flw_task"."assignor" IS '委托人';
COMMENT ON COLUMN "public"."flw_task"."expire_time" IS '任务期望完成时间';
COMMENT ON COLUMN "public"."flw_task"."remind_time" IS '提醒时间';
COMMENT ON COLUMN "public"."flw_task"."remind_repeat" IS '提醒次数';
COMMENT ON COLUMN "public"."flw_task"."viewed" IS '已阅 0，否 1，是';
COMMENT ON TABLE "public"."flw_task" IS '任务表';

-- ----------------------------
-- Table structure for flw_ext_instance
-- ----------------------------
DROP TABLE IF EXISTS "public"."flw_ext_instance";
CREATE TABLE "public"."flw_ext_instance" (
                                             "id" int8 NOT NULL,
                                             "tenant_id" varchar(50) COLLATE "pg_catalog"."default",
                                             "process_id" int8 NOT NULL,
                                             "process_name" varchar(100) COLLATE "pg_catalog"."default",
                                             "process_type" varchar(100) COLLATE "pg_catalog"."default",
                                             "model_content" text COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."flw_ext_instance"."id" IS '主键ID';
COMMENT ON COLUMN "public"."flw_ext_instance"."tenant_id" IS '租户ID';
COMMENT ON COLUMN "public"."flw_ext_instance"."process_id" IS '流程定义ID';
COMMENT ON COLUMN "public"."flw_ext_instance"."process_name" IS '流程名称';
COMMENT ON COLUMN "public"."flw_ext_instance"."process_type" IS '流程类型';
COMMENT ON COLUMN "public"."flw_ext_instance"."model_content" IS '流程模型定义JSON内容';
COMMENT ON TABLE "public"."flw_ext_instance" IS '扩展流程实例表';

-- ----------------------------
-- Table structure for flw_his_instance
-- ----------------------------
DROP TABLE IF EXISTS "public"."flw_his_instance";
CREATE TABLE "public"."flw_his_instance" (
                                             "id" int8 NOT NULL,
                                             "tenant_id" varchar(50) COLLATE "pg_catalog"."default",
                                             "create_id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
                                             "create_by" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
                                             "create_time" timestamp(6) NOT NULL,
                                             "process_id" int8 NOT NULL,
                                             "parent_instance_id" int8,
                                             "priority" int2,
                                             "instance_no" varchar(50) COLLATE "pg_catalog"."default",
                                             "business_key" varchar(100) COLLATE "pg_catalog"."default",
                                             "variable" text COLLATE "pg_catalog"."default",
                                             "current_node_name" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
                                             "current_node_key" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
                                             "expire_time" timestamp(6),
                                             "last_update_by" varchar(50) COLLATE "pg_catalog"."default",
                                             "last_update_time" timestamp(6),
                                             "instance_state" int2 NOT NULL DEFAULT 0,
                                             "end_time" timestamp(6),
                                             "duration" int8
)
;
COMMENT ON COLUMN "public"."flw_his_instance"."id" IS '主键ID';
COMMENT ON COLUMN "public"."flw_his_instance"."tenant_id" IS '租户ID';
COMMENT ON COLUMN "public"."flw_his_instance"."create_id" IS '创建人ID';
COMMENT ON COLUMN "public"."flw_his_instance"."create_by" IS '创建人名称';
COMMENT ON COLUMN "public"."flw_his_instance"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."flw_his_instance"."process_id" IS '流程定义ID';
COMMENT ON COLUMN "public"."flw_his_instance"."parent_instance_id" IS '父流程实例ID';
COMMENT ON COLUMN "public"."flw_his_instance"."priority" IS '优先级';
COMMENT ON COLUMN "public"."flw_his_instance"."instance_no" IS '流程实例编号';
COMMENT ON COLUMN "public"."flw_his_instance"."business_key" IS '业务KEY';
COMMENT ON COLUMN "public"."flw_his_instance"."variable" IS '变量json';
COMMENT ON COLUMN "public"."flw_his_instance"."current_node_name" IS '当前所在节点名称';
COMMENT ON COLUMN "public"."flw_his_instance"."current_node_key" IS '当前所在节点key';
COMMENT ON COLUMN "public"."flw_his_instance"."expire_time" IS '期望完成时间';
COMMENT ON COLUMN "public"."flw_his_instance"."last_update_by" IS '上次更新人';
COMMENT ON COLUMN "public"."flw_his_instance"."last_update_time" IS '上次更新时间';
COMMENT ON COLUMN "public"."flw_his_instance"."instance_state" IS '状态 0，审批中 1，审批通过 2，审批拒绝 3，撤销审批 4，超时结束 5，强制终止';
COMMENT ON COLUMN "public"."flw_his_instance"."end_time" IS '结束时间';
COMMENT ON COLUMN "public"."flw_his_instance"."duration" IS '处理耗时';
COMMENT ON TABLE "public"."flw_his_instance" IS '历史流程实例表';

-- ----------------------------
-- Table structure for flw_instance
-- ----------------------------
DROP TABLE IF EXISTS "public"."flw_instance";
CREATE TABLE "public"."flw_instance" (
                                         "id" int8 NOT NULL,
                                         "tenant_id" varchar(50) COLLATE "pg_catalog"."default",
                                         "create_id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
                                         "create_by" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
                                         "create_time" timestamp(6) NOT NULL,
                                         "process_id" int8 NOT NULL,
                                         "parent_instance_id" int8,
                                         "priority" int2,
                                         "instance_no" varchar(50) COLLATE "pg_catalog"."default",
                                         "business_key" varchar(100) COLLATE "pg_catalog"."default",
                                         "variable" text COLLATE "pg_catalog"."default",
                                         "current_node_name" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
                                         "current_node_key" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
                                         "expire_time" timestamp(6),
                                         "last_update_by" varchar(50) COLLATE "pg_catalog"."default",
                                         "last_update_time" timestamp(6)
)
;
COMMENT ON COLUMN "public"."flw_instance"."id" IS '主键ID';
COMMENT ON COLUMN "public"."flw_instance"."tenant_id" IS '租户ID';
COMMENT ON COLUMN "public"."flw_instance"."create_id" IS '创建人ID';
COMMENT ON COLUMN "public"."flw_instance"."create_by" IS '创建人名称';
COMMENT ON COLUMN "public"."flw_instance"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."flw_instance"."process_id" IS '流程定义ID';
COMMENT ON COLUMN "public"."flw_instance"."parent_instance_id" IS '父流程实例ID';
COMMENT ON COLUMN "public"."flw_instance"."priority" IS '优先级';
COMMENT ON COLUMN "public"."flw_instance"."instance_no" IS '流程实例编号';
COMMENT ON COLUMN "public"."flw_instance"."business_key" IS '业务KEY';
COMMENT ON COLUMN "public"."flw_instance"."variable" IS '变量json';
COMMENT ON COLUMN "public"."flw_instance"."current_node_name" IS '当前所在节点名称';
COMMENT ON COLUMN "public"."flw_instance"."current_node_key" IS '当前所在节点key';
COMMENT ON COLUMN "public"."flw_instance"."expire_time" IS '期望完成时间';
COMMENT ON COLUMN "public"."flw_instance"."last_update_by" IS '上次更新人';
COMMENT ON COLUMN "public"."flw_instance"."last_update_time" IS '上次更新时间';
COMMENT ON TABLE "public"."flw_instance" IS '流程实例表';

-- ----------------------------
-- Table structure for flw_process
-- ----------------------------
DROP TABLE IF EXISTS "public"."flw_process";
CREATE TABLE "public"."flw_process" (
                                        "id" int8 NOT NULL,
                                        "tenant_id" varchar(50) COLLATE "pg_catalog"."default",
                                        "create_id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
                                        "create_by" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
                                        "create_time" timestamp(6) NOT NULL,
                                        "process_key" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
                                        "process_name" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
                                        "process_icon" varchar(255) COLLATE "pg_catalog"."default",
                                        "process_type" varchar(100) COLLATE "pg_catalog"."default",
                                        "process_version" int4 NOT NULL DEFAULT 1,
                                        "instance_url" varchar(200) COLLATE "pg_catalog"."default",
                                        "remark" varchar(255) COLLATE "pg_catalog"."default",
                                        "use_scope" int2 NOT NULL DEFAULT 0,
                                        "process_state" int2 NOT NULL DEFAULT 1,
                                        "model_content" text COLLATE "pg_catalog"."default",
                                        "sort" int2
)
;
COMMENT ON COLUMN "public"."flw_process"."id" IS '主键ID';
COMMENT ON COLUMN "public"."flw_process"."tenant_id" IS '租户ID';
COMMENT ON COLUMN "public"."flw_process"."create_id" IS '创建人ID';
COMMENT ON COLUMN "public"."flw_process"."create_by" IS '创建人名称';
COMMENT ON COLUMN "public"."flw_process"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."flw_process"."process_key" IS '流程定义 key 唯一标识';
COMMENT ON COLUMN "public"."flw_process"."process_name" IS '流程定义名称';
COMMENT ON COLUMN "public"."flw_process"."process_icon" IS '流程图标地址';
COMMENT ON COLUMN "public"."flw_process"."process_type" IS '流程类型';
COMMENT ON COLUMN "public"."flw_process"."process_version" IS '流程版本，默认 1';
COMMENT ON COLUMN "public"."flw_process"."instance_url" IS '实例地址';
COMMENT ON COLUMN "public"."flw_process"."remark" IS '备注说明';
COMMENT ON COLUMN "public"."flw_process"."use_scope" IS '使用范围 0，全员 1，指定人员（业务关联） 2，均不可提交';
COMMENT ON COLUMN "public"."flw_process"."process_state" IS '流程状态 0，不可用 1，可用 2，历史版本';
COMMENT ON COLUMN "public"."flw_process"."model_content" IS '流程模型定义JSON内容';
COMMENT ON COLUMN "public"."flw_process"."sort" IS '排序';
COMMENT ON TABLE "public"."flw_process" IS '流程定义表';

-- ----------------------------
-- Indexes structure for table flw_his_instance
-- ----------------------------
CREATE INDEX "idx_his_instance_process_id" ON "public"."flw_his_instance" USING btree (
    "process_id" "pg_catalog"."int8_ops" ASC NULLS LAST
    );

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

-- ----------------------------
-- Indexes structure for table flw_his_task
-- ----------------------------
CREATE INDEX "idx_his_task_instance_id" ON "public"."flw_his_task" USING btree (
    "instance_id" "pg_catalog"."int8_ops" ASC NULLS LAST
    );
CREATE INDEX "idx_his_task_parent_task_id" ON "public"."flw_his_task" USING btree (
    "parent_task_id" "pg_catalog"."int8_ops" ASC NULLS LAST
    );

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

-- ----------------------------
-- Indexes structure for table flw_his_task_actor
-- ----------------------------
CREATE INDEX "idx_his_task_actor_task_id" ON "public"."flw_his_task_actor" USING btree (
    "task_id" "pg_catalog"."int8_ops" ASC NULLS LAST
    );

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

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

-- ----------------------------
-- Foreign Keys structure for table flw_ext_instance
-- ----------------------------
ALTER TABLE "public"."flw_ext_instance" ADD CONSTRAINT "fk_ext_instance_id" FOREIGN KEY ("id") REFERENCES "public"."flw_his_instance" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

-- ----------------------------
-- Indexes structure for table flw_instance
-- ----------------------------
CREATE INDEX "idx_instance_process_id" ON "public"."flw_instance" USING btree (
    "process_id" "pg_catalog"."int8_ops" ASC NULLS LAST
    );

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

-- ----------------------------
-- Indexes structure for table flw_process
-- ----------------------------
CREATE INDEX "idx_process_name" ON "public"."flw_process" USING btree (
    "process_name" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
    );

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

-- ----------------------------
-- Indexes structure for table flw_task
-- ----------------------------
CREATE INDEX "idx_task_instance_id" ON "public"."flw_task" USING btree (
    "instance_id" "pg_catalog"."int8_ops" ASC NULLS LAST
    );

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

-- ----------------------------
-- Indexes structure for table flw_task_actor
-- ----------------------------
CREATE INDEX "idx_task_actor_task_id" ON "public"."flw_task_actor" USING btree (
    "task_id" "pg_catalog"."int8_ops" ASC NULLS LAST
    );

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

-- ----------------------------
-- Foreign Keys structure for table flw_his_instance
-- ----------------------------
ALTER TABLE "public"."flw_his_instance" ADD CONSTRAINT "flw_his_instance_process_id_fkey" FOREIGN KEY ("process_id") REFERENCES "public"."flw_process" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

-- ----------------------------
-- Foreign Keys structure for table flw_his_task
-- ----------------------------
ALTER TABLE "public"."flw_his_task" ADD CONSTRAINT "flw_his_task_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "public"."flw_his_instance" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

-- ----------------------------
-- Foreign Keys structure for table flw_his_task_actor
-- ----------------------------
ALTER TABLE "public"."flw_his_task_actor" ADD CONSTRAINT "flw_his_task_actor_task_id_fkey" FOREIGN KEY ("task_id") REFERENCES "public"."flw_his_task" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

-- ----------------------------
-- Foreign Keys structure for table flw_instance
-- ----------------------------
ALTER TABLE "public"."flw_instance" ADD CONSTRAINT "flw_instance_process_id_fkey" FOREIGN KEY ("process_id") REFERENCES "public"."flw_process" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

-- ----------------------------
-- Foreign Keys structure for table flw_task
-- ----------------------------
ALTER TABLE "public"."flw_task" ADD CONSTRAINT "flw_task_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "public"."flw_instance" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

-- ----------------------------
-- Foreign Keys structure for table flw_task_actor
-- ----------------------------
ALTER TABLE "public"."flw_task_actor" ADD CONSTRAINT "flw_task_actor_task_id_fkey" FOREIGN KEY ("task_id") REFERENCES "public"."flw_task" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;


