-- ============================================================
-- HighGo (PostgreSQL-compatible) DDL for SLAJ engineering tables
-- Converted from Oracle SLAJ.sql
-- ============================================================

-- ------------------------------------------------------------
-- 1. ATT_ENG_BASE - 工程基础信息表（宽表，含所有工程类型属性字段）
-- ------------------------------------------------------------
CREATE TABLE IF NOT EXISTS slaj.att_eng_base (
    guid         CHAR(32) NOT NULL,
    pguid        CHAR(32),
    ad_guid      CHAR(32),
    ad_code      VARCHAR(20),
    lk_guid      CHAR(32),
    eng_name     VARCHAR(100),
    eng_guid     CHAR(32),
    org_rest     CHAR(32),
    org_jurd     CHAR(32),
    old_code     VARCHAR(12),
    impo_grad    CHAR(1),
    eng_scal     CHAR(1),
    appr_budg    NUMERIC(12,4),
    if_rein_force CHAR(1),
    eng_grad     CHAR(1),
    tot_cap      NUMERIC(13,3),
    res_code     VARCHAR(20),
    start_long   NUMERIC(11,8),
    start_lat    NUMERIC(10,8),
    end_long     NUMERIC(11,8),
    end_lat      NUMERIC(10,8),
    start_loc    VARCHAR(256),
    end_loc      VARCHAR(256),
    firs_poin_ad_guid CHAR(32),
    end_ad_guid  CHAR(32),
    rv_guid      CHAR(32),
    des_fl_stand NUMERIC(5),
    oflp_code    CHAR(32),
    proj_guid    CHAR(32),
    cen_long     NUMERIC(11,8),
    cen_lat      NUMERIC(10,8),
    stat         CHAR(1),
    start_date   TIMESTAMP,
    comp_date    TIMESTAMP,
    eng_stat     CHAR(1),
    org_guid     CHAR(32),
    eng_rein_force_guid CHAR(32),
    note         VARCHAR(256),
    coll_time    TIMESTAMP,
    upd_time     TIMESTAMP,
    from_date    TIMESTAMP,
    to_date      TIMESTAMP,
    rec_pers     CHAR(32),
    eng_code     VARCHAR(40),
    eng_type     CHAR(2),
    wiun_wdev_name    VARCHAR(1000),
    wiun_wsup_name    VARCHAR(1000),
    wiun_wcon_name    VARCHAR(1000),
    wiun_wsur_name    VARCHAR(1000),
    wiun_acor_name    VARCHAR(1000),
    wiun_qss_name     VARCHAR(1000),
    gov_leg_pers       VARCHAR(100),
    gov_leg_pers_duty  VARCHAR(100),
    gov_leg_pers_tel   VARCHAR(100),
    wiun_wao_leg_pers      VARCHAR(100),
    wiun_wao_leg_pers_duty VARCHAR(100),
    wiun_wao_leg_pers_tel  VARCHAR(100),
    leg_pers       VARCHAR(100),
    leg_pers_duty  VARCHAR(100),
    leg_pers_tel   VARCHAR(100),
    char_pers      VARCHAR(100),
    char_pers_duty VARCHAR(100),
    char_pers_tel  VARCHAR(100),
    res_loc        VARCHAR(256),
    dam_type_mat   CHAR(1),
    dam_type_str   CHAR(1),
    dam_size_hig   NUMERIC(18,2),
    dam_size_len   NUMERIC(18,2),
    dam_cre_elv    NUMERIC(18,2),
    fl_low_lim_lev      NUMERIC(15,3),
    fl_low_lim_lev_end  TIMESTAMP,
    des_fl_stag    NUMERIC(15,3),
    main_fl_type   CHAR(1),
    dead_lev       NUMERIC(14,2),
    dead_cap       NUMERIC(10,3),
    flco_cap       NUMERIC(9,2),
    waga_code      VARCHAR(20),
    waga_loc       VARCHAR(256),
    waga_type      CHAR(1),
    gaor_num       NUMERIC(2),
    lock_disc      NUMERIC(8,2),
    ener_diss      CHAR(1),
    pust_code      VARCHAR(20),
    pust_loc       VARCHAR(256),
    pust_type      CHAR(1),
    des_head       NUMERIC(8,2),
    ins_flow       NUMERIC(15,4),
    des_flow       NUMERIC(15,4),
    pust_num       NUMERIC(2),
    ins_pow        NUMERIC(8,3),
    hyst_code      VARCHAR(20),
    if_rs_pow      CHAR(1),
    res_name       VARCHAR(100),
    hyst_site      VARCHAR(256),
    hyst_type      CHAR(1),
    if_rhyst       CHAR(1),
    ins_cap        NUMERIC(10,2),
    dam_reg_code   VARCHAR(20),
    dam_iden_cate  CHAR(1),
    dam_iden_org   VARCHAR(100),
    dam_iden_date  TIMESTAMP,
    dam_hig        NUMERIC(18,2),
    dike_code      VARCHAR(20),
    dike_grad      CHAR(1),
    dike_type      CHAR(1),
    dike_len       NUMERIC(12,2),
    dike_slope     NUMERIC(8,2),
    rv_bank        VARCHAR(6),
    cros_situ      CHAR(1),
    if_road        CHAR(1),
    irr_code       VARCHAR(20),
    irr_loc        VARCHAR(256),
    tot_irr_area   NUMERIC(10),
    eff_irr_area   NUMERIC(10),
    des_irr_area   NUMERIC(12,2),
    chan_hign_leve CHAR(1),
    chan_num       NUMERIC(10),
    chan_len_tot   NUMERIC(8,2),
    chan_des_flow  NUMERIC(10,2),
    chsy_gate_num  NUMERIC(10),
    chsy_aqu_num   NUMERIC(10),
    chsy_drop_num  NUMERIC(10),
    chsy_inv_siph_num NUMERIC(10),
    chsy_tun_num   NUMERIC(10),
    chsy_cul_num   NUMERIC(10),
    chsy_farm_bri_num NUMERIC(10),
    chsy_mea_num   NUMERIC(10),
    chsy_dit_pust_st_num NUMERIC(10),
    wadi_code      VARCHAR(20),
    line_tot_len   NUMERIC(8,2),
    des_pump_dis   NUMERIC(16,2),
    des_pump_vol   NUMERIC(19,3),
    sd_code        VARCHAR(20),
    sd_loc         VARCHAR(256),
    con_area       NUMERIC(9,2),
    warp_cap       NUMERIC(9,2),
    sd_size_len    NUMERIC(7,2),
    sd_size_hig    NUMERIC(7,3),
    cws_code       VARCHAR(20),
    cws_loc        VARCHAR(256),
    wint_ws_type   CHAR(1),
    wasu_type      CHAR(1),
    des_wasu_scal  NUMERIC(18,2),
    des_wasu_pop   NUMERIC(8,4),
    wate_puri      CHAR(1),
    fl_low_lim_lev_start TIMESTAMP,
    PRIMARY KEY (guid)
);

