
-- SP_GRID_CATEGORY - 网格类别
CREATE TABLE "SECURE_PRODUCTING"."SP_GRID_CATEGORY"(
  "ID" BIGINT NOT NULL,
  "CATEGORY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "DESCRIPTION" VARCHAR(50) NOT NULL DEFAULT '',
  "STATUS" TINYINT NOT NULL DEFAULT 0,
  "CREATE_TIME" BIGINT NOT NULL DEFAULT 0,
  "UPDATE_TIME" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(),
  "CREATE_BY" VARCHAR(50) NOT NULL DEFAULT '',
  "CREATE_BY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "UPDATE_BY" VARCHAR(50) NOT NULL DEFAULT '',
  "UPDATE_BY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "IS_DELETE" TINYINT NOT NULL DEFAULT 0,
  -- 主键
  PRIMARY KEY("ID")
);
-- 索引
CREATE INDEX IDX_SP_GRID_CATEGORY_STATUS ON "SECURE_PRODUCTING"."SP_GRID_CATEGORY"("STATUS");
CREATE INDEX IDX_SP_GRID_CATEGORY_CREATE_TIME ON "SECURE_PRODUCTING"."SP_GRID_CATEGORY"("CREATE_TIME");
-- 触发器：自动赋值最后修改时间
CREATE OR REPLACE TRIGGER "TG_SP_GRID_CATEGORY"
BEFORE INSERT OR UPDATE ON "SECURE_PRODUCTING"."SP_GRID_CATEGORY" FOR EACH ROW
BEGIN
  :new.UPDATE_TIME=CURRENT_TIMESTAMP();
END;

-- 字段描述
COMMENT ON TABLE "SECURE_PRODUCTING"."SP_GRID_CATEGORY" IS '网格类别';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_CATEGORY"."ID" IS '主键';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_CATEGORY"."CATEGORY_NAME" IS '类别名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_CATEGORY"."DESCRIPTION" IS '描述';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_CATEGORY"."STATUS" IS '状态 EState';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_CATEGORY"."CREATE_TIME" IS '数据创建时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_CATEGORY"."UPDATE_TIME" IS '最后更新时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_CATEGORY"."CREATE_BY" IS '数据创建人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_CATEGORY"."CREATE_BY_NAME" IS '数据创建人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_CATEGORY"."UPDATE_BY" IS '最后更新人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_CATEGORY"."UPDATE_BY_NAME" IS '最后更新人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_CATEGORY"."IS_DELETE" IS '是否删除(逻辑删除)';





-- SP_DANGER_CATEGORY - 隐患类别
CREATE TABLE "SECURE_PRODUCTING"."SP_DANGER_CATEGORY"(
  "ID" BIGINT NOT NULL,
  "CATEGORY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "CHECK_CYCLE" TINYINT NOT NULL DEFAULT 0,
  "DESCRIPTION" VARCHAR(50) NOT NULL DEFAULT '',
  "STATUS" TINYINT NOT NULL DEFAULT 0,
  "CREATE_TIME" BIGINT NOT NULL DEFAULT 0,
  "UPDATE_TIME" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(),
  "CREATE_BY" VARCHAR(50) NOT NULL DEFAULT '',
  "CREATE_BY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "UPDATE_BY" VARCHAR(50) NOT NULL DEFAULT '',
  "UPDATE_BY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "IS_DELETE" TINYINT NOT NULL DEFAULT 0,
  -- 主键
  PRIMARY KEY("ID")
);
-- 索引
CREATE INDEX IDX_SP_DANGER_CATEGORY_STATUS ON "SECURE_PRODUCTING"."SP_DANGER_CATEGORY"("STATUS");
CREATE INDEX IDX_SP_DANGER_CATEGORY_CREATE_TIME ON "SECURE_PRODUCTING"."SP_DANGER_CATEGORY"("CREATE_TIME");
-- 触发器：自动赋值最后修改时间
CREATE OR REPLACE TRIGGER "TG_SP_DANGER_CATEGORY"
BEFORE INSERT OR UPDATE ON "SECURE_PRODUCTING"."SP_DANGER_CATEGORY" FOR EACH ROW
BEGIN
  :new.UPDATE_TIME=CURRENT_TIMESTAMP();
END;

-- 字段描述
COMMENT ON TABLE "SECURE_PRODUCTING"."SP_DANGER_CATEGORY" IS '隐患类别';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CATEGORY"."ID" IS '主键';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CATEGORY"."CATEGORY_NAME" IS '类别名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CATEGORY"."CHECK_CYCLE" IS '检查频率 ECheckCycle';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CATEGORY"."DESCRIPTION" IS '描述';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CATEGORY"."STATUS" IS '状态 EState';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CATEGORY"."CREATE_TIME" IS '数据创建时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CATEGORY"."UPDATE_TIME" IS '最后更新时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CATEGORY"."CREATE_BY" IS '数据创建人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CATEGORY"."CREATE_BY_NAME" IS '数据创建人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CATEGORY"."UPDATE_BY" IS '最后更新人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CATEGORY"."UPDATE_BY_NAME" IS '最后更新人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CATEGORY"."IS_DELETE" IS '是否删除(逻辑删除)';





