-- 更新uat环境sql语句



-- 更新动态报表字段 2026/3/19 16:40
ALTER TABLE "PRESSURE2_DYNAMIC_TB" ADD COLUMN "COPY_CONFIG" JSON;
COMMENT ON COLUMN "PRESSURE2_DYNAMIC_TB"."COPY_CONFIG" IS '复制续页配置';

-- 添加是否需要前台约检确认字段 2026/4/1 16:27
ALTER TABLE "PRESSURE2_EQUIP_BOILER_SCHEDULING" ADD COLUMN "HAS_ORDER_CONFIRM" BIT DEFAULT (1);
COMMENT ON COLUMN "PRESSURE2_EQUIP_BOILER_SCHEDULING"."HAS_ORDER_CONFIRM" IS '是否需要前台约检确认';

ALTER TABLE "PRESSURE2_EQUIP_PIPE_SCHEDULING" ADD COLUMN "HAS_ORDER_CONFIRM" BIT DEFAULT (1);
COMMENT ON COLUMN "PRESSURE2_EQUIP_PIPE_SCHEDULING"."HAS_ORDER_CONFIRM" IS '是否需要前台约检确认';


-- 添加承压检验性质关联报告模版拓展表 2026/4/10 9:44
CREATE TABLE "PRESSURE2_INSPECTION_NATURE_TEMPLATE_EXPAND"
(
    "ID" VARCHAR(64) NOT NULL,
    "INSPECTION_NATURE_TEMPLATE_ID" VARCHAR(64) NOT NULL,
    "CREATOR" VARCHAR(64) DEFAULT '',
    "CREATE_TIME" TIMESTAMP(6) NOT NULL,
    "UPDATER" VARCHAR(64) DEFAULT '',
    "UPDATE_TIME" TIMESTAMP(6),
    "DELETED" BIT DEFAULT 0,
    "PART" VARCHAR(512),
    NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ;

COMMENT ON TABLE "PRESSURE2_INSPECTION_NATURE_TEMPLATE_EXPAND" IS '承压检验性质关联报告模版';
COMMENT ON COLUMN "PRESSURE2_INSPECTION_NATURE_TEMPLATE_EXPAND"."ID" IS '主键';
COMMENT ON COLUMN "PRESSURE2_INSPECTION_NATURE_TEMPLATE_EXPAND"."INSPECTION_NATURE_TEMPLATE_ID" IS '检验性质ID';
COMMENT ON COLUMN "PRESSURE2_INSPECTION_NATURE_TEMPLATE_EXPAND"."CREATOR" IS '创建人';
COMMENT ON COLUMN "PRESSURE2_INSPECTION_NATURE_TEMPLATE_EXPAND"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "PRESSURE2_INSPECTION_NATURE_TEMPLATE_EXPAND"."UPDATER" IS '更新者';
COMMENT ON COLUMN "PRESSURE2_INSPECTION_NATURE_TEMPLATE_EXPAND"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "PRESSURE2_INSPECTION_NATURE_TEMPLATE_EXPAND"."DELETED" IS '是否删除';
COMMENT ON COLUMN "PRESSURE2_INSPECTION_NATURE_TEMPLATE_EXPAND"."PART" IS '部件，按/区分';
ALTER TABLE "PRESSURE2_INSPECTION_NATURE_TEMPLATE_EXPAND" MODIFY "PART" TEXT NULL;


ALTER TABLE "PRESSURE2_BOILER_CONNECT_RECORD_REPORT" ADD COLUMN "PROJECT_CODE" VARCHAR(50);
ALTER TABLE "PRESSURE2_BOILER_CONNECT_RECORD_REPORT" ADD COLUMN "ACCEPT_ORDER_TEMPLATE_ID" VARCHAR(64);
ALTER TABLE "PRESSURE2_BOILER_CONNECT_RECORD_REPORT" ADD COLUMN "FEE_TYPES" VARCHAR(50);
ALTER TABLE "PRESSURE2_BOILER_CONNECT_RECORD_REPORT" ADD COLUMN "FEE_CALC_TYPE" VARCHAR(50);
ALTER TABLE "PRESSURE2_BOILER_CONNECT_RECORD_REPORT" ADD COLUMN "FEE" VARCHAR(64);
ALTER TABLE "PRESSURE2_BOILER_CONNECT_RECORD_REPORT" ADD COLUMN "STATUS" VARCHAR(50);
COMMENT ON COLUMN "PRESSURE2_BOILER_CONNECT_RECORD_REPORT"."PROJECT_CODE" IS '项目代码';
COMMENT ON COLUMN "PRESSURE2_BOILER_CONNECT_RECORD_REPORT"."ACCEPT_ORDER_TEMPLATE_ID" IS '受理单模板';
COMMENT ON COLUMN "PRESSURE2_BOILER_CONNECT_RECORD_REPORT"."FEE_TYPES" IS '费用类型';
COMMENT ON COLUMN "PRESSURE2_BOILER_CONNECT_RECORD_REPORT"."FEE_CALC_TYPE" IS '费用计算类型';
COMMENT ON COLUMN "PRESSURE2_BOILER_CONNECT_RECORD_REPORT"."FEE" IS '费用';
COMMENT ON COLUMN "PRESSURE2_BOILER_CONNECT_RECORD_REPORT"."STATUS" IS '状态';

ALTER TABLE "PRESSURE2_BOILER_CONNECT_RECORD_REPORT" ADD COLUMN "IS_MAIN_PROJECT" BIT;
COMMENT ON COLUMN "PRESSURE2_BOILER_CONNECT_RECORD_REPORT"."ACCEPT_ORDER_TEMPLATE_ID" IS '受理单模板（参数计算时为报表id）';
COMMENT ON COLUMN "PRESSURE2_BOILER_CONNECT_RECORD_REPORT"."FEE_TYPES" IS '费用类型(法定收费:1,服务收费:0),按,分割';
COMMENT ON COLUMN "PRESSURE2_BOILER_CONNECT_RECORD_REPORT"."FEE_CALC_TYPE" IS '费用计算类型(固定费用:1,参数计算:0)';
COMMENT ON COLUMN "PRESSURE2_BOILER_CONNECT_RECORD_REPORT"."IS_MAIN_PROJECT" IS '是否为主项目';


ALTER TABLE "PRESSURE2_BOILER_CONNECT_RECORD_REPORT" ADD COLUMN "FEE_FILE_URL" VARCHAR(128);
COMMENT ON COLUMN "PRESSURE2_BOILER_CONNECT_RECORD_REPORT"."FEE_FILE_URL" IS '费用计算url';


CREATE TABLE "PRESSURE2_DYNAMIC_TB_FEE_COL"
(
    "ID" VARCHAR(64) NOT NULL,
    "CREATE_TIME" TIMESTAMP(6),
    "CREATOR" VARCHAR(64),
    "UPDATE_TIME" TIMESTAMP(6),
    "UPDATER" VARCHAR(64),
    "DELETED" BIT DEFAULT 0,
    "CODE" VARCHAR(50),
    "NAME" VARCHAR(50),
    "COL_TYPE" VARCHAR(50),
    "VAL_TYPE" VARCHAR(50),
    "DESCRIPTION" VARCHAR(50),
    "PROJECT_ID" TEXT,
    NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ;

COMMENT ON TABLE "PRESSURE2_DYNAMIC_TB_FEE_COL" IS '承压动态报表字段';
COMMENT ON COLUMN "PRESSURE2_DYNAMIC_TB_FEE_COL"."ID" IS '主键';
COMMENT ON COLUMN "PRESSURE2_DYNAMIC_TB_FEE_COL"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "PRESSURE2_DYNAMIC_TB_FEE_COL"."CREATOR" IS '创建人';
COMMENT ON COLUMN "PRESSURE2_DYNAMIC_TB_FEE_COL"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "PRESSURE2_DYNAMIC_TB_FEE_COL"."UPDATER" IS '更新人';
COMMENT ON COLUMN "PRESSURE2_DYNAMIC_TB_FEE_COL"."DELETED" IS '是否删除';
COMMENT ON COLUMN "PRESSURE2_DYNAMIC_TB_FEE_COL"."CODE" IS '字段标识';
COMMENT ON COLUMN "PRESSURE2_DYNAMIC_TB_FEE_COL"."NAME" IS '字段名称';
COMMENT ON COLUMN "PRESSURE2_DYNAMIC_TB_FEE_COL"."COL_TYPE" IS '字段类型';
COMMENT ON COLUMN "PRESSURE2_DYNAMIC_TB_FEE_COL"."VAL_TYPE" IS '值类型';
COMMENT ON COLUMN "PRESSURE2_DYNAMIC_TB_FEE_COL"."DESCRIPTION" IS '说明';
COMMENT ON COLUMN "PRESSURE2_DYNAMIC_TB_FEE_COL"."PROJECT_ID" IS '关联项目';


ALTER TABLE "PRESSURE2_EQUIP_PIPE_SCHEDULING_CHECK" ADD COLUMN "FEE_CALCULATE_JSON" TEXT;
COMMENT ON COLUMN "PRESSURE2_EQUIP_PIPE_SCHEDULING_CHECK"."FEE_CALCULATE_JSON" IS '费用计算json';

ALTER TABLE "PRESSURE2_EQUIP_BOILER_SCHEDULING_CHECK" ADD COLUMN "FEE_CALCULATE_JSON" TEXT;
COMMENT ON COLUMN "PRESSURE2_EQUIP_BOILER_SCHEDULING_CHECK"."FEE_CALCULATE_JSON" IS '费用计算json';

-- 添加字段 20260417
ALTER TABLE "PRESSURE2_EQUIP_PIPE_SCHEDULING_CHECK" ADD COLUMN "TYPE" VARCHAR(50);
COMMENT ON COLUMN "PRESSURE2_EQUIP_PIPE_SCHEDULING_CHECK"."TYPE" IS '类型 1 法定 2 服务';


ALTER TABLE "PRESSURE2_EQUIP_PIPE_SCHEDULING_FEE" ADD COLUMN "CHARGE_TYPE" VARCHAR(50);
ALTER TABLE "PRESSURE2_EQUIP_PIPE_SCHEDULING_FEE" ADD COLUMN "IS_EXEMPT" VARCHAR(50);
ALTER TABLE "PRESSURE2_EQUIP_PIPE_SCHEDULING_FEE" ADD COLUMN "SHOULD_AMOUNT" DECIMAL(22,6);
ALTER TABLE "PRESSURE2_EQUIP_PIPE_SCHEDULING_FEE" ADD COLUMN "SERVICE_AMOUNT" DECIMAL(22,6);
ALTER TABLE "PRESSURE2_EQUIP_PIPE_SCHEDULING_FEE" ADD COLUMN "REDUCE_FEE" DECIMAL(22,6);
COMMENT ON COLUMN "PRESSURE2_EQUIP_PIPE_SCHEDULING_FEE"."CHARGE_TYPE" IS '收费类型 1 非合同收费 2 合同收费';
COMMENT ON COLUMN "PRESSURE2_EQUIP_PIPE_SCHEDULING_FEE"."IS_EXEMPT" IS '是否免征 0 否 1 是';
COMMENT ON COLUMN "PRESSURE2_EQUIP_PIPE_SCHEDULING_FEE"."SHOULD_AMOUNT" IS '应收法定金额';
COMMENT ON COLUMN "PRESSURE2_EQUIP_PIPE_SCHEDULING_FEE"."SERVICE_AMOUNT" IS '服务收费金额';
COMMENT ON COLUMN "PRESSURE2_EQUIP_PIPE_SCHEDULING_FEE"."REDUCE_FEE" IS '免征费用';


ALTER TABLE "PRESSURE2_PIPE_TASK_ORDER_ITEM_REPORT" ADD COLUMN "FEE_TYPE" VARCHAR(50);
COMMENT ON COLUMN "PRESSURE2_PIPE_TASK_ORDER_ITEM_REPORT"."FEE_TYPE" IS '费用类型（1=法定，2=服务）';

-- 添加字段 20260418
ALTER TABLE "PRESSURE2_EQUIP_BOILER_SCHEDULING_CHECK" ADD COLUMN "TYPE" VARCHAR(50);
COMMENT ON COLUMN "PRESSURE2_EQUIP_BOILER_SCHEDULING_CHECK"."TYPE" IS '类型 1 法定 2 服务';


ALTER TABLE "PRESSURE2_EQUIP_BOILER_SCHEDULING_FEE" ADD COLUMN "CHARGE_TYPE" VARCHAR(50);
ALTER TABLE "PRESSURE2_EQUIP_BOILER_SCHEDULING_FEE" ADD COLUMN "IS_EXEMPT" VARCHAR(50);
ALTER TABLE "PRESSURE2_EQUIP_BOILER_SCHEDULING_FEE" ADD COLUMN "SHOULD_AMOUNT" DECIMAL(22,6);
ALTER TABLE "PRESSURE2_EQUIP_BOILER_SCHEDULING_FEE" ADD COLUMN "SERVICE_AMOUNT" DECIMAL(22,6);
ALTER TABLE "PRESSURE2_EQUIP_BOILER_SCHEDULING_FEE" ADD COLUMN "REDUCE_FEE" DECIMAL(22,6);
COMMENT ON COLUMN "PRESSURE2_EQUIP_BOILER_SCHEDULING_FEE"."CHARGE_TYPE" IS '收费类型 1 非合同收费 2 合同收费';
COMMENT ON COLUMN "PRESSURE2_EQUIP_BOILER_SCHEDULING_FEE"."IS_EXEMPT" IS '是否免征 0 否 1 是';
COMMENT ON COLUMN "PRESSURE2_EQUIP_BOILER_SCHEDULING_FEE"."SHOULD_AMOUNT" IS '应收法定金额';
COMMENT ON COLUMN "PRESSURE2_EQUIP_BOILER_SCHEDULING_FEE"."SERVICE_AMOUNT" IS '服务收费金额';
COMMENT ON COLUMN "PRESSURE2_EQUIP_BOILER_SCHEDULING_FEE"."REDUCE_FEE" IS '免征费用';


ALTER TABLE "PRESSURE2_BOILER_TASK_ORDER_ITEM_REPORT" ADD COLUMN "FEE_TYPE" VARCHAR(50);
COMMENT ON COLUMN "PRESSURE2_BOILER_TASK_ORDER_ITEM_REPORT"."FEE_TYPE" IS '费用类型（1=法定，2=服务）';


CREATE TABLE PRESSURE2_EQUIP_BOILER_PRESSURE_PART
(
    ID            VARCHAR(64) NOT NULL,
    BOILER_ID     VARCHAR(64) NOT NULL,
    PART_TYPE     VARCHAR(64),
    PART_NAME     VARCHAR(255),
    SPECIFICATION VARCHAR(128),
    MATERIAL      VARCHAR(128),
    REMARK        VARCHAR(500),
    CREATOR       VARCHAR(64),
    CREATE_TIME   TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    UPDATER       VARCHAR(64),
    UPDATE_TIME   TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    DELETED       CHAR(1)   DEFAULT '0',
    PRIMARY KEY (ID)
);

CREATE SEQUENCE PRESSURE2_EQUIP_BOILER_PRESSURE_PART_SEQ START WITH 1 INCREMENT BY 1;


ALTER TABLE "PRESSURE2_EQUIP_PIPE_SCHEDULING" ADD COLUMN "SOURCE_ID" VARCHAR(64);
COMMENT ON COLUMN "PRESSURE2_EQUIP_PIPE_SCHEDULING"."SOURCE_ID" IS '复制行的源id';

CREATE TABLE "PRESSURE2_USER_TEMPLATE_LIBRARY"
(
    "ID" VARCHAR2(64) NOT NULL,
    "USER_ID" VARCHAR2(64) NOT NULL,
    "TEMPLATE_ID" VARCHAR2(64) NOT NULL,
    "NAME" VARCHAR2(255) NOT NULL,
    "DEFAULT_JSON" TEXT,
    "CREATOR" VARCHAR2(64) DEFAULT '',
    "CREATE_TIME" TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "UPDATER" VARCHAR2(64) DEFAULT '',
    "UPDATE_TIME" TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "DELETED" BIT DEFAULT 0,
    "TEMPLATE_TYPE" VARCHAR2(255),
    NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ;

COMMENT ON TABLE "PRESSURE2_USER_TEMPLATE_LIBRARY" IS '用户操作指导书模板库';
COMMENT ON COLUMN "PRESSURE2_USER_TEMPLATE_LIBRARY"."ID" IS '主键';
COMMENT ON COLUMN "PRESSURE2_USER_TEMPLATE_LIBRARY"."USER_ID" IS '用户id';
COMMENT ON COLUMN "PRESSURE2_USER_TEMPLATE_LIBRARY"."TEMPLATE_ID" IS '模版id';
COMMENT ON COLUMN "PRESSURE2_USER_TEMPLATE_LIBRARY"."NAME" IS '模版名称';
COMMENT ON COLUMN "PRESSURE2_USER_TEMPLATE_LIBRARY"."DEFAULT_JSON" IS '模版默认json';
COMMENT ON COLUMN "PRESSURE2_USER_TEMPLATE_LIBRARY"."CREATOR" IS '创建人';
COMMENT ON COLUMN "PRESSURE2_USER_TEMPLATE_LIBRARY"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "PRESSURE2_USER_TEMPLATE_LIBRARY"."UPDATER" IS '更新者';
COMMENT ON COLUMN "PRESSURE2_USER_TEMPLATE_LIBRARY"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "PRESSURE2_USER_TEMPLATE_LIBRARY"."DELETED" IS '是否删除';
COMMENT ON COLUMN "PRESSURE2_USER_TEMPLATE_LIBRARY"."TEMPLATE_TYPE" IS '模版类型';

CREATE TABLE "PRESSURE2_USER_WALL_THICKNESS_TEMPLATE"
(
    "ID" VARCHAR2(64) NOT NULL,
    "USER_ID" VARCHAR2(64) NOT NULL,
    "TEMPLATE_ID" VARCHAR2(64) NOT NULL,
    "NAME" VARCHAR2(255) NOT NULL,
    "DEFAULT_VALUE" TEXT,
    "CREATOR" VARCHAR2(64) DEFAULT '',
    "CREATE_TIME" TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "UPDATER" VARCHAR2(64) DEFAULT '',
    "UPDATE_TIME" TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "DELETED" BIT DEFAULT 0,
    NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ;

COMMENT ON TABLE "PRESSURE2_USER_WALL_THICKNESS_TEMPLATE" IS '用户壁厚测定点数模版';
COMMENT ON COLUMN "PRESSURE2_USER_WALL_THICKNESS_TEMPLATE"."ID" IS '主键';
COMMENT ON COLUMN "PRESSURE2_USER_WALL_THICKNESS_TEMPLATE"."USER_ID" IS '用户id';
COMMENT ON COLUMN "PRESSURE2_USER_WALL_THICKNESS_TEMPLATE"."TEMPLATE_ID" IS '模版id';
COMMENT ON COLUMN "PRESSURE2_USER_WALL_THICKNESS_TEMPLATE"."NAME" IS '模版名称';
COMMENT ON COLUMN "PRESSURE2_USER_WALL_THICKNESS_TEMPLATE"."DEFAULT_VALUE" IS '模版值';
COMMENT ON COLUMN "PRESSURE2_USER_WALL_THICKNESS_TEMPLATE"."CREATOR" IS '创建人';
COMMENT ON COLUMN "PRESSURE2_USER_WALL_THICKNESS_TEMPLATE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "PRESSURE2_USER_WALL_THICKNESS_TEMPLATE"."UPDATER" IS '更新者';
COMMENT ON COLUMN "PRESSURE2_USER_WALL_THICKNESS_TEMPLATE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "PRESSURE2_USER_WALL_THICKNESS_TEMPLATE"."DELETED" IS '是否删除';