COMMENT ON TABLE slaj.att_eng_base IS '工程基础信息表（宽表，含所有工程类型属性字段）';
-- 通用字段
COMMENT ON COLUMN slaj.att_eng_base.guid IS '主键GUID';
COMMENT ON COLUMN slaj.att_eng_base.pguid IS '父级GUID';
COMMENT ON COLUMN slaj.att_eng_base.ad_guid IS '行政区划GUID';
COMMENT ON COLUMN slaj.att_eng_base.ad_code IS '行政区划编码';
COMMENT ON COLUMN slaj.att_eng_base.lk_guid IS '河流湖泊GUID';
COMMENT ON COLUMN slaj.att_eng_base.eng_name IS '工程名称';
COMMENT ON COLUMN slaj.att_eng_base.eng_guid IS '工程GUID';
COMMENT ON COLUMN slaj.att_eng_base.org_rest IS '管理单位';
COMMENT ON COLUMN slaj.att_eng_base.org_jurd IS '管辖单位';
COMMENT ON COLUMN slaj.att_eng_base.old_code IS '一张图工程编码';
COMMENT ON COLUMN slaj.att_eng_base.impo_grad IS '重要程度';
COMMENT ON COLUMN slaj.att_eng_base.eng_scal IS '工程规模';
COMMENT ON COLUMN slaj.att_eng_base.appr_budg IS '批复投资（万元）';
COMMENT ON COLUMN slaj.att_eng_base.if_rein_force IS '除险加固状态';
COMMENT ON COLUMN slaj.att_eng_base.eng_grad IS '工程等别';
COMMENT ON COLUMN slaj.att_eng_base.tot_cap IS '总库容';
COMMENT ON COLUMN slaj.att_eng_base.res_code IS '水库编码';
COMMENT ON COLUMN slaj.att_eng_base.start_long IS '起点经度（°）';
COMMENT ON COLUMN slaj.att_eng_base.start_lat IS '起点纬度（°）';
COMMENT ON COLUMN slaj.att_eng_base.end_long IS '终点经度（°）';
COMMENT ON COLUMN slaj.att_eng_base.end_lat IS '终点纬度（°）';
COMMENT ON COLUMN slaj.att_eng_base.start_loc IS '起点位置';
COMMENT ON COLUMN slaj.att_eng_base.end_loc IS '终点位置';
COMMENT ON COLUMN slaj.att_eng_base.firs_poin_ad_guid IS '首点行政区划GUID';
COMMENT ON COLUMN slaj.att_eng_base.end_ad_guid IS '末点行政区划GUID';
COMMENT ON COLUMN slaj.att_eng_base.rv_guid IS '河流GUID';
COMMENT ON COLUMN slaj.att_eng_base.des_fl_stand IS '设计防洪标准（年）';
COMMENT ON COLUMN slaj.att_eng_base.oflp_code IS '编码';
COMMENT ON COLUMN slaj.att_eng_base.proj_guid IS '项目GUID';
COMMENT ON COLUMN slaj.att_eng_base.cen_long IS '中心经度（°）';
COMMENT ON COLUMN slaj.att_eng_base.cen_lat IS '中心纬度（°）';
COMMENT ON COLUMN slaj.att_eng_base.stat IS '状态';
COMMENT ON COLUMN slaj.att_eng_base.start_date IS '开工日期';
COMMENT ON COLUMN slaj.att_eng_base.comp_date IS '完工日期';
COMMENT ON COLUMN slaj.att_eng_base.eng_stat IS '工程状态';
COMMENT ON COLUMN slaj.att_eng_base.org_guid IS '机构GUID';
COMMENT ON COLUMN slaj.att_eng_base.eng_rein_force_guid IS '被除险加固工程GUID';
COMMENT ON COLUMN slaj.att_eng_base.note IS '备注';
COMMENT ON COLUMN slaj.att_eng_base.coll_time IS '采集时间';
COMMENT ON COLUMN slaj.att_eng_base.upd_time IS '更新时间';
COMMENT ON COLUMN slaj.att_eng_base.from_date IS '属性建立时间';
COMMENT ON COLUMN slaj.att_eng_base.to_date IS '属性终止时间';
COMMENT ON COLUMN slaj.att_eng_base.rec_pers IS '记录人员';
COMMENT ON COLUMN slaj.att_eng_base.eng_code IS '工程编码';
COMMENT ON COLUMN slaj.att_eng_base.eng_type IS '工程类型';
COMMENT ON COLUMN slaj.att_eng_base.wiun_wdev_name IS '水行政主管单位名称';
COMMENT ON COLUMN slaj.att_eng_base.wiun_wsup_name IS '上级主管单位名称';
COMMENT ON COLUMN slaj.att_eng_base.wiun_wcon_name IS '建设单位名称';
COMMENT ON COLUMN slaj.att_eng_base.wiun_wsur_name IS '质监单位名称';
COMMENT ON COLUMN slaj.att_eng_base.wiun_acor_name IS '安监单位名称';
COMMENT ON COLUMN slaj.att_eng_base.wiun_qss_name IS '质量安全监督单位名称';
COMMENT ON COLUMN slaj.att_eng_base.gov_leg_pers IS '政府负责人';
COMMENT ON COLUMN slaj.att_eng_base.gov_leg_pers_duty IS '政府负责人职务';
COMMENT ON COLUMN slaj.att_eng_base.gov_leg_pers_tel IS '政府负责人电话';
COMMENT ON COLUMN slaj.att_eng_base.wiun_wao_leg_pers IS '水行政主管部门负责人';
COMMENT ON COLUMN slaj.att_eng_base.wiun_wao_leg_pers_duty IS '水行政主管部门负责人职务';
COMMENT ON COLUMN slaj.att_eng_base.wiun_wao_leg_pers_tel IS '水行政主管部门负责人电话';
COMMENT ON COLUMN slaj.att_eng_base.leg_pers IS '项目法人代表';
COMMENT ON COLUMN slaj.att_eng_base.leg_pers_duty IS '项目法人代表职务';
COMMENT ON COLUMN slaj.att_eng_base.leg_pers_tel IS '项目法人代表电话';
COMMENT ON COLUMN slaj.att_eng_base.char_pers IS '现场负责人';
COMMENT ON COLUMN slaj.att_eng_base.char_pers_duty IS '现场负责人职务';
COMMENT ON COLUMN slaj.att_eng_base.char_pers_tel IS '现场负责人电话';
-- 水库属性
COMMENT ON COLUMN slaj.att_eng_base.res_loc IS '水库位置';
COMMENT ON COLUMN slaj.att_eng_base.dam_type_mat IS '坝型（材料）';
COMMENT ON COLUMN slaj.att_eng_base.dam_type_str IS '坝型（结构）';
COMMENT ON COLUMN slaj.att_eng_base.dam_size_hig IS '坝高（m）';
COMMENT ON COLUMN slaj.att_eng_base.dam_size_len IS '坝长（m）';
COMMENT ON COLUMN slaj.att_eng_base.dam_cre_elv IS '坝顶高程（m）';
COMMENT ON COLUMN slaj.att_eng_base.fl_low_lim_lev IS '汛限水位（m）';
COMMENT ON COLUMN slaj.att_eng_base.fl_low_lim_lev_end IS '汛限水位截止时间';
COMMENT ON COLUMN slaj.att_eng_base.des_fl_stag IS '设计洪水位（m）';
COMMENT ON COLUMN slaj.att_eng_base.main_fl_type IS '主要洪水类型';
COMMENT ON COLUMN slaj.att_eng_base.dead_lev IS '死水位（m）';
COMMENT ON COLUMN slaj.att_eng_base.dead_cap IS '死库容';
COMMENT ON COLUMN slaj.att_eng_base.flco_cap IS '防洪库容';
-- 水闸属性
COMMENT ON COLUMN slaj.att_eng_base.waga_code IS '水闸编码';
COMMENT ON COLUMN slaj.att_eng_base.waga_loc IS '水闸位置';
COMMENT ON COLUMN slaj.att_eng_base.waga_type IS '水闸类型';
COMMENT ON COLUMN slaj.att_eng_base.gaor_num IS '闸孔数量（孔）';
COMMENT ON COLUMN slaj.att_eng_base.lock_disc IS '闸孔净宽（m3/s）';
COMMENT ON COLUMN slaj.att_eng_base.ener_diss IS '消能方式';
-- 泵站属性
COMMENT ON COLUMN slaj.att_eng_base.pust_code IS '泵站编码';
COMMENT ON COLUMN slaj.att_eng_base.pust_loc IS '泵站位置';
COMMENT ON COLUMN slaj.att_eng_base.pust_type IS '泵站类型';
COMMENT ON COLUMN slaj.att_eng_base.des_head IS '设计扬程（m）';
COMMENT ON COLUMN slaj.att_eng_base.ins_flow IS '装机流量（m3/s）';
COMMENT ON COLUMN slaj.att_eng_base.des_flow IS '设计流量（m3/s）';
COMMENT ON COLUMN slaj.att_eng_base.pust_num IS '装机台数（台）';
COMMENT ON COLUMN slaj.att_eng_base.ins_pow IS '装机功率（kW）';
-- 水电站属性
COMMENT ON COLUMN slaj.att_eng_base.hyst_code IS '水电站编码';
COMMENT ON COLUMN slaj.att_eng_base.if_rs_pow IS '是否具有水库调节能力';
COMMENT ON COLUMN slaj.att_eng_base.res_name IS '水库名称';
COMMENT ON COLUMN slaj.att_eng_base.hyst_site IS '水电站位置';
COMMENT ON COLUMN slaj.att_eng_base.hyst_type IS '水电站类型';
COMMENT ON COLUMN slaj.att_eng_base.if_rhyst IS '是否为农村水电站';
COMMENT ON COLUMN slaj.att_eng_base.ins_cap IS '装机容量（kW）';
COMMENT ON COLUMN slaj.att_eng_base.dam_reg_code IS '大坝注册登记号';
COMMENT ON COLUMN slaj.att_eng_base.dam_iden_cate IS '大坝鉴定类别';
COMMENT ON COLUMN slaj.att_eng_base.dam_iden_org IS '大坝鉴定组织单位';
COMMENT ON COLUMN slaj.att_eng_base.dam_iden_date IS '大坝鉴定日期';
COMMENT ON COLUMN slaj.att_eng_base.dam_hig IS '坝高（水电站）（m）';
-- 堤防属性
COMMENT ON COLUMN slaj.att_eng_base.dike_code IS '堤防编码';
COMMENT ON COLUMN slaj.att_eng_base.dike_grad IS '堤防级别';
COMMENT ON COLUMN slaj.att_eng_base.dike_type IS '堤防类型';
COMMENT ON COLUMN slaj.att_eng_base.dike_len IS '堤防长度（m）';
COMMENT ON COLUMN slaj.att_eng_base.dike_slope IS '堤防边坡';
COMMENT ON COLUMN slaj.att_eng_base.rv_bank IS '所在岸别';
COMMENT ON COLUMN slaj.att_eng_base.cros_situ IS '穿堤建筑物';
COMMENT ON COLUMN slaj.att_eng_base.if_road IS '是否堤顶道路';
-- 灌区属性
COMMENT ON COLUMN slaj.att_eng_base.irr_code IS '灌区编码';
COMMENT ON COLUMN slaj.att_eng_base.irr_loc IS '灌区位置';
COMMENT ON COLUMN slaj.att_eng_base.tot_irr_area IS '总灌溉面积（亩）';
COMMENT ON COLUMN slaj.att_eng_base.eff_irr_area IS '有效灌溉面积（亩）';
COMMENT ON COLUMN slaj.att_eng_base.des_irr_area IS '设计灌溉面积（亩）';
COMMENT ON COLUMN slaj.att_eng_base.chan_hign_leve IS '渠道最高级别';
COMMENT ON COLUMN slaj.att_eng_base.chan_num IS '渠道数量（条）';
COMMENT ON COLUMN slaj.att_eng_base.chan_len_tot IS '渠道总长度（m）';
COMMENT ON COLUMN slaj.att_eng_base.chan_des_flow IS '渠道设计流量（m3/s）';
COMMENT ON COLUMN slaj.att_eng_base.chsy_gate_num IS '水闸数量（座）';
COMMENT ON COLUMN slaj.att_eng_base.chsy_aqu_num IS '渡槽数量（座）';
COMMENT ON COLUMN slaj.att_eng_base.chsy_drop_num IS '跌水数量（座）';
COMMENT ON COLUMN slaj.att_eng_base.chsy_inv_siph_num IS '倒虹吸数量（座）';
COMMENT ON COLUMN slaj.att_eng_base.chsy_tun_num IS '隧洞数量（座）';
COMMENT ON COLUMN slaj.att_eng_base.chsy_cul_num IS '涵洞数量（座）';
COMMENT ON COLUMN slaj.att_eng_base.chsy_farm_bri_num IS '农桥数量（座）';
COMMENT ON COLUMN slaj.att_eng_base.chsy_mea_num IS '量水设施数量（座）';
COMMENT ON COLUMN slaj.att_eng_base.chsy_dit_pust_st_num IS '渠系排水泵站数量（座）';
-- 引调水属性
COMMENT ON COLUMN slaj.att_eng_base.wadi_code IS '引调水编码';
COMMENT ON COLUMN slaj.att_eng_base.line_tot_len IS '管线总长度（km）';
COMMENT ON COLUMN slaj.att_eng_base.des_pump_dis IS '设计泵站流量（104m3）';
COMMENT ON COLUMN slaj.att_eng_base.des_pump_vol IS '设计泵站扬程（m3/s）';
-- 淤地坝属性
COMMENT ON COLUMN slaj.att_eng_base.sd_code IS '淤地坝编码';
COMMENT ON COLUMN slaj.att_eng_base.sd_loc IS '淤地坝位置';
COMMENT ON COLUMN slaj.att_eng_base.con_area IS '控制面积（km2）';
COMMENT ON COLUMN slaj.att_eng_base.warp_cap IS '淤积库容（104m3）';
COMMENT ON COLUMN slaj.att_eng_base.sd_size_len IS '坝长（m）';
COMMENT ON COLUMN slaj.att_eng_base.sd_size_hig IS '坝高（m）';
-- 农村供水属性
COMMENT ON COLUMN slaj.att_eng_base.cws_code IS '农村供水编码';
COMMENT ON COLUMN slaj.att_eng_base.cws_loc IS '农村供水位置';
COMMENT ON COLUMN slaj.att_eng_base.wint_ws_type IS '供水水源类型';
COMMENT ON COLUMN slaj.att_eng_base.wasu_type IS '供水方式';
COMMENT ON COLUMN slaj.att_eng_base.des_wasu_scal IS '设计供水规模（m3/日）';
COMMENT ON COLUMN slaj.att_eng_base.des_wasu_pop IS '设计供水人口（万人）';
COMMENT ON COLUMN slaj.att_eng_base.wate_puri IS '水净化处理';
COMMENT ON COLUMN slaj.att_eng_base.fl_low_lim_lev_start IS '汛限水位开始时间';