-- SP_GRID_INFO - 网格信息
CREATE TABLE "SECURE_PRODUCTING"."SP_GRID_INFO"(
  "ID" BIGINT NOT NULL,
  "GRID_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "DEPARTMENT" VARCHAR(50) NOT NULL DEFAULT '',
  "DEPARTMENT_NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "GRID_CATEGORY" BIGINT NOT NULL DEFAULT 0,
  "DANGER_CATEGORY" BIGINT NOT NULL DEFAULT 0,
  "GRID_PERSON_DUTY" VARCHAR(500) NOT NULL DEFAULT '',
  "STATUS" TINYINT NOT NULL DEFAULT 0,
  "CREATE_TIME" BIGINT NOT NULL DEFAULT 0,
  "UPDATE_TIME" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(),
  "CREATE_BY" VARCHAR(50) NOT NULL DEFAULT '',
  "CREATE_BY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "UPDATE_BY" VARCHAR(50) NOT NULL DEFAULT '',
  "UPDATE_BY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "IS_DELETE" TINYINT NOT NULL DEFAULT 0,
  -- 主键
  PRIMARY KEY("ID")
);
-- 索引
CREATE INDEX IDX_SP_GRID_INFO_DEPARTMENT ON "SECURE_PRODUCTING"."SP_GRID_INFO"("DEPARTMENT");
CREATE INDEX IDX_SP_GRID_INFO_GRID_CATEGORY ON "SECURE_PRODUCTING"."SP_GRID_INFO"("GRID_CATEGORY");
CREATE INDEX IDX_SP_GRID_INFO_DANGER_CATEGORY ON "SECURE_PRODUCTING"."SP_GRID_INFO"("DANGER_CATEGORY");
CREATE INDEX IDX_SP_GRID_INFO_STATUS ON "SECURE_PRODUCTING"."SP_GRID_INFO"("STATUS");
CREATE INDEX IDX_SP_GRID_INFO_CREATE_TIME ON "SECURE_PRODUCTING"."SP_GRID_INFO"("CREATE_TIME");
-- 触发器：自动赋值最后修改时间
CREATE OR REPLACE TRIGGER "TG_SP_GRID_INFO"
BEFORE INSERT OR UPDATE ON "SECURE_PRODUCTING"."SP_GRID_INFO" FOR EACH ROW
BEGIN
  :new.UPDATE_TIME=CURRENT_TIMESTAMP();
END;

-- 字段描述
COMMENT ON TABLE "SECURE_PRODUCTING"."SP_GRID_INFO" IS '网格信息';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_INFO"."ID" IS '主键';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_INFO"."GRID_NAME" IS '网格名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_INFO"."DEPARTMENT" IS '所属部门';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_INFO"."DEPARTMENT_NAME" IS '部门名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_INFO"."GRID_CATEGORY" IS '网格类型';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_INFO"."DANGER_CATEGORY" IS '隐患分类';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_INFO"."GRID_PERSON_DUTY" IS '网格员职责';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_INFO"."STATUS" IS '状态 EState';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_INFO"."CREATE_TIME" IS '数据创建时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_INFO"."UPDATE_TIME" IS '最后更新时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_INFO"."CREATE_BY" IS '数据创建人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_INFO"."CREATE_BY_NAME" IS '数据创建人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_INFO"."UPDATE_BY" IS '最后更新人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_INFO"."UPDATE_BY_NAME" IS '最后更新人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_INFO"."IS_DELETE" IS '是否删除(逻辑删除)';





-- SP_GRID_PERSON - 网格人员
CREATE TABLE "SECURE_PRODUCTING"."SP_GRID_PERSON"(
  "ID" BIGINT NOT NULL,
  "DEPARTMENT" VARCHAR(50) NOT NULL DEFAULT '',
  "DEPARTMENT_NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "GRID_ID" BIGINT NOT NULL DEFAULT 0,
  "USER_GUID" VARCHAR(50) NOT NULL DEFAULT '',
  "USER_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "CONTACT_INFO" VARCHAR(50) NOT NULL DEFAULT '',
  "IS_ADMIN" TINYINT NOT NULL DEFAULT 0,
  "STATUS" TINYINT NOT NULL DEFAULT 0,
  "CREATE_TIME" BIGINT NOT NULL DEFAULT 0,
  "UPDATE_TIME" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(),
  "CREATE_BY" VARCHAR(50) NOT NULL DEFAULT '',
  "CREATE_BY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "UPDATE_BY" VARCHAR(50) NOT NULL DEFAULT '',
  "UPDATE_BY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "IS_DELETE" TINYINT NOT NULL DEFAULT 0,
  -- 主键
  PRIMARY KEY("ID")
);
-- 索引
CREATE INDEX IDX_SP_GRID_PERSON_DEPARTMENT ON "SECURE_PRODUCTING"."SP_GRID_PERSON"("DEPARTMENT");
CREATE INDEX IDX_SP_GRID_PERSON_GRID_ID ON "SECURE_PRODUCTING"."SP_GRID_PERSON"("GRID_ID");
CREATE INDEX IDX_SP_GRID_PERSON_USER_GUID ON "SECURE_PRODUCTING"."SP_GRID_PERSON"("USER_GUID");
CREATE INDEX IDX_SP_GRID_PERSON_STATUS ON "SECURE_PRODUCTING"."SP_GRID_PERSON"("STATUS");
CREATE INDEX IDX_SP_GRID_PERSON_CREATE_TIME ON "SECURE_PRODUCTING"."SP_GRID_PERSON"("CREATE_TIME");
-- 触发器：自动赋值最后修改时间
CREATE OR REPLACE TRIGGER "TG_SP_GRID_PERSON"
BEFORE INSERT OR UPDATE ON "SECURE_PRODUCTING"."SP_GRID_PERSON" FOR EACH ROW
BEGIN
  :new.UPDATE_TIME=CURRENT_TIMESTAMP();
END;

-- 字段描述
COMMENT ON TABLE "SECURE_PRODUCTING"."SP_GRID_PERSON" IS '网格人员';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."ID" IS '主键';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."DEPARTMENT" IS '所属部门';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."DEPARTMENT_NAME" IS '部门名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."GRID_ID" IS '所属网格';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."USER_GUID" IS '用户guid';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."USER_NAME" IS '用户名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."CONTACT_INFO" IS '联系方式';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."IS_ADMIN" IS '是否网格管理员';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."STATUS" IS '状态 EState';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."CREATE_TIME" IS '数据创建时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."UPDATE_TIME" IS '最后更新时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."CREATE_BY" IS '数据创建人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."CREATE_BY_NAME" IS '数据创建人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."UPDATE_BY" IS '最后更新人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."UPDATE_BY_NAME" IS '最后更新人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_GRID_PERSON"."IS_DELETE" IS '是否删除(逻辑删除)';