-- ------------------------------------------------------------
-- 2. ATT_ENG_CWS - 农村供水工程信息表
-- ------------------------------------------------------------
CREATE TABLE IF NOT EXISTS slaj.att_eng_cws (
    guid         CHAR(32) NOT NULL,
    p_guid       CHAR(32),
    eng_name     VARCHAR(100),
    eng_guid     CHAR(32) NOT NULL,
    impo_grad    CHAR(1),
    appr_budg    NUMERIC(12,4),
    start_date   TIMESTAMP,
    comp_date    TIMESTAMP,
    eng_stat     CHAR(1),
    org_guid     CHAR(32),
    oflp_code    CHAR(32),
    if_rein_force CHAR(1),
    proj_guid    CHAR(32),
    stat         CHAR(1) NOT NULL,
    cws_code     VARCHAR(20),
    cen_long     NUMERIC(11,8),
    cen_lat      NUMERIC(10,8),
    cws_loc      VARCHAR(256),
    ad_guid      CHAR(32),
    eng_type     CHAR(1),
    wint_ws_type CHAR(1),
    wasu_type    CHAR(1),
    des_wasu_scal NUMERIC(16),
    des_wasu_pop NUMERIC(8,4),
    eng_scal     CHAR(1),
    wate_puri    CHAR(1),
    note         VARCHAR(256),
    coll_time    TIMESTAMP NOT NULL,
    upd_time     TIMESTAMP,
    rec_pers     CHAR(32),
    eng_rein_force_guid CHAR(32),
    PRIMARY KEY (guid)
);

COMMENT ON TABLE slaj.att_eng_cws IS '农村供水工程信息表';
COMMENT ON COLUMN slaj.att_eng_cws.guid IS '主键GUID';
COMMENT ON COLUMN slaj.att_eng_cws.p_guid IS '父级GUID';
COMMENT ON COLUMN slaj.att_eng_cws.eng_name IS '工程名称';
COMMENT ON COLUMN slaj.att_eng_cws.eng_guid IS '工程GUID';
COMMENT ON COLUMN slaj.att_eng_cws.impo_grad IS '重要程度';
COMMENT ON COLUMN slaj.att_eng_cws.appr_budg IS '批复投资（万元）';
COMMENT ON COLUMN slaj.att_eng_cws.start_date IS '开工日期';
COMMENT ON COLUMN slaj.att_eng_cws.comp_date IS '完工日期';
COMMENT ON COLUMN slaj.att_eng_cws.eng_stat IS '工程状态';
COMMENT ON COLUMN slaj.att_eng_cws.org_guid IS '机构GUID';
COMMENT ON COLUMN slaj.att_eng_cws.oflp_code IS '编码';
COMMENT ON COLUMN slaj.att_eng_cws.if_rein_force IS '除险加固状态';
COMMENT ON COLUMN slaj.att_eng_cws.proj_guid IS '项目GUID';
COMMENT ON COLUMN slaj.att_eng_cws.stat IS '状态';
COMMENT ON COLUMN slaj.att_eng_cws.cws_code IS '农村供水编码';
COMMENT ON COLUMN slaj.att_eng_cws.cen_long IS '中心经度（°）';
COMMENT ON COLUMN slaj.att_eng_cws.cen_lat IS '中心纬度（°）';
COMMENT ON COLUMN slaj.att_eng_cws.cws_loc IS '农村供水位置';
COMMENT ON COLUMN slaj.att_eng_cws.ad_guid IS '行政区划GUID';
COMMENT ON COLUMN slaj.att_eng_cws.eng_type IS '工程类型';
COMMENT ON COLUMN slaj.att_eng_cws.wint_ws_type IS '供水水源类型';
COMMENT ON COLUMN slaj.att_eng_cws.wasu_type IS '供水方式';
COMMENT ON COLUMN slaj.att_eng_cws.des_wasu_scal IS '设计供水规模（m3/日）';
COMMENT ON COLUMN slaj.att_eng_cws.des_wasu_pop IS '设计供水人口（万人）';
COMMENT ON COLUMN slaj.att_eng_cws.eng_scal IS '工程规模';
COMMENT ON COLUMN slaj.att_eng_cws.wate_puri IS '水净化处理';
COMMENT ON COLUMN slaj.att_eng_cws.note IS '备注';
COMMENT ON COLUMN slaj.att_eng_cws.coll_time IS '采集时间';
COMMENT ON COLUMN slaj.att_eng_cws.upd_time IS '更新时间';
COMMENT ON COLUMN slaj.att_eng_cws.rec_pers IS '记录人员';
COMMENT ON COLUMN slaj.att_eng_cws.eng_rein_force_guid IS '被除险加固工程GUID';

-- ------------------------------------------------------------
-- 3. ATT_ENG_DIKE - 堤防工程信息表
-- ------------------------------------------------------------
CREATE TABLE IF NOT EXISTS slaj.att_eng_dike (
    guid         CHAR(32) NOT NULL,
    p_guid       CHAR(32),
    eng_name     VARCHAR(100),
    eng_guid     CHAR(32) NOT NULL,
    impo_grad    CHAR(1),
    appr_budg    NUMERIC(12,4),
    start_date   TIMESTAMP,
    comp_date    TIMESTAMP,
    eng_stat     CHAR(1),
    org_guid     CHAR(32),
    oflp_code    CHAR(32),
    if_rein_force CHAR(1),
    proj_guid    CHAR(32),
    stat         CHAR(1) NOT NULL,
    dike_code    VARCHAR(20),
    start_long   NUMERIC(11,8),
    start_lat    NUMERIC(10,8),
    end_long     NUMERIC(11,8),
    end_lat      NUMERIC(10,8),
    start_loc    VARCHAR(256),
    end_loc      VARCHAR(256),
    firs_poin_ad_guid CHAR(32),
    end_ad_guid  CHAR(32),
    rv_guid      CHAR(32),
    lk_guid      CHAR(32),
    dike_grad    CHAR(1),
    dike_type    CHAR(1),
    dike_len     NUMERIC(12,2),
    dike_slope   NUMERIC(8,2),
    rv_bank      VARCHAR(6),
    cros_situ    CHAR(1),
    if_road      CHAR(1),
    des_fl_stand CHAR(1),
    note         VARCHAR(256),
    coll_time    TIMESTAMP NOT NULL,
    upd_time     TIMESTAMP,
    rec_pers     CHAR(32),
    eng_rein_force_guid CHAR(32),
    PRIMARY KEY (guid)
);

COMMENT ON TABLE slaj.att_eng_dike IS '堤防工程信息表';
COMMENT ON COLUMN slaj.att_eng_dike.guid IS '主键GUID';
COMMENT ON COLUMN slaj.att_eng_dike.p_guid IS '父级GUID';
COMMENT ON COLUMN slaj.att_eng_dike.eng_name IS '工程名称';
COMMENT ON COLUMN slaj.att_eng_dike.eng_guid IS '工程GUID';
COMMENT ON COLUMN slaj.att_eng_dike.impo_grad IS '重要程度';
COMMENT ON COLUMN slaj.att_eng_dike.appr_budg IS '批复投资（万元）';
COMMENT ON COLUMN slaj.att_eng_dike.start_date IS '开工日期';
COMMENT ON COLUMN slaj.att_eng_dike.comp_date IS '完工日期';
COMMENT ON COLUMN slaj.att_eng_dike.eng_stat IS '工程状态';
COMMENT ON COLUMN slaj.att_eng_dike.org_guid IS '机构GUID';
COMMENT ON COLUMN slaj.att_eng_dike.oflp_code IS '编码';
COMMENT ON COLUMN slaj.att_eng_dike.if_rein_force IS '除险加固状态';
COMMENT ON COLUMN slaj.att_eng_dike.proj_guid IS '项目GUID';
COMMENT ON COLUMN slaj.att_eng_dike.stat IS '状态';
COMMENT ON COLUMN slaj.att_eng_dike.dike_code IS '堤防编码';
COMMENT ON COLUMN slaj.att_eng_dike.start_long IS '起点经度（°）';
COMMENT ON COLUMN slaj.att_eng_dike.start_lat IS '起点纬度（°）';
COMMENT ON COLUMN slaj.att_eng_dike.end_long IS '终点经度（°）';
COMMENT ON COLUMN slaj.att_eng_dike.end_lat IS '终点纬度（°）';
COMMENT ON COLUMN slaj.att_eng_dike.start_loc IS '起点位置';
COMMENT ON COLUMN slaj.att_eng_dike.end_loc IS '终点位置';
COMMENT ON COLUMN slaj.att_eng_dike.firs_poin_ad_guid IS '首点行政区划GUID';
COMMENT ON COLUMN slaj.att_eng_dike.end_ad_guid IS '末点行政区划GUID';
COMMENT ON COLUMN slaj.att_eng_dike.rv_guid IS '河流GUID';
COMMENT ON COLUMN slaj.att_eng_dike.lk_guid IS '河流湖泊GUID';
COMMENT ON COLUMN slaj.att_eng_dike.dike_grad IS '堤防级别';
COMMENT ON COLUMN slaj.att_eng_dike.dike_type IS '堤防类型';
COMMENT ON COLUMN slaj.att_eng_dike.dike_len IS '堤防长度（m）';
COMMENT ON COLUMN slaj.att_eng_dike.dike_slope IS '堤防边坡';
COMMENT ON COLUMN slaj.att_eng_dike.rv_bank IS '所在岸别';
COMMENT ON COLUMN slaj.att_eng_dike.cros_situ IS '穿堤建筑物';
COMMENT ON COLUMN slaj.att_eng_dike.if_road IS '是否堤顶道路';
COMMENT ON COLUMN slaj.att_eng_dike.des_fl_stand IS '设计防洪标准（年）';
COMMENT ON COLUMN slaj.att_eng_dike.note IS '备注';
COMMENT ON COLUMN slaj.att_eng_dike.coll_time IS '采集时间';
COMMENT ON COLUMN slaj.att_eng_dike.upd_time IS '更新时间';
COMMENT ON COLUMN slaj.att_eng_dike.rec_pers IS '记录人员';
COMMENT ON COLUMN slaj.att_eng_dike.eng_rein_force_guid IS '被除险加固工程GUID';

-- ------------------------------------------------------------
-- 4. ATT_ENG_HYST - 水电站工程信息表
-- ------------------------------------------------------------
CREATE TABLE IF NOT EXISTS slaj.att_eng_hyst (
    guid         CHAR(32) NOT NULL,
    p_guid       CHAR(32),
    eng_name     VARCHAR(100),
    eng_guid     CHAR(32) NOT NULL,
    impo_grad    CHAR(1),
    appr_budg    NUMERIC(12,4),
    start_date   TIMESTAMP,
    comp_date    TIMESTAMP,
    eng_stat     CHAR(1),
    org_guid     CHAR(32),
    oflp_code    CHAR(32),
    if_rein_force CHAR(1),
    proj_guid    CHAR(32),
    stat         CHAR(1) DEFAULT '1' NOT NULL,
    hyst_code    VARCHAR(20),
    if_rs_pow    CHAR(1),
    res_code     VARCHAR(20),
    res_name     VARCHAR(100),
    cen_long     NUMERIC(11,8),
    cen_lat      NUMERIC(10,8),
    hyst_site    VARCHAR(256),
    ad_guid      CHAR(32),
    rv_guid      CHAR(32),
    hyst_type    CHAR(1),
    if_rhyst     CHAR(1),
    ins_cap      NUMERIC(10,2),
    dam_reg_code VARCHAR(20),
    dam_iden_cate CHAR(1),
    dam_iden_org VARCHAR(20),
    dam_iden_date TIMESTAMP,
    eng_grad     CHAR(1),
    eng_scal     CHAR(1),
    note         VARCHAR(256),
    coll_time    TIMESTAMP NOT NULL,
    upd_time     TIMESTAMP,
    rec_pers     CHAR(32),
    tot_cap      NUMERIC(9,2),
    dam_hig      NUMERIC(18,2),
    eng_rein_force_guid CHAR(32),
    PRIMARY KEY (guid)
);

COMMENT ON TABLE slaj.att_eng_hyst IS '水电站工程信息表';
COMMENT ON COLUMN slaj.att_eng_hyst.guid IS '主键GUID';
COMMENT ON COLUMN slaj.att_eng_hyst.p_guid IS '父级GUID';
COMMENT ON COLUMN slaj.att_eng_hyst.eng_name IS '工程名称';
COMMENT ON COLUMN slaj.att_eng_hyst.eng_guid IS '工程GUID';
COMMENT ON COLUMN slaj.att_eng_hyst.impo_grad IS '重要程度';
COMMENT ON COLUMN slaj.att_eng_hyst.appr_budg IS '批复投资（万元）';
COMMENT ON COLUMN slaj.att_eng_hyst.start_date IS '开工日期';
COMMENT ON COLUMN slaj.att_eng_hyst.comp_date IS '完工日期';
COMMENT ON COLUMN slaj.att_eng_hyst.eng_stat IS '工程状态';
COMMENT ON COLUMN slaj.att_eng_hyst.org_guid IS '机构GUID';
COMMENT ON COLUMN slaj.att_eng_hyst.oflp_code IS '编码';
COMMENT ON COLUMN slaj.att_eng_hyst.if_rein_force IS '除险加固状态';
COMMENT ON COLUMN slaj.att_eng_hyst.proj_guid IS '项目GUID';
COMMENT ON COLUMN slaj.att_eng_hyst.stat IS '状态';
COMMENT ON COLUMN slaj.att_eng_hyst.hyst_code IS '水电站编码';
COMMENT ON COLUMN slaj.att_eng_hyst.if_rs_pow IS '是否具有水库调节能力';
COMMENT ON COLUMN slaj.att_eng_hyst.res_code IS '水库编码';
COMMENT ON COLUMN slaj.att_eng_hyst.res_name IS '水库名称';
COMMENT ON COLUMN slaj.att_eng_hyst.cen_long IS '中心经度（°）';
COMMENT ON COLUMN slaj.att_eng_hyst.cen_lat IS '中心纬度（°）';
COMMENT ON COLUMN slaj.att_eng_hyst.hyst_site IS '水电站位置';
COMMENT ON COLUMN slaj.att_eng_hyst.ad_guid IS '行政区划GUID';
COMMENT ON COLUMN slaj.att_eng_hyst.rv_guid IS '河流GUID';
COMMENT ON COLUMN slaj.att_eng_hyst.hyst_type IS '水电站类型';
COMMENT ON COLUMN slaj.att_eng_hyst.if_rhyst IS '是否为农村水电站';
COMMENT ON COLUMN slaj.att_eng_hyst.ins_cap IS '装机容量（kW）';
COMMENT ON COLUMN slaj.att_eng_hyst.dam_reg_code IS '大坝注册登记号';
COMMENT ON COLUMN slaj.att_eng_hyst.dam_iden_cate IS '大坝鉴定类别';
COMMENT ON COLUMN slaj.att_eng_hyst.dam_iden_org IS '大坝鉴定组织单位';
COMMENT ON COLUMN slaj.att_eng_hyst.dam_iden_date IS '大坝鉴定日期';
COMMENT ON COLUMN slaj.att_eng_hyst.eng_grad IS '工程等别';
COMMENT ON COLUMN slaj.att_eng_hyst.eng_scal IS '工程规模';
COMMENT ON COLUMN slaj.att_eng_hyst.note IS '备注';
COMMENT ON COLUMN slaj.att_eng_hyst.coll_time IS '采集时间';
COMMENT ON COLUMN slaj.att_eng_hyst.upd_time IS '更新时间';
COMMENT ON COLUMN slaj.att_eng_hyst.rec_pers IS '记录人员';
COMMENT ON COLUMN slaj.att_eng_hyst.tot_cap IS '总库容';
COMMENT ON COLUMN slaj.att_eng_hyst.dam_hig IS '坝高（m）';
COMMENT ON COLUMN slaj.att_eng_hyst.eng_rein_force_guid IS '被除险加固工程GUID';