-- SP_DANGER_CHECK_FORM - 隐患检查表
CREATE TABLE "SECURE_PRODUCTING"."SP_DANGER_CHECK_FORM"(
  "ID" BIGINT NOT NULL,
  "NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "DANGER_CATEGORY" BIGINT NOT NULL DEFAULT 0,
  "CHECK_CYCLE" TINYINT NOT NULL DEFAULT 0,
  "CHECK_TIMES" TINYINT NOT NULL DEFAULT 0,
  "DESCRIPTION" VARCHAR(500) NOT NULL DEFAULT '',
  "STATUS" TINYINT NOT NULL DEFAULT 0,
  "CREATE_TIME" BIGINT NOT NULL DEFAULT 0,
  "UPDATE_TIME" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(),
  "CREATE_BY" VARCHAR(50) NOT NULL DEFAULT '',
  "CREATE_BY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "UPDATE_BY" VARCHAR(50) NOT NULL DEFAULT '',
  "UPDATE_BY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "IS_DELETE" TINYINT NOT NULL DEFAULT 0,
  -- 主键
  PRIMARY KEY("ID")
);
-- 索引
CREATE INDEX IDX_SP_DANGER_CHECK_FORM_DANGER_CATEGORY ON "SECURE_PRODUCTING"."SP_DANGER_CHECK_FORM"("DANGER_CATEGORY");
CREATE INDEX IDX_SP_DANGER_CHECK_FORM_CHECK_CYCLE ON "SECURE_PRODUCTING"."SP_DANGER_CHECK_FORM"("CHECK_CYCLE");
CREATE INDEX IDX_SP_DANGER_CHECK_FORM_STATUS ON "SECURE_PRODUCTING"."SP_DANGER_CHECK_FORM"("STATUS");
CREATE INDEX IDX_SP_DANGER_CHECK_FORM_CREATE_TIME ON "SECURE_PRODUCTING"."SP_DANGER_CHECK_FORM"("CREATE_TIME");
-- 触发器：自动赋值最后修改时间
CREATE OR REPLACE TRIGGER "TG_SP_DANGER_CHECK_FORM"
BEFORE INSERT OR UPDATE ON "SECURE_PRODUCTING"."SP_DANGER_CHECK_FORM" FOR EACH ROW
BEGIN
  :new.UPDATE_TIME=CURRENT_TIMESTAMP();
END;

-- 字段描述
COMMENT ON TABLE "SECURE_PRODUCTING"."SP_DANGER_CHECK_FORM" IS '隐患检查表';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_FORM"."ID" IS '主键';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_FORM"."NAME" IS '检查表名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_FORM"."DANGER_CATEGORY" IS '隐患分类';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_FORM"."CHECK_CYCLE" IS '检查频率 ECheckCycle';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_FORM"."CHECK_TIMES" IS '检查次数(周期内)';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_FORM"."DESCRIPTION" IS '描述';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_FORM"."STATUS" IS '状态 EState';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_FORM"."CREATE_TIME" IS '数据创建时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_FORM"."UPDATE_TIME" IS '最后更新时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_FORM"."CREATE_BY" IS '数据创建人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_FORM"."CREATE_BY_NAME" IS '数据创建人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_FORM"."UPDATE_BY" IS '最后更新人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_FORM"."UPDATE_BY_NAME" IS '最后更新人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_FORM"."IS_DELETE" IS '是否删除(逻辑删除)';





-- SP_DANGER_CHECK_ITEM - 隐患检查表-检查项
CREATE TABLE "SECURE_PRODUCTING"."SP_DANGER_CHECK_ITEM"(
  "ID" BIGINT NOT NULL,
  "CHECK_FORM_ID" BIGINT NOT NULL DEFAULT 0,
  "ITEM_NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "DESCRIPTION" VARCHAR(500) NOT NULL DEFAULT '',
  "CREATE_TIME" BIGINT NOT NULL DEFAULT 0,
  "UPDATE_TIME" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(),
  "IS_DELETE" TINYINT NOT NULL DEFAULT 0,
  -- 主键
  PRIMARY KEY("ID")
);
-- 索引
CREATE INDEX IDX_SP_DANGER_CHECK_ITEM_FORM_ID ON "SECURE_PRODUCTING"."SP_DANGER_CHECK_ITEM"("CHECK_FORM_ID");
CREATE INDEX IDX_SP_DANGER_CHECK_ITEM_CREATE_TIME ON "SECURE_PRODUCTING"."SP_DANGER_CHECK_ITEM"("CREATE_TIME");
-- 触发器：自动赋值最后修改时间
CREATE OR REPLACE TRIGGER "TG_SP_DANGER_CHECK_ITEM"
BEFORE INSERT OR UPDATE ON "SECURE_PRODUCTING"."SP_DANGER_CHECK_ITEM" FOR EACH ROW
BEGIN
  :new.UPDATE_TIME=CURRENT_TIMESTAMP();
END;

-- 字段描述
COMMENT ON TABLE "SECURE_PRODUCTING"."SP_DANGER_CHECK_ITEM" IS '隐患检查表-检查项';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_ITEM"."ID" IS '主键';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_ITEM"."CHECK_FORM_ID" IS '所属隐患检查表';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_ITEM"."ITEM_NAME" IS '检查项名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_ITEM"."DESCRIPTION" IS '描述 判断有无隐患的标准等信息';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_ITEM"."CREATE_TIME" IS '数据创建时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_ITEM"."UPDATE_TIME" IS '最后更新时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DANGER_CHECK_ITEM"."IS_DELETE" IS '是否删除(逻辑删除)';



-- SP_CHECK_FORM_GRID_CYCLE - 检查表-网格-频率设置
CREATE TABLE "SECURE_PRODUCTING"."SP_CHECK_FORM_GRID_CYCLE"(
  "ID" BIGINT NOT NULL,
  "CHECK_FORM_ID" BIGINT NOT NULL DEFAULT 0,
  "CHECK_FORM_NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "GRID_ID" BIGINT NOT NULL DEFAULT 0,
  "GRID_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "CHECK_CYCLE" TINYINT NOT NULL DEFAULT 0,
  "CREATE_TIME" BIGINT NOT NULL DEFAULT 0,
  "UPDATE_TIME" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(),
  "IS_DELETE" TINYINT NOT NULL DEFAULT 0,
  -- 主键
  PRIMARY KEY("ID")
);
-- 索引
CREATE INDEX IDX_SP_CHECK_FORM_GRID_CYCLE_CHECK_FORM_ID ON "SECURE_PRODUCTING"."SP_CHECK_FORM_GRID_CYCLE"("CHECK_FORM_ID");
CREATE INDEX IDX_SP_CHECK_FORM_GRID_CYCLE_GRID_ID ON "SECURE_PRODUCTING"."SP_CHECK_FORM_GRID_CYCLE"("GRID_ID");
CREATE INDEX IDX_SP_CHECK_FORM_GRID_CYCLE_CREATE_TIME ON "SECURE_PRODUCTING"."SP_CHECK_FORM_GRID_CYCLE"("CREATE_TIME");
-- 触发器：自动赋值最后修改时间
CREATE OR REPLACE TRIGGER "SECURE_PRODUCTING"."TG_SP_CHECK_FORM_GRID_CYCLE"
BEFORE INSERT OR UPDATE ON "SECURE_PRODUCTING"."SP_CHECK_FORM_GRID_CYCLE" FOR EACH ROW
BEGIN
  :new.UPDATE_TIME=CURRENT_TIMESTAMP();
END;

-- 字段描述
COMMENT ON TABLE "SECURE_PRODUCTING"."SP_CHECK_FORM_GRID_CYCLE" IS '检查表-网格-频率设置';
COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_CHECK_FORM_GRID_CYCLE"."ID" IS '主键';
COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_CHECK_FORM_GRID_CYCLE"."CHECK_FORM_ID" IS '关联检查表';
COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_CHECK_FORM_GRID_CYCLE"."CHECK_FORM_NAME" IS '检查表名称';
COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_CHECK_FORM_GRID_CYCLE"."GRID_ID" IS '关联网格';
COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_CHECK_FORM_GRID_CYCLE"."GRID_NAME" IS '网格名称';
COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_CHECK_FORM_GRID_CYCLE"."CHECK_CYCLE" IS '检查频率 ECheckCycle';
COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_CHECK_FORM_GRID_CYCLE"."CREATE_TIME" IS '数据创建时间';
COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_CHECK_FORM_GRID_CYCLE"."UPDATE_TIME" IS '最后更新时间';
COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_CHECK_FORM_GRID_CYCLE"."IS_DELETE" IS '是否删除(逻辑删除)';




-- SP_CHECK_RECORD - 隐患检查记录
CREATE TABLE "SECURE_PRODUCTING"."SP_CHECK_RECORD"(
  "ID" BIGINT NOT NULL,
  "CHECK_FORM_NO" VARCHAR(50) NOT NULL DEFAULT '',
  "GRID_ID" BIGINT NOT NULL DEFAULT 0,
  "CHECK_FORM_ID" BIGINT NOT NULL DEFAULT 0,
  "CHECK_FORM_NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "DEPARTMENT" VARCHAR(50) NOT NULL DEFAULT '',
  "DEPARTMENT_NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "CUSTOMS" VARCHAR(50) NOT NULL DEFAULT '',
  "CUSTOMS_NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "CHECK_TIME" BIGINT NOT NULL DEFAULT 0,
  "CHECK_PERSON" VARCHAR(50) NOT NULL DEFAULT '',
  "CONTACT_INFO" VARCHAR(50) NOT NULL DEFAULT '',
  "GRID_CATEGORY" BIGINT NOT NULL DEFAULT 0,
  "DANGER_CATEGORY" BIGINT NOT NULL DEFAULT 0,
  "ATTACHMENT_LIST" VARCHAR(5000) NOT NULL DEFAULT '',
  "HAS_DANGER" TINYINT NOT NULL DEFAULT 0,
  "HAS_RECTIFY_PLAN" TINYINT NOT NULL DEFAULT 0,
  "RECTIFY_SUBMIT_TIME" BIGINT NOT NULL DEFAULT 0,
  "RECTIFY_DEADLINE" BIGINT NOT NULL DEFAULT 0,
  "STATUS" TINYINT NOT NULL DEFAULT 0,
  "CREATE_TIME" BIGINT NOT NULL DEFAULT 0,
  "UPDATE_TIME" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(),
  "CREATE_BY" VARCHAR(50) NOT NULL DEFAULT '',
  "CREATE_BY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "UPDATE_BY" VARCHAR(50) NOT NULL DEFAULT '',
  "UPDATE_BY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "IS_DELETE" TINYINT NOT NULL DEFAULT 0,
  -- 主键
  PRIMARY KEY("ID")
);
-- 索引
CREATE UNIQUE INDEX UID_SP_CHECK_RECORD_CHECK_FORM_NO ON "SECURE_PRODUCTING"."SP_CHECK_RECORD"("CHECK_FORM_NO");
CREATE INDEX IDX_SP_CHECK_RECORD_CHECK_TIME ON "SECURE_PRODUCTING"."SP_CHECK_RECORD"("CHECK_TIME");
CREATE INDEX IDX_SP_CHECK_RECORD_STATUS ON "SECURE_PRODUCTING"."SP_CHECK_RECORD"("STATUS");
CREATE INDEX IDX_SP_CHECK_RECORD_CREATE_TIME ON "SECURE_PRODUCTING"."SP_CHECK_RECORD"("CREATE_TIME");
-- 触发器：自动赋值最后修改时间
CREATE OR REPLACE TRIGGER "TG_SP_CHECK_RECORD"
BEFORE INSERT OR UPDATE ON "SECURE_PRODUCTING"."SP_CHECK_RECORD" FOR EACH ROW
BEGIN
  :new.UPDATE_TIME=CURRENT_TIMESTAMP();