-- ------------------------------------------------------------
-- 5. ATT_ENG_IRR - 灌区工程信息表
-- ------------------------------------------------------------
CREATE TABLE IF NOT EXISTS slaj.att_eng_irr (
    guid         CHAR(32) NOT NULL,
    p_guid       CHAR(32),
    eng_name     VARCHAR(100),
    eng_guid     CHAR(32) NOT NULL,
    impo_grad    CHAR(1),
    appr_budg    NUMERIC(12,4),
    start_date   TIMESTAMP,
    comp_date    TIMESTAMP,
    eng_stat     CHAR(1),
    org_guid     CHAR(32),
    oflp_code    CHAR(32),
    if_rein_force CHAR(1),
    proj_guid    CHAR(32),
    stat         CHAR(1) NOT NULL,
    irr_code     VARCHAR(20),
    cen_long     NUMERIC(11,8),
    cen_lat      NUMERIC(10,8),
    irr_loc      VARCHAR(256),
    ad_guid      CHAR(32),
    rv_guid      CHAR(32),
    eng_scal     CHAR(1),
    tot_irr_area NUMERIC(10),
    eff_irr_area NUMERIC(10),
    des_irr_area NUMERIC(10),
    chan_hign_leve CHAR(1),
    chan_num     NUMERIC(10),
    chan_len_tot NUMERIC(8,2),
    chan_des_flow NUMERIC(10,2),
    chsy_gate_num NUMERIC(10),
    chsy_aqu_num NUMERIC(10),
    chsy_drop_num NUMERIC(10),
    chsy_inv_siph_num NUMERIC(10),
    chsy_tun_num NUMERIC(10),
    chsy_cul_num NUMERIC(10),
    chsy_farm_bri_num NUMERIC(10),
    chsy_mea_num NUMERIC(10),
    chsy_dit_pust_st_num NUMERIC(10),
    note         VARCHAR(256),
    coll_time    TIMESTAMP NOT NULL,
    upd_time     TIMESTAMP,
    rec_pers     CHAR(32),
    eng_rein_force_guid CHAR(32),
    PRIMARY KEY (guid)
);

COMMENT ON TABLE slaj.att_eng_irr IS '灌区工程信息表';
COMMENT ON COLUMN slaj.att_eng_irr.guid IS '主键GUID';
COMMENT ON COLUMN slaj.att_eng_irr.p_guid IS '父级GUID';
COMMENT ON COLUMN slaj.att_eng_irr.eng_name IS '工程名称';
COMMENT ON COLUMN slaj.att_eng_irr.eng_guid IS '工程GUID';
COMMENT ON COLUMN slaj.att_eng_irr.impo_grad IS '重要程度';
COMMENT ON COLUMN slaj.att_eng_irr.appr_budg IS '批复投资（万元）';
COMMENT ON COLUMN slaj.att_eng_irr.start_date IS '开工日期';
COMMENT ON COLUMN slaj.att_eng_irr.comp_date IS '完工日期';
COMMENT ON COLUMN slaj.att_eng_irr.eng_stat IS '工程状态';
COMMENT ON COLUMN slaj.att_eng_irr.org_guid IS '机构GUID';
COMMENT ON COLUMN slaj.att_eng_irr.oflp_code IS '编码';
COMMENT ON COLUMN slaj.att_eng_irr.if_rein_force IS '除险加固状态';
COMMENT ON COLUMN slaj.att_eng_irr.proj_guid IS '项目GUID';
COMMENT ON COLUMN slaj.att_eng_irr.stat IS '状态';
COMMENT ON COLUMN slaj.att_eng_irr.irr_code IS '灌区编码';
COMMENT ON COLUMN slaj.att_eng_irr.cen_long IS '中心经度（°）';
COMMENT ON COLUMN slaj.att_eng_irr.cen_lat IS '中心纬度（°）';
COMMENT ON COLUMN slaj.att_eng_irr.irr_loc IS '灌区位置';
COMMENT ON COLUMN slaj.att_eng_irr.ad_guid IS '行政区划GUID';
COMMENT ON COLUMN slaj.att_eng_irr.rv_guid IS '河流GUID';
COMMENT ON COLUMN slaj.att_eng_irr.eng_scal IS '工程规模';
COMMENT ON COLUMN slaj.att_eng_irr.tot_irr_area IS '总灌溉面积（亩）';
COMMENT ON COLUMN slaj.att_eng_irr.eff_irr_area IS '有效灌溉面积（亩）';
COMMENT ON COLUMN slaj.att_eng_irr.des_irr_area IS '设计灌溉面积（亩）';
COMMENT ON COLUMN slaj.att_eng_irr.chan_hign_leve IS '渠道最高级别';
COMMENT ON COLUMN slaj.att_eng_irr.chan_num IS '渠道数量（条）';
COMMENT ON COLUMN slaj.att_eng_irr.chan_len_tot IS '渠道总长度（m）';
COMMENT ON COLUMN slaj.att_eng_irr.chan_des_flow IS '渠道设计流量（m3/s）';
COMMENT ON COLUMN slaj.att_eng_irr.chsy_gate_num IS '水闸数量（座）';
COMMENT ON COLUMN slaj.att_eng_irr.chsy_aqu_num IS '渡槽数量（座）';
COMMENT ON COLUMN slaj.att_eng_irr.chsy_drop_num IS '跌水数量（座）';
COMMENT ON COLUMN slaj.att_eng_irr.chsy_inv_siph_num IS '倒虹吸数量（座）';
COMMENT ON COLUMN slaj.att_eng_irr.chsy_tun_num IS '隧洞数量（座）';
COMMENT ON COLUMN slaj.att_eng_irr.chsy_cul_num IS '涵洞数量（座）';
COMMENT ON COLUMN slaj.att_eng_irr.chsy_farm_bri_num IS '农桥数量（座）';
COMMENT ON COLUMN slaj.att_eng_irr.chsy_mea_num IS '量水设施数量（座）';
COMMENT ON COLUMN slaj.att_eng_irr.chsy_dit_pust_st_num IS '渠系排水泵站数量（座）';
COMMENT ON COLUMN slaj.att_eng_irr.note IS '备注';
COMMENT ON COLUMN slaj.att_eng_irr.coll_time IS '采集时间';
COMMENT ON COLUMN slaj.att_eng_irr.upd_time IS '更新时间';
COMMENT ON COLUMN slaj.att_eng_irr.rec_pers IS '记录人员';
COMMENT ON COLUMN slaj.att_eng_irr.eng_rein_force_guid IS '被除险加固工程GUID';

-- ------------------------------------------------------------
-- 6. ATT_ENG_OTHE - 其他工程信息表
-- ------------------------------------------------------------
CREATE TABLE IF NOT EXISTS slaj.att_eng_othe (
    guid         CHAR(32) NOT NULL,
    p_guid       CHAR(32),
    eng_name     VARCHAR(100),
    eng_guid     CHAR(32) NOT NULL,
    impo_grad    CHAR(1),
    appr_budg    NUMERIC(12,4),
    start_date   TIMESTAMP,
    comp_date    TIMESTAMP,
    eng_stat     CHAR(1),
    org_guid     CHAR(32),
    oflp_code    CHAR(32),
    if_rein_force CHAR(1),
    proj_guid    CHAR(32),
    stat         CHAR(1) NOT NULL,
    obj_code     VARCHAR(20),
    cen_long     NUMERIC(11,8),
    cen_lat      NUMERIC(10,8),
    eng_loc      VARCHAR(256),
    ad_guid      CHAR(32),
    custom1      VARCHAR(100),
    custom2      VARCHAR(100),
    custom3      VARCHAR(100),
    custom4      VARCHAR(100),
    custom5      VARCHAR(100),
    custom6      VARCHAR(100),
    note         VARCHAR(256),
    coll_time    TIMESTAMP NOT NULL,
    upd_time     TIMESTAMP,
    rec_pers     CHAR(32),
    eng_rein_force_guid CHAR(32),
    PRIMARY KEY (guid)
);

COMMENT ON TABLE slaj.att_eng_othe IS '其他工程信息表';
COMMENT ON COLUMN slaj.att_eng_othe.guid IS '主键GUID';
COMMENT ON COLUMN slaj.att_eng_othe.p_guid IS '父级GUID';
COMMENT ON COLUMN slaj.att_eng_othe.eng_name IS '工程名称';
COMMENT ON COLUMN slaj.att_eng_othe.eng_guid IS '工程GUID';
COMMENT ON COLUMN slaj.att_eng_othe.impo_grad IS '重要程度';
COMMENT ON COLUMN slaj.att_eng_othe.appr_budg IS '批复投资（万元）';
COMMENT ON COLUMN slaj.att_eng_othe.start_date IS '开工日期';
COMMENT ON COLUMN slaj.att_eng_othe.comp_date IS '完工日期';
COMMENT ON COLUMN slaj.att_eng_othe.eng_stat IS '工程状态';
COMMENT ON COLUMN slaj.att_eng_othe.org_guid IS '机构GUID';
COMMENT ON COLUMN slaj.att_eng_othe.oflp_code IS '编码';
COMMENT ON COLUMN slaj.att_eng_othe.if_rein_force IS '除险加固状态';
COMMENT ON COLUMN slaj.att_eng_othe.proj_guid IS '项目GUID';
COMMENT ON COLUMN slaj.att_eng_othe.stat IS '状态';
COMMENT ON COLUMN slaj.att_eng_othe.obj_code IS '对象编码';
COMMENT ON COLUMN slaj.att_eng_othe.cen_long IS '中心经度（°）';
COMMENT ON COLUMN slaj.att_eng_othe.cen_lat IS '中心纬度（°）';
COMMENT ON COLUMN slaj.att_eng_othe.eng_loc IS '工程位置';
COMMENT ON COLUMN slaj.att_eng_othe.ad_guid IS '行政区划GUID';
COMMENT ON COLUMN slaj.att_eng_othe.custom1 IS '自定义字段1';
COMMENT ON COLUMN slaj.att_eng_othe.custom2 IS '自定义字段2';
COMMENT ON COLUMN slaj.att_eng_othe.custom3 IS '自定义字段3';
COMMENT ON COLUMN slaj.att_eng_othe.custom4 IS '自定义字段4';
COMMENT ON COLUMN slaj.att_eng_othe.custom5 IS '自定义字段5';
COMMENT ON COLUMN slaj.att_eng_othe.custom6 IS '自定义字段6';
COMMENT ON COLUMN slaj.att_eng_othe.note IS '备注';
COMMENT ON COLUMN slaj.att_eng_othe.coll_time IS '采集时间';
COMMENT ON COLUMN slaj.att_eng_othe.upd_time IS '更新时间';
COMMENT ON COLUMN slaj.att_eng_othe.rec_pers IS '记录人员';
COMMENT ON COLUMN slaj.att_eng_othe.eng_rein_force_guid IS '被除险加固工程GUID';

-- ------------------------------------------------------------
-- 7. ATT_ENG_PUST - 泵站工程信息表
-- ------------------------------------------------------------
CREATE TABLE IF NOT EXISTS slaj.att_eng_pust (
    guid         CHAR(32) NOT NULL,
    p_guid       CHAR(32),
    eng_name     VARCHAR(100),
    eng_guid     CHAR(32) NOT NULL,
    impo_grad    CHAR(1),
    appr_budg    NUMERIC(12,4),
    start_date   TIMESTAMP,
    comp_date    TIMESTAMP,
    eng_stat     CHAR(1),
    org_guid     CHAR(32),
    oflp_code    CHAR(32),
    if_rein_force CHAR(1),
    proj_guid    CHAR(32),
    stat         CHAR(1) NOT NULL,
    pust_code    VARCHAR(20),
    cen_long     NUMERIC(11,8),
    cen_lat      NUMERIC(10,8),
    pust_loc     VARCHAR(256),
    rv_guid      CHAR(32),
    lk_guid      CHAR(32),
    ad_guid      CHAR(32),
    pust_type    CHAR(1),
    des_head     NUMERIC(8,2),
    ins_flow     NUMERIC(15,4),
    des_flow     NUMERIC(15,4),
    pust_num     NUMERIC(2),
    ins_pow      NUMERIC(8,3),
    eng_grad     CHAR(1),
    eng_scal     CHAR(1),
    note         VARCHAR(256),
    coll_time    TIMESTAMP NOT NULL,
    upd_time     TIMESTAMP,
    rec_pers     CHAR(32),
    eng_rein_force_guid CHAR(32),
    PRIMARY KEY (guid)
);

COMMENT ON TABLE slaj.att_eng_pust IS '泵站工程信息表';
COMMENT ON COLUMN slaj.att_eng_pust.guid IS '主键GUID';
COMMENT ON COLUMN slaj.att_eng_pust.p_guid IS '父级GUID';
COMMENT ON COLUMN slaj.att_eng_pust.eng_name IS '工程名称';
COMMENT ON COLUMN slaj.att_eng_pust.eng_guid IS '工程GUID';
COMMENT ON COLUMN slaj.att_eng_pust.impo_grad IS '重要程度';
COMMENT ON COLUMN slaj.att_eng_pust.appr_budg IS '批复投资（万元）';
COMMENT ON COLUMN slaj.att_eng_pust.start_date IS '开工日期';
COMMENT ON COLUMN slaj.att_eng_pust.comp_date IS '完工日期';
COMMENT ON COLUMN slaj.att_eng_pust.eng_stat IS '工程状态';
COMMENT ON COLUMN slaj.att_eng_pust.org_guid IS '机构GUID';
COMMENT ON COLUMN slaj.att_eng_pust.oflp_code IS '编码';
COMMENT ON COLUMN slaj.att_eng_pust.if_rein_force IS '除险加固状态';
COMMENT ON COLUMN slaj.att_eng_pust.proj_guid IS '项目GUID';
COMMENT ON COLUMN slaj.att_eng_pust.stat IS '状态';
COMMENT ON COLUMN slaj.att_eng_pust.pust_code IS '泵站编码';
COMMENT ON COLUMN slaj.att_eng_pust.cen_long IS '中心经度（°）';
COMMENT ON COLUMN slaj.att_eng_pust.cen_lat IS '中心纬度（°）';
COMMENT ON COLUMN slaj.att_eng_pust.pust_loc IS '泵站位置';
COMMENT ON COLUMN slaj.att_eng_pust.rv_guid IS '河流GUID';
COMMENT ON COLUMN slaj.att_eng_pust.lk_guid IS '河流湖泊GUID';
COMMENT ON COLUMN slaj.att_eng_pust.ad_guid IS '行政区划GUID';
COMMENT ON COLUMN slaj.att_eng_pust.pust_type IS '泵站类型';
COMMENT ON COLUMN slaj.att_eng_pust.des_head IS '设计扬程（m）';
COMMENT ON COLUMN slaj.att_eng_pust.ins_flow IS '装机流量（m3/s）';
COMMENT ON COLUMN slaj.att_eng_pust.des_flow IS '设计流量（m3/s）';
COMMENT ON COLUMN slaj.att_eng_pust.pust_num IS '装机台数（台）';
COMMENT ON COLUMN slaj.att_eng_pust.ins_pow IS '装机功率（kW）';
COMMENT ON COLUMN slaj.att_eng_pust.eng_grad IS '工程等别';
COMMENT ON COLUMN slaj.att_eng_pust.eng_scal IS '工程规模';
COMMENT ON COLUMN slaj.att_eng_pust.note IS '备注';
COMMENT ON COLUMN slaj.att_eng_pust.coll_time IS '采集时间';
COMMENT ON COLUMN slaj.att_eng_pust.upd_time IS '更新时间';
COMMENT ON COLUMN slaj.att_eng_pust.rec_pers IS '记录人员';
COMMENT ON COLUMN slaj.att_eng_pust.eng_rein_force_guid IS '被除险加固工程GUID';

-- ------------------------------------------------------------
-- 8. ATT_ENG_RES - 水库工程信息表
-- ------------------------------------------------------------
CREATE TABLE IF NOT EXISTS slaj.att_eng_res (
    guid         CHAR(32) NOT NULL,
    p_guid       CHAR(32),
    eng_name     VARCHAR(100),
    eng_guid     CHAR(32) NOT NULL,
    impo_grad    CHAR(1),
    appr_budg    NUMERIC(12,4),
    start_date   TIMESTAMP,
    comp_date    TIMESTAMP,
    eng_stat     CHAR(1),
    org_guid     CHAR(32),
    oflp_code    CHAR(32),
    if_rein_force CHAR(1),
    proj_guid    CHAR(32),
    stat         CHAR(1) NOT NULL,
    res_code     VARCHAR(20),
    cen_long     NUMERIC(11,8),
    cen_lat      NUMERIC(10,8),
    res_loc      VARCHAR(256),
    rv_guid      CHAR(32),
    ad_guid      CHAR(32),
    eng_grad     CHAR(1),
    eng_scal     CHAR(1),
    dam_type_mat CHAR(1),
    dam_type_str CHAR(1),
    dam_size_hig NUMERIC(18,2),
    dam_size_len NUMERIC(18,2),
    dam_cre_elv  NUMERIC(18,2),
    des_fl_stand NUMERIC(5),
    fl_low_lim_lev      NUMERIC(14,2),
    fl_low_lim_lev_start TIMESTAMP,
    fl_low_lim_lev_end   TIMESTAMP,
    des_fl_stag  NUMERIC(14,2),
    main_fl_type CHAR(1),
    dead_lev     NUMERIC(14,2),
    tot_cap      NUMERIC(9,2),
    dead_cap     NUMERIC(9,2),
    flco_cap     NUMERIC(9,2),
    note         VARCHAR(256),
    coll_time    TIMESTAMP NOT NULL,
    upd_time     TIMESTAMP,
    rec_pers     CHAR(32),
    eng_rein_force_guid CHAR(32),
    PRIMARY KEY (guid)
);