END;

-- 字段描述
COMMENT ON TABLE "SECURE_PRODUCTING"."SP_CHECK_RECORD" IS '隐患检查记录';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."ID" IS '主键';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."CHECK_FORM_NO" IS '检查单号';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."GRID_ID" IS '所属网格';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."CHECK_FORM_ID" IS '所属检查表';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."CHECK_FORM_NAME" IS '检查表名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."DEPARTMENT" IS '所属部门';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."DEPARTMENT_NAME" IS '部门名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."CUSTOMS" IS '所属关区';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."CUSTOMS_NAME" IS '关区名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."CHECK_TIME" IS '检查时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."CHECK_PERSON" IS '检查人员';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."CONTACT_INFO" IS '联系方式';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."GRID_CATEGORY" IS '网格类型';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."DANGER_CATEGORY" IS '隐患分类';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."ATTACHMENT_LIST" IS '附件列表';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."HAS_DANGER" IS '是否有隐患';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."HAS_RECTIFY_PLAN" IS '是否已提供整改措施';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."RECTIFY_SUBMIT_TIME" IS '整改措施提交时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."RECTIFY_DEADLINE" IS '整改期限';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."STATUS" IS '状态 ECheckFormStatus';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."CREATE_TIME" IS '数据创建时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."UPDATE_TIME" IS '最后更新时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."CREATE_BY" IS '数据创建人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."CREATE_BY_NAME" IS '数据创建人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."UPDATE_BY" IS '最后更新人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."UPDATE_BY_NAME" IS '最后更新人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD"."IS_DELETE" IS '是否删除(逻辑删除)';





-- SP_CHECK_RECORD_ITEM - 隐患检查-检查项
CREATE TABLE "SECURE_PRODUCTING"."SP_CHECK_RECORD_ITEM"(
  "ID" BIGINT NOT NULL,
  "CHECK_RECORD_ID" BIGINT NOT NULL DEFAULT 0,
  "GRID_ID" BIGINT NOT NULL DEFAULT 0,
  "CHECK_FORM_ID" BIGINT NOT NULL DEFAULT 0,
  "CHECK_FORM_NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "DEPARTMENT" VARCHAR(50) NOT NULL DEFAULT '',
  "DEPARTMENT_NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "CUSTOMS" VARCHAR(50) NOT NULL DEFAULT '',
  "CUSTOMS_NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "ITEM_NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "CHECK_TIME" BIGINT NOT NULL DEFAULT 0,
  "CHECK_PERSON" VARCHAR(50) NOT NULL DEFAULT '',
  "CHECK_RESULT" TINYINT NOT NULL DEFAULT 0,
  "RECTIFY_PLAN" VARCHAR(20000) NOT NULL DEFAULT '',
  "RECTIFY_SUBMIT_TIME" BIGINT NOT NULL DEFAULT 0,
  "RECTIFY_DEADLINE" BIGINT NOT NULL DEFAULT 0,
  "RECTIFY_STATUS" TINYINT NOT NULL DEFAULT 0,
  "RECTIFY_TIME" BIGINT NOT NULL DEFAULT 0,
  "IS_ON_TIME" TINYINT NOT NULL DEFAULT 0,
  "RECTIFY_PERSON" VARCHAR(50) NOT NULL DEFAULT '',
  "RECTIFY_PERSON_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "CREATE_TIME" BIGINT NOT NULL DEFAULT 0,
  "UPDATE_TIME" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(),
  "IS_DELETE" TINYINT NOT NULL DEFAULT 0,
  -- 主键
  PRIMARY KEY("ID")
);
-- 索引
CREATE INDEX IDX_SP_CHECK_RECORD_ITEM_CHECK_RECORD_ID ON "SECURE_PRODUCTING"."SP_CHECK_RECORD_ITEM"("CHECK_RECORD_ID");
CREATE INDEX IDX_SP_CHECK_RECORD_ITEM_CREATE_TIME ON "SECURE_PRODUCTING"."SP_CHECK_RECORD_ITEM"("CREATE_TIME");
-- 触发器：自动赋值最后修改时间
CREATE OR REPLACE TRIGGER "TG_SP_CHECK_RECORD_ITEM"
BEFORE INSERT OR UPDATE ON "SECURE_PRODUCTING"."SP_CHECK_RECORD_ITEM" FOR EACH ROW
BEGIN
  :new.UPDATE_TIME=CURRENT_TIMESTAMP();
END;