COMMENT ON TABLE slaj.att_eng_res IS '水库工程信息表';
COMMENT ON COLUMN slaj.att_eng_res.guid IS '主键GUID';
COMMENT ON COLUMN slaj.att_eng_res.p_guid IS '父级GUID';
COMMENT ON COLUMN slaj.att_eng_res.eng_name IS '工程名称';
COMMENT ON COLUMN slaj.att_eng_res.eng_guid IS '工程GUID';
COMMENT ON COLUMN slaj.att_eng_res.impo_grad IS '重要程度';
COMMENT ON COLUMN slaj.att_eng_res.appr_budg IS '批复投资（万元）';
COMMENT ON COLUMN slaj.att_eng_res.start_date IS '开工日期';
COMMENT ON COLUMN slaj.att_eng_res.comp_date IS '完工日期';
COMMENT ON COLUMN slaj.att_eng_res.eng_stat IS '工程状态';
COMMENT ON COLUMN slaj.att_eng_res.org_guid IS '机构GUID';
COMMENT ON COLUMN slaj.att_eng_res.oflp_code IS '编码';
COMMENT ON COLUMN slaj.att_eng_res.if_rein_force IS '除险加固状态';
COMMENT ON COLUMN slaj.att_eng_res.proj_guid IS '项目GUID';
COMMENT ON COLUMN slaj.att_eng_res.stat IS '状态';
COMMENT ON COLUMN slaj.att_eng_res.res_code IS '水库编码';
COMMENT ON COLUMN slaj.att_eng_res.cen_long IS '中心经度（°）';
COMMENT ON COLUMN slaj.att_eng_res.cen_lat IS '中心纬度（°）';
COMMENT ON COLUMN slaj.att_eng_res.res_loc IS '水库位置';
COMMENT ON COLUMN slaj.att_eng_res.rv_guid IS '河流GUID';
COMMENT ON COLUMN slaj.att_eng_res.ad_guid IS '行政区划GUID';
COMMENT ON COLUMN slaj.att_eng_res.eng_grad IS '工程等别';
COMMENT ON COLUMN slaj.att_eng_res.eng_scal IS '工程规模';
COMMENT ON COLUMN slaj.att_eng_res.dam_type_mat IS '坝型（材料）';
COMMENT ON COLUMN slaj.att_eng_res.dam_type_str IS '坝型（结构）';
COMMENT ON COLUMN slaj.att_eng_res.dam_size_hig IS '坝高（m）';
COMMENT ON COLUMN slaj.att_eng_res.dam_size_len IS '坝长（m）';
COMMENT ON COLUMN slaj.att_eng_res.dam_cre_elv IS '坝顶高程（m）';
COMMENT ON COLUMN slaj.att_eng_res.des_fl_stand IS '设计防洪标准（年）';
COMMENT ON COLUMN slaj.att_eng_res.fl_low_lim_lev IS '汛限水位（m）';
COMMENT ON COLUMN slaj.att_eng_res.fl_low_lim_lev_start IS '汛限水位开始时间';
COMMENT ON COLUMN slaj.att_eng_res.fl_low_lim_lev_end IS '汛限水位截止时间';
COMMENT ON COLUMN slaj.att_eng_res.des_fl_stag IS '设计洪水位（m）';
COMMENT ON COLUMN slaj.att_eng_res.main_fl_type IS '主要洪水类型';
COMMENT ON COLUMN slaj.att_eng_res.dead_lev IS '死水位（m）';
COMMENT ON COLUMN slaj.att_eng_res.tot_cap IS '总库容';
COMMENT ON COLUMN slaj.att_eng_res.dead_cap IS '死库容';
COMMENT ON COLUMN slaj.att_eng_res.flco_cap IS '防洪库容';
COMMENT ON COLUMN slaj.att_eng_res.note IS '备注';
COMMENT ON COLUMN slaj.att_eng_res.coll_time IS '采集时间';
COMMENT ON COLUMN slaj.att_eng_res.upd_time IS '更新时间';
COMMENT ON COLUMN slaj.att_eng_res.rec_pers IS '记录人员';
COMMENT ON COLUMN slaj.att_eng_res.eng_rein_force_guid IS '被除险加固工程GUID';

-- ------------------------------------------------------------
-- 9. ATT_ENG_SD - 淤地坝工程信息表
-- ------------------------------------------------------------
CREATE TABLE IF NOT EXISTS slaj.att_eng_sd (
    guid         CHAR(32) NOT NULL,
    p_guid       CHAR(32),
    eng_name     VARCHAR(100),
    impo_grad    CHAR(1),
    appr_budg    NUMERIC(12,4),
    start_date   TIMESTAMP,
    comp_date    TIMESTAMP,
    eng_stat     CHAR(1),
    org_guid     CHAR(32),
    oflp_code    CHAR(32),
    if_rein_force CHAR(1),
    proj_guid    CHAR(32),
    stat         CHAR(1) NOT NULL,
    sd_code      VARCHAR(20),
    eng_guid     CHAR(32) NOT NULL,
    cen_long     NUMERIC(11,8),
    cen_lat      NUMERIC(10,8),
    sd_loc       VARCHAR(256),
    ad_guid      CHAR(32),
    con_area     NUMERIC(9,2),
    tot_cap      NUMERIC(9,2),
    warp_cap     NUMERIC(9,2),
    sd_size_len  NUMERIC(7,2),
    sd_size_hig  NUMERIC(7,3),
    eng_scal     CHAR(1),
    des_fl_sta   NUMERIC(5),
    note         VARCHAR(256),
    coll_time    TIMESTAMP NOT NULL,
    upd_time     TIMESTAMP,
    rec_pers     CHAR(32),
    eng_rein_force_guid CHAR(32),
    PRIMARY KEY (guid)
);

COMMENT ON TABLE slaj.att_eng_sd IS '淤地坝工程信息表';
COMMENT ON COLUMN slaj.att_eng_sd.guid IS '主键GUID';
COMMENT ON COLUMN slaj.att_eng_sd.p_guid IS '父级GUID';
COMMENT ON COLUMN slaj.att_eng_sd.eng_name IS '工程名称';
COMMENT ON COLUMN slaj.att_eng_sd.impo_grad IS '重要程度';
COMMENT ON COLUMN slaj.att_eng_sd.appr_budg IS '批复投资（万元）';
COMMENT ON COLUMN slaj.att_eng_sd.start_date IS '开工日期';
COMMENT ON COLUMN slaj.att_eng_sd.comp_date IS '完工日期';
COMMENT ON COLUMN slaj.att_eng_sd.eng_stat IS '工程状态';
COMMENT ON COLUMN slaj.att_eng_sd.org_guid IS '机构GUID';
COMMENT ON COLUMN slaj.att_eng_sd.oflp_code IS '编码';
COMMENT ON COLUMN slaj.att_eng_sd.if_rein_force IS '除险加固状态';
COMMENT ON COLUMN slaj.att_eng_sd.proj_guid IS '项目GUID';
COMMENT ON COLUMN slaj.att_eng_sd.stat IS '状态';
COMMENT ON COLUMN slaj.att_eng_sd.sd_code IS '淤地坝编码';
COMMENT ON COLUMN slaj.att_eng_sd.eng_guid IS '工程GUID';
COMMENT ON COLUMN slaj.att_eng_sd.cen_long IS '中心经度（°）';
COMMENT ON COLUMN slaj.att_eng_sd.cen_lat IS '中心纬度（°）';
COMMENT ON COLUMN slaj.att_eng_sd.sd_loc IS '淤地坝位置';
COMMENT ON COLUMN slaj.att_eng_sd.ad_guid IS '行政区划GUID';
COMMENT ON COLUMN slaj.att_eng_sd.con_area IS '控制面积（km2）';
COMMENT ON COLUMN slaj.att_eng_sd.tot_cap IS '总库容（104m3）';
COMMENT ON COLUMN slaj.att_eng_sd.warp_cap IS '淤积库容（104m3）';
COMMENT ON COLUMN slaj.att_eng_sd.sd_size_len IS '坝长（m）';
COMMENT ON COLUMN slaj.att_eng_sd.sd_size_hig IS '坝高（m）';
COMMENT ON COLUMN slaj.att_eng_sd.eng_scal IS '工程规模';
COMMENT ON COLUMN slaj.att_eng_sd.des_fl_sta IS '设计防洪标准（年）';
COMMENT ON COLUMN slaj.att_eng_sd.note IS '备注';
COMMENT ON COLUMN slaj.att_eng_sd.coll_time IS '采集时间';
COMMENT ON COLUMN slaj.att_eng_sd.upd_time IS '更新时间';
COMMENT ON COLUMN slaj.att_eng_sd.rec_pers IS '记录人员';
COMMENT ON COLUMN slaj.att_eng_sd.eng_rein_force_guid IS '被除险加固工程GUID';