-- 字段描述
COMMENT ON TABLE "SECURE_PRODUCTING"."SP_CHECK_RECORD_ITEM" IS '隐患检查-检查项';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."ID" IS '主键';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."CHECK_RECORD_ID" IS '所属检查记录';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."GRID_ID" IS '所属网格';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."CHECK_FORM_ID" IS '所属检查表';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."CHECK_FORM_NAME" IS '检查表名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."DEPARTMENT" IS '所属部门';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."DEPARTMENT_NAME" IS '部门名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."CUSTOMS" IS '所属关区';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."CUSTOMS_NAME" IS '关区名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."ITEM_NAME" IS '检查项';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."CHECK_TIME" IS '检查时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."CHECK_PERSON" IS '检查人员';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."CHECK_RESULT" IS '检查结果 ECheckResult';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."RECTIFY_PLAN" IS '整改措施';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."RECTIFY_SUBMIT_TIME" IS '整改措施提交时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."RECTIFY_DEADLINE" IS '整改期限';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."RECTIFY_STATUS" IS '整改状态 ERectifyStatus';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."RECTIFY_TIME" IS '实际整改完成时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."IS_ON_TIME" IS '是否准时完成整改';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."RECTIFY_PERSON" IS '整改执行人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."RECTIFY_PERSON_NAME" IS '整改执行人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."CREATE_TIME" IS '数据创建时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."UPDATE_TIME" IS '最后更新时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECORD_ITEM"."IS_DELETE" IS '是否删除(逻辑删除)';





-- SP_CHECK_RECTIFY_PROGRESS - 隐患整改进度
CREATE TABLE "SECURE_PRODUCTING"."SP_CHECK_RECTIFY_PROGRESS"(
  "ID" BIGINT NOT NULL,
  "CHECK_RECORD_ID" BIGINT NOT NULL DEFAULT 0,
  "CHECK_ITEM_ID" BIGINT NOT NULL DEFAULT 0,
  "GRID_ID" BIGINT NOT NULL DEFAULT 0,
  "CHECK_FORM_ID" BIGINT NOT NULL DEFAULT 0,
  "CHECK_FORM_NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "ITEM_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "SUBMIT_USER" VARCHAR(50) NOT NULL DEFAULT '',
  "SUBMIT_USER_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "PROGRESS" DECIMAL(18,4) DEFAULT 0 NOT NULL,
  "STATUS" TINYINT NOT NULL DEFAULT 0,
  "CREATE_TIME" BIGINT NOT NULL DEFAULT 0,
  "UPDATE_TIME" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(),
  "IS_DELETE" TINYINT NOT NULL DEFAULT 0,
  -- 主键
  PRIMARY KEY("ID")
);
-- 索引
CREATE INDEX IDX_SP_CHECK_RECTIFY_PROGRESS_CHECK_RECORD_ID ON "SECURE_PRODUCTING"."SP_CHECK_RECTIFY_PROGRESS"("CHECK_RECORD_ID");
CREATE INDEX IDX_SP_CHECK_RECTIFY_PROGRESS_GRID_ID ON "SECURE_PRODUCTING"."SP_CHECK_RECTIFY_PROGRESS"("GRID_ID");
CREATE INDEX IDX_SP_CHECK_RECTIFY_PROGRESS_STATUS ON "SECURE_PRODUCTING"."SP_CHECK_RECTIFY_PROGRESS"("STATUS");
CREATE INDEX IDX_SP_CHECK_RECTIFY_PROGRESS_CREATE_TIME ON "SECURE_PRODUCTING"."SP_CHECK_RECTIFY_PROGRESS"("CREATE_TIME");
-- 触发器：自动赋值最后修改时间
CREATE OR REPLACE TRIGGER "TG_SP_CHECK_RECTIFY_PROGRESS"
BEFORE INSERT OR UPDATE ON "SECURE_PRODUCTING"."SP_CHECK_RECTIFY_PROGRESS" FOR EACH ROW
BEGIN
  :new.UPDATE_TIME=CURRENT_TIMESTAMP();
END;

-- 字段描述
COMMENT ON TABLE "SECURE_PRODUCTING"."SP_CHECK_RECTIFY_PROGRESS" IS '隐患整改进度';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_PROGRESS"."ID" IS '主键';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_PROGRESS"."CHECK_RECORD_ID" IS '所属检查记录';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_PROGRESS"."CHECK_ITEM_ID" IS '所属检查记录-检查项';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_PROGRESS"."GRID_ID" IS '所属网格';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_PROGRESS"."CHECK_FORM_ID" IS '所属检查表';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_PROGRESS"."CHECK_FORM_NAME" IS '检查表名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_PROGRESS"."ITEM_NAME" IS '检查项';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_PROGRESS"."SUBMIT_USER" IS '进度更新人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_PROGRESS"."SUBMIT_USER_NAME" IS '进度更新人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_PROGRESS"."PROGRESS" IS '完成进度';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_PROGRESS"."STATUS" IS '整改状态 ERectifyStatus';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_PROGRESS"."CREATE_TIME" IS '数据创建时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_PROGRESS"."UPDATE_TIME" IS '最后更新时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_PROGRESS"."IS_DELETE" IS '是否删除(逻辑删除)';