-- ------------------------------------------------------------
-- 10. ATT_ENG_WADI - 引调水工程信息表
-- ------------------------------------------------------------
CREATE TABLE IF NOT EXISTS slaj.att_eng_wadi (
    guid         CHAR(32) NOT NULL,
    p_guid       CHAR(32),
    eng_name     VARCHAR(100),
    eng_guid     CHAR(32) NOT NULL,
    impo_grad    CHAR(1),
    appr_budg    NUMERIC(12,4),
    start_date   TIMESTAMP,
    comp_date    TIMESTAMP,
    eng_stat     CHAR(1),
    org_guid     CHAR(32),
    oflp_code    CHAR(32),
    if_rein_force CHAR(1),
    proj_guid    CHAR(32),
    stat         CHAR(1) NOT NULL,
    wadi_code    VARCHAR(20),
    start_long   NUMERIC(11,8),
    start_lat    NUMERIC(10,8),
    end_long     NUMERIC(11,8),
    end_lat      NUMERIC(10,8),
    start_loc    VARCHAR(256),
    end_loc      VARCHAR(256),
    firs_poin_ad_guid CHAR(32),
    end_ad_guid  CHAR(32),
    rv_guid      CHAR(32),
    eng_grad     CHAR(1),
    eng_scal     CHAR(1),
    line_tot_len NUMERIC(8,2),
    des_pump_dis NUMERIC(16,2),
    des_pump_vol NUMERIC(18,2),
    note         VARCHAR(256),
    coll_time    TIMESTAMP NOT NULL,
    upd_time     TIMESTAMP,
    rec_pers     CHAR(32),
    eng_rein_force_guid CHAR(32),
    PRIMARY KEY (guid)
);

COMMENT ON TABLE slaj.att_eng_wadi IS '引调水工程信息表';
COMMENT ON COLUMN slaj.att_eng_wadi.guid IS '主键GUID';
COMMENT ON COLUMN slaj.att_eng_wadi.p_guid IS '父级GUID';
COMMENT ON COLUMN slaj.att_eng_wadi.eng_name IS '工程名称';
COMMENT ON COLUMN slaj.att_eng_wadi.eng_guid IS '工程GUID';
COMMENT ON COLUMN slaj.att_eng_wadi.impo_grad IS '重要程度';
COMMENT ON COLUMN slaj.att_eng_wadi.appr_budg IS '批复投资（万元）';
COMMENT ON COLUMN slaj.att_eng_wadi.start_date IS '开工日期';
COMMENT ON COLUMN slaj.att_eng_wadi.comp_date IS '完工日期';
COMMENT ON COLUMN slaj.att_eng_wadi.eng_stat IS '工程状态';
COMMENT ON COLUMN slaj.att_eng_wadi.org_guid IS '机构GUID';
COMMENT ON COLUMN slaj.att_eng_wadi.oflp_code IS '编码';
COMMENT ON COLUMN slaj.att_eng_wadi.if_rein_force IS '除险加固状态';
COMMENT ON COLUMN slaj.att_eng_wadi.proj_guid IS '项目GUID';
COMMENT ON COLUMN slaj.att_eng_wadi.stat IS '状态';
COMMENT ON COLUMN slaj.att_eng_wadi.wadi_code IS '引调水编码';
COMMENT ON COLUMN slaj.att_eng_wadi.start_long IS '起点经度（°）';
COMMENT ON COLUMN slaj.att_eng_wadi.start_lat IS '起点纬度（°）';
COMMENT ON COLUMN slaj.att_eng_wadi.end_long IS '终点经度（°）';
COMMENT ON COLUMN slaj.att_eng_wadi.end_lat IS '终点纬度（°）';
COMMENT ON COLUMN slaj.att_eng_wadi.start_loc IS '起点位置';
COMMENT ON COLUMN slaj.att_eng_wadi.end_loc IS '终点位置';
COMMENT ON COLUMN slaj.att_eng_wadi.firs_poin_ad_guid IS '首点行政区划GUID';
COMMENT ON COLUMN slaj.att_eng_wadi.end_ad_guid IS '末点行政区划GUID';
COMMENT ON COLUMN slaj.att_eng_wadi.rv_guid IS '河流GUID';
COMMENT ON COLUMN slaj.att_eng_wadi.eng_grad IS '工程等别';
COMMENT ON COLUMN slaj.att_eng_wadi.eng_scal IS '工程规模';
COMMENT ON COLUMN slaj.att_eng_wadi.line_tot_len IS '管线总长度（km）';
COMMENT ON COLUMN slaj.att_eng_wadi.des_pump_dis IS '设计泵站流量（104m3）';
COMMENT ON COLUMN slaj.att_eng_wadi.des_pump_vol IS '设计泵站扬程（m3/s）';
COMMENT ON COLUMN slaj.att_eng_wadi.note IS '备注';
COMMENT ON COLUMN slaj.att_eng_wadi.coll_time IS '采集时间';
COMMENT ON COLUMN slaj.att_eng_wadi.upd_time IS '更新时间';
COMMENT ON COLUMN slaj.att_eng_wadi.rec_pers IS '记录人员';
COMMENT ON COLUMN slaj.att_eng_wadi.eng_rein_force_guid IS '被除险加固工程GUID';

-- ------------------------------------------------------------
-- 11. ATT_ENG_WAGA - 水闸工程信息表
-- ------------------------------------------------------------
CREATE TABLE IF NOT EXISTS slaj.att_eng_waga (
    guid         CHAR(32) NOT NULL,
    p_guid       CHAR(32),
    eng_name     VARCHAR(100),
    eng_guid     CHAR(32) NOT NULL,
    impo_grad    CHAR(1),
    appr_budg    NUMERIC(12,4),
    start_date   TIMESTAMP,
    comp_date    TIMESTAMP,
    eng_stat     CHAR(1),
    org_guid     CHAR(32),
    oflp_code    CHAR(32),
    if_rein_force CHAR(1),
    proj_guid    CHAR(32),
    stat         CHAR(1) NOT NULL,
    waga_code    VARCHAR(20),
    cen_long     NUMERIC(11,8),
    cen_lat      NUMERIC(10,8),
    waga_loc     VARCHAR(256),
    ad_guid      CHAR(32),
    rv_guid      CHAR(32),
    lk_guid      CHAR(32),
    waga_type    CHAR(1),
    gaor_num     NUMERIC(2),
    eng_grad     CHAR(1),
    eng_scal     CHAR(1),
    lock_disc    NUMERIC(8,2),
    ener_diss    CHAR(1),
    des_fl_sta   NUMERIC(5),
    coll_time    TIMESTAMP NOT NULL,
    upd_time     TIMESTAMP,
    rec_pers     CHAR(32),
    note         VARCHAR(256),
    eng_rein_force_guid CHAR(32),
    PRIMARY KEY (guid)
);

COMMENT ON TABLE slaj.att_eng_waga IS '水闸工程信息表';
COMMENT ON COLUMN slaj.att_eng_waga.guid IS '主键GUID';
COMMENT ON COLUMN slaj.att_eng_waga.p_guid IS '父级GUID';
COMMENT ON COLUMN slaj.att_eng_waga.eng_name IS '工程名称';
COMMENT ON COLUMN slaj.att_eng_waga.eng_guid IS '工程GUID';
COMMENT ON COLUMN slaj.att_eng_waga.impo_grad IS '重要程度';
COMMENT ON COLUMN slaj.att_eng_waga.appr_budg IS '批复投资（万元）';
COMMENT ON COLUMN slaj.att_eng_waga.start_date IS '开工日期';
COMMENT ON COLUMN slaj.att_eng_waga.comp_date IS '完工日期';
COMMENT ON COLUMN slaj.att_eng_waga.eng_stat IS '工程状态';
COMMENT ON COLUMN slaj.att_eng_waga.org_guid IS '机构GUID';
COMMENT ON COLUMN slaj.att_eng_waga.oflp_code IS '编码';
COMMENT ON COLUMN slaj.att_eng_waga.if_rein_force IS '除险加固状态';
COMMENT ON COLUMN slaj.att_eng_waga.proj_guid IS '项目GUID';
COMMENT ON COLUMN slaj.att_eng_waga.stat IS '状态';
COMMENT ON COLUMN slaj.att_eng_waga.waga_code IS '水闸编码';
COMMENT ON COLUMN slaj.att_eng_waga.cen_long IS '中心经度（°）';
COMMENT ON COLUMN slaj.att_eng_waga.cen_lat IS '中心纬度（°）';
COMMENT ON COLUMN slaj.att_eng_waga.waga_loc IS '水闸位置';
COMMENT ON COLUMN slaj.att_eng_waga.ad_guid IS '行政区划GUID';
COMMENT ON COLUMN slaj.att_eng_waga.rv_guid IS '河流GUID';
COMMENT ON COLUMN slaj.att_eng_waga.lk_guid IS '河流湖泊GUID';
COMMENT ON COLUMN slaj.att_eng_waga.waga_type IS '水闸类型';
COMMENT ON COLUMN slaj.att_eng_waga.gaor_num IS '闸孔数量（孔）';
COMMENT ON COLUMN slaj.att_eng_waga.eng_grad IS '工程等别';
COMMENT ON COLUMN slaj.att_eng_waga.eng_scal IS '工程规模';
COMMENT ON COLUMN slaj.att_eng_waga.lock_disc IS '闸孔净宽（m3/s）';
COMMENT ON COLUMN slaj.att_eng_waga.ener_diss IS '消能方式';
COMMENT ON COLUMN slaj.att_eng_waga.des_fl_sta IS '设计防洪标准（年）';
COMMENT ON COLUMN slaj.att_eng_waga.coll_time IS '采集时间';
COMMENT ON COLUMN slaj.att_eng_waga.upd_time IS '更新时间';
COMMENT ON COLUMN slaj.att_eng_waga.rec_pers IS '记录人员';
COMMENT ON COLUMN slaj.att_eng_waga.note IS '备注';
COMMENT ON COLUMN slaj.att_eng_waga.eng_rein_force_guid IS '被除险加固工程GUID';