-- SP_CHECK_REVOKE - 隐患检查单撤回申请
CREATE TABLE "SECURE_PRODUCTING"."SP_CHECK_REVOKE"(
  "ID" BIGINT NOT NULL,
  "CHECK_RECORD_ID" BIGINT NOT NULL DEFAULT 0,
  "GRID_ID" BIGINT NOT NULL DEFAULT 0,
  "CHECK_FORM_ID" BIGINT NOT NULL DEFAULT 0,
  "CHECK_FORM_NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "APPLY_USER" VARCHAR(50) NOT NULL DEFAULT '',
  "APPLY_USER_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "AUDITOR" VARCHAR(50) NOT NULL DEFAULT '',
  "AUDITOR_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "AUDIT_RESULT" TINYINT NOT NULL DEFAULT 0,
  "AUDIT_TIME" BIGINT NOT NULL DEFAULT 0,
  "AUDIT_COMMENT" VARCHAR(500) NOT NULL DEFAULT '',
  "STATUS" TINYINT NOT NULL DEFAULT 0,
  "CREATE_TIME" BIGINT NOT NULL DEFAULT 0,
  "UPDATE_TIME" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(),
  "IS_DELETE" TINYINT NOT NULL DEFAULT 0,
  -- 主键
  PRIMARY KEY("ID")
);
-- 索引
CREATE INDEX IDX_SP_CHECK_REVOKE_CHECK_RECORD_ID ON "SECURE_PRODUCTING"."SP_CHECK_REVOKE"("CHECK_RECORD_ID");
CREATE INDEX IDX_SP_CHECK_REVOKE_STATUS ON "SECURE_PRODUCTING"."SP_CHECK_REVOKE"("STATUS");
CREATE INDEX IDX_SP_CHECK_REVOKE_CREATE_TIME ON "SECURE_PRODUCTING"."SP_CHECK_REVOKE"("CREATE_TIME");
-- 触发器：自动赋值最后修改时间
CREATE OR REPLACE TRIGGER "TG_SP_CHECK_REVOKE"
BEFORE INSERT OR UPDATE ON "SECURE_PRODUCTING"."SP_CHECK_REVOKE" FOR EACH ROW
BEGIN
  :new.UPDATE_TIME=CURRENT_TIMESTAMP();
END;

-- 字段描述
COMMENT ON TABLE "SECURE_PRODUCTING"."SP_CHECK_REVOKE" IS '隐患检查单撤回申请';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."ID" IS '主键';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."CHECK_RECORD_ID" IS '所属检查记录';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."GRID_ID" IS '所属网格';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."CHECK_FORM_ID" IS '所属隐患检查表';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."CHECK_FORM_NAME" IS '检查表名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."APPLY_USER" IS '申请人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."APPLY_USER_NAME" IS '申请人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."AUDITOR" IS '审核人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."AUDITOR_NAME" IS '审核人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."AUDIT_RESULT" IS '审核结果';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."AUDIT_TIME" IS '审核时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."AUDIT_COMMENT" IS '审核意见';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."STATUS" IS '状态 EAuditStatus';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."CREATE_TIME" IS '数据创建时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."UPDATE_TIME" IS '最后更新时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_REVOKE"."IS_DELETE" IS '是否删除(逻辑删除)';





-- SP_CHECK_RECTIFY_DELAY - 隐患整改延期申请
CREATE TABLE "SECURE_PRODUCTING"."SP_CHECK_RECTIFY_DELAY"(
  "ID" BIGINT NOT NULL,
  "CHECK_RECORD_ID" BIGINT NOT NULL DEFAULT 0,
  "CHECK_ITEM_ID" BIGINT NOT NULL DEFAULT 0,
  "GRID_ID" BIGINT NOT NULL DEFAULT 0,
  "CHECK_FORM_ID" BIGINT NOT NULL DEFAULT 0,
  "CHECK_FORM_NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "APPLY_USER" VARCHAR(50) NOT NULL DEFAULT '',
  "APPLY_USER_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "APPLY_DEADLINE" VARCHAR(50) NOT NULL DEFAULT '',
  "AUDITOR" VARCHAR(50) NOT NULL DEFAULT '',
  "AUDITOR_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "AUDIT_RESULT" TINYINT NOT NULL DEFAULT 0,
  "AUDIT_TIME" BIGINT NOT NULL DEFAULT 0,
  "AUDIT_COMMENT" VARCHAR(500) NOT NULL DEFAULT '',
  "STATUS" TINYINT NOT NULL DEFAULT 0,
  "CREATE_TIME" BIGINT NOT NULL DEFAULT 0,
  "UPDATE_TIME" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(),
  "IS_DELETE" TINYINT NOT NULL DEFAULT 0,
  -- 主键
  PRIMARY KEY("ID")
);
-- 索引
CREATE INDEX IDX_SP_CHECK_RECTIFY_DELAY_CHECK_RECORD_ID ON "SECURE_PRODUCTING"."SP_CHECK_RECTIFY_DELAY"("CHECK_RECORD_ID");
CREATE INDEX IDX_SP_CHECK_RECTIFY_DELAY_STATUS ON "SECURE_PRODUCTING"."SP_CHECK_RECTIFY_DELAY"("STATUS");
CREATE INDEX IDX_SP_CHECK_RECTIFY_DELAY_CREATE_TIME ON "SECURE_PRODUCTING"."SP_CHECK_RECTIFY_DELAY"("CREATE_TIME");
-- 触发器：自动赋值最后修改时间
CREATE OR REPLACE TRIGGER "TG_SP_CHECK_RECTIFY_DELAY"
BEFORE INSERT OR UPDATE ON "SECURE_PRODUCTING"."SP_CHECK_RECTIFY_DELAY" FOR EACH ROW
BEGIN
  :new.UPDATE_TIME=CURRENT_TIMESTAMP();
END;

-- 字段描述
COMMENT ON TABLE "SECURE_PRODUCTING"."SP_CHECK_RECTIFY_DELAY" IS '隐患整改延期申请';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."ID" IS '主键';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."CHECK_RECORD_ID" IS '所属检查记录';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."CHECK_ITEM_ID" IS '所属检查记录-检查项';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."GRID_ID" IS '所属网格';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."CHECK_FORM_ID" IS '所属隐患检查表';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."CHECK_FORM_NAME" IS '检查表名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."APPLY_USER" IS '申请人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."APPLY_USER_NAME" IS '申请人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."APPLY_DEADLINE" IS '申请整改期限';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."AUDITOR" IS '审核人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."AUDITOR_NAME" IS '审核人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."AUDIT_RESULT" IS '审核结果';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."AUDIT_TIME" IS '审核时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."AUDIT_COMMENT" IS '审核意见';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."STATUS" IS '状态 EAuditStatus';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."CREATE_TIME" IS '数据创建时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."UPDATE_TIME" IS '最后更新时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_CHECK_RECTIFY_DELAY"."IS_DELETE" IS '是否删除(逻辑删除)';





-- SP_DRILL_TASK - 培训任务
CREATE TABLE "SECURE_PRODUCTING"."SP_DRILL_TASK"(
  "ID" BIGINT NOT NULL,
  "TASK_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "DESCRIPTION" VARCHAR(500) NOT NULL DEFAULT '',
  "DEPARTMENT_COUNT" INT NOT NULL DEFAULT 0,
  "FINISHED_COUNT" INT NOT NULL DEFAULT 0,
  "STATUS" TINYINT NOT NULL DEFAULT 0,
  "CREATE_TIME" BIGINT NOT NULL DEFAULT 0,
  "UPDATE_TIME" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(),
  "CREATE_BY" VARCHAR(50) NOT NULL DEFAULT '',
  "CREATE_BY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "UPDATE_BY" VARCHAR(50) NOT NULL DEFAULT '',
  "UPDATE_BY_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "IS_DELETE" TINYINT NOT NULL DEFAULT 0,
  -- 主键
  PRIMARY KEY("ID")
);
-- 索引
CREATE INDEX IDX_SP_DRILL_TASK_STATUS ON "SECURE_PRODUCTING"."SP_DRILL_TASK"("STATUS");
CREATE INDEX IDX_SP_DRILL_TASK_CREATE_TIME ON "SECURE_PRODUCTING"."SP_DRILL_TASK"("CREATE_TIME");
-- 触发器：自动赋值最后修改时间
CREATE OR REPLACE TRIGGER "TG_SP_DRILL_TASK"
BEFORE INSERT OR UPDATE ON "SECURE_PRODUCTING"."SP_DRILL_TASK" FOR EACH ROW
BEGIN
  :new.UPDATE_TIME=CURRENT_TIMESTAMP();
END;

-- 字段描述
COMMENT ON TABLE "SECURE_PRODUCTING"."SP_DRILL_TASK" IS '培训任务';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK"."ID" IS '主键';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK"."TASK_NAME" IS '任务名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK"."DESCRIPTION" IS '任务描述';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK"."DEPARTMENT_COUNT" IS '设计部门数量';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK"."FINISHED_COUNT" IS '已完成部门数量';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK"."STATUS" IS '状态 ETaskStatus';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK"."CREATE_TIME" IS '数据创建时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK"."UPDATE_TIME" IS '最后更新时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK"."CREATE_BY" IS '数据创建人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK"."CREATE_BY_NAME" IS '数据创建人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK"."UPDATE_BY" IS '最后更新人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK"."UPDATE_BY_NAME" IS '最后更新人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK"."IS_DELETE" IS '是否删除(逻辑删除)';

-- SP_DRILL_TASK_PROGRESS - 培训任务进度
CREATE TABLE "SECURE_PRODUCTING"."SP_DRILL_TASK_PROGRESS"(
  "ID" BIGINT NOT NULL,
  "TASK_ID" BIGINT NOT NULL DEFAULT 0,
  "DEPARTMENT" VARCHAR(50) NOT NULL DEFAULT '',
  "DEPARTMENT_NAME" VARCHAR(200) NOT NULL DEFAULT '',
  "SUBMIT_USER" VARCHAR(50) NOT NULL DEFAULT '',
  "SUBMIT_USER_NAME" VARCHAR(50) NOT NULL DEFAULT '',
  "FINISHED_TIME" BIGINT NOT NULL DEFAULT 0,
  "STATUS" TINYINT NOT NULL DEFAULT 0,
  "CREATE_TIME" BIGINT NOT NULL DEFAULT 0,
  "UPDATE_TIME" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(),
  "IS_DELETE" TINYINT NOT NULL DEFAULT 0,
  -- 主键
  PRIMARY KEY("ID")
);
-- 索引
CREATE INDEX IDX_SP_DRILL_TASK_PROGRESS_STATUS ON "SECURE_PRODUCTING"."SP_DRILL_TASK_PROGRESS"("STATUS");
CREATE INDEX IDX_SP_DRILL_TASK_PROGRESS_CREATE_TIME ON "SECURE_PRODUCTING"."SP_DRILL_TASK_PROGRESS"("CREATE_TIME");
-- 触发器：自动赋值最后修改时间
CREATE OR REPLACE TRIGGER "TG_SP_DRILL_TASK_PROGRESS"
BEFORE INSERT OR UPDATE ON "SECURE_PRODUCTING"."SP_DRILL_TASK_PROGRESS" FOR EACH ROW
BEGIN
  :new.UPDATE_TIME=CURRENT_TIMESTAMP();
END;

-- 字段描述
COMMENT ON TABLE "SECURE_PRODUCTING"."SP_DRILL_TASK_PROGRESS" IS '培训任务进度';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK_PROGRESS"."ID" IS '主键';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK_PROGRESS"."TASK_ID" IS '所属培训任务';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK_PROGRESS"."DEPARTMENT" IS '所属部门';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK_PROGRESS"."DEPARTMENT_NAME" IS '部门名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK_PROGRESS"."SUBMIT_USER" IS '进度更新人';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK_PROGRESS"."SUBMIT_USER_NAME" IS '进度更新人名称';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK_PROGRESS"."FINISHED_TIME" IS '完成时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK_PROGRESS"."STATUS" IS '状态 ETaskStatus';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK_PROGRESS"."CREATE_TIME" IS '数据创建时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK_PROGRESS"."UPDATE_TIME" IS '最后更新时间';
COMMENT ON COLUMN "SECURE_PRODUCTING". "SP_DRILL_TASK_PROGRESS"."IS_DELETE" IS '是否删除(逻辑删除)';
