From 52eeb5e914c367f04e7f42ae2a7c0d83e527087f Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Mon, 01 Apr 2024 16:48:25 +0800
Subject: [PATCH] 初始化挡水建筑物,正常溢洪道,泄洪洞,非常溢洪道,输水建筑物,电站

---
 skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/mapper/TbAttResBaseMapper.xml |  376 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 375 insertions(+), 1 deletions(-)

diff --git a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/mapper/TbAttResBaseMapper.xml b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/mapper/TbAttResBaseMapper.xml
index f877493..8839218 100644
--- a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/mapper/TbAttResBaseMapper.xml
+++ b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/mapper/TbAttResBaseMapper.xml
@@ -222,6 +222,7 @@
     <sql id="getAttResStagChar">
         SELECT
             tarb."guid",
+            tarb."guid",
             arsc."con_area",
             NULL,
             arsc."moyear_fl_age",
@@ -280,7 +281,12 @@
                 LEFT JOIN SJZT_MD."att_res_flse_lim" beforeArfl on beforeArfl."res_guid" = tarb."guid" and beforeArfl."flood_season_name" = '前汛期'
                 LEFT JOIN SJZT_MD."att_res_flse_lim" midArfl on midArfl."res_guid" = tarb."guid" and midArfl."flood_season_name" = '中汛期'
                 LEFT JOIN SJZT_MD."att_res_flse_lim" afterArfl on afterArfl."res_guid" = tarb."guid" and afterArfl."flood_season_name" = '后汛期'
-        WHERE tarb."final_state" = -1
+        WHERE
+            tarb."final_state" = -1
+          and arsc."res_guid" is not null
+        and beforeArfl."res_guid" is not null
+        and midArfl."res_guid" is not null
+        and afterArfl."res_guid" is not null
     </sql>
 
 
@@ -348,24 +354,392 @@
 
     </insert>
 
+    <sql id="getAttResWaterBlock">
+        SELECT
+            arwb."dam_width",
+            '否',
+            NULL,
+            '其他',
+            '其他',
+            arwb."guid",
+            '',
+            CASE when arwb."sub_dam_num" = 0 THEN 1 ELSE arwb."sub_dam_num" +1 END,
+            arwb."res_guid",
+            case
+                when arwb."dam_type" = '常态混凝土实体重力坝' THEN 'DAA001'
+                when arwb."dam_type" = '常态混凝土宽缝重力坝' THEN 'DAA002'
+                when arwb."dam_type" = '常态混凝土空腹重力坝' THEN 'DAA003'
+                when arwb."dam_type" = '碾压混凝土重力坝' THEN 'DAA004'
+                when arwb."dam_type" = '混凝土重力坝' THEN 'DAA0'
+
+                when arwb."dam_type" = '常态混凝土单曲拱坝' THEN 'DAB001'
+                when arwb."dam_type" = '常态混凝土双曲拱坝' THEN 'DAB002'
+                when arwb."dam_type" = '常态混凝土变曲拱坝' THEN 'DAB003'
+                when arwb."dam_type" = '碾压混凝土单曲拱坝' THEN 'DAB004'
+                when arwb."dam_type" = '碾压混凝土双曲拱坝' THEN 'DAB005'
+                when arwb."dam_type" = '碾压混凝土变曲拱坝' THEN 'DAB006'
+                when arwb."dam_type" = '混凝土拱坝' THEN 'DAB0'
+
+                when arwb."dam_type" = '平板坝' THEN 'DAC001'
+                when arwb."dam_type" = '大头坝' THEN 'DAC002'
+                when arwb."dam_type" = '连拱坝' THEN 'DAC003'
+                when arwb."dam_type" = '混凝土支墩坝' THEN 'DAC0'
+                when arwb."dam_type" = '混凝土坝' THEN 'DA'
+
+                when arwb."dam_type" = '均质土坝' THEN 'DBA001'
+                when arwb."dam_type" = '粘土心墙坝' THEN 'DBA002'
+                when arwb."dam_type" = '沥青心墙坝' THEN 'DBA003'
+                when arwb."dam_type" = '土工膜心墙坝' THEN 'DBA004'
+                when arwb."dam_type" = '混凝土心墙坝' THEN 'DBA005'
+                when arwb."dam_type" = '粘土斜墙坝' THEN 'DBA006'
+                when arwb."dam_type" = '沥青斜墙坝' THEN 'DBA007'
+                when arwb."dam_type" = '土工膜斜墙坝' THEN 'DBA008'
+                when arwb."dam_type" = '土石混合坝' THEN 'DBA009'
+                when arwb."dam_type" = '碾压式土石坝' THEN 'DBA0'
+
+                when arwb."dam_type" = '面板堆石坝' THEN 'DBB0'
+                when arwb."dam_type" = '水力冲填坝' THEN 'DBC0'
+                when arwb."dam_type" = '定向爆破坝' THEN 'DBD0'
+                when arwb."dam_type" = '土石坝' THEN 'DB'
+
+                when arwb."dam_type" = '砌石重力坝' THEN 'DCA0'
+                when arwb."dam_type" = '砌石拱坝' THEN 'DCB0'
+                when arwb."dam_type" = '砌石坝' THEN 'DC'
+                when arwb."dam_type" = '其他' THEN 'DD'
+                END,
+            '',
+            arwb."tb_dam_top_elevation",
+            arwb."dam_height",
+            arwb."dam_top_length",
+            '其他',
+            NULL,
+            '无',
+            arwb."dam_body_type",
+            arwb."sub_dam_num",
+            arwb."sub_dam_total_length",
+            arwb."sub_dam_max_height",
+            NULL,
+            '0' as "check_state",
+            NOW() as "create_time"
+
+        FROM SJZT_MD."tb_att_res_base" tarb
+                 LEFT JOIN SJZT_MD."att_res_water_block" arwb on arwb."res_guid" = tarb."guid"
+        WHERE tarb."final_state" = -1 and arwb."res_guid" is not null
+    </sql>
 
 
 
+    <insert id="initTbAttResWaterBlock">
+        INSERT INTO SJZT_MD."tb_att_res_water_block"
+        (
+            "dam_width",
+            "is_traffic",
+            "wave_wall_top_elevation",
+            "up_dam_protect_type",
+            "down_dam_protect_type",
+            "guid",
+
+            "name",
+            "num",
+            "res_guid",
+            "dam_type",
+            "dam_main_foundation",
+
+            "dam_top_elevation",
+            "dam_height",
+            "dam_top_length",
+            "dam_main_body_type",
+            "dam_main_body_top_elevation",
+
+            "dam_main_drain_type",
+            "dam_body_type",
+            "sub_dam_num",
+            "sub_dam_tot_length",
+            "sub_dam_max_height",
+
+            "sub_dam_top_width",
+            "check_state",
+            "create_time"
+        )
+        <include refid="getAttResWaterBlock"></include>
+    </insert>
 
 
 
+    <sql id="getAttResRsbNorspi">
+        SELECT
+            arrn."guid",
+            '',
+            1,
+            arrn."res_guid",
+            arrn."spillway_type",
+            NULL,
+            NULL,
+            arrn."tb_weir_top_elevation",
+            arrn."weir_top_width",
+            arrn."working_gate_type",
+            NULL,
+            NULL,
+            NULL,
+            NULL,
+            arrn."oc_type",
+            NULL,
+            arrn."dis_energy_type",
+            '0' as "check_state",
+            NOW() as "create_time"
+
+        FROM SJZT_MD."tb_att_res_base" tarb
+                 LEFT JOIN SJZT_MD."att_res_rsb_norspi" arrn on arrn."res_guid" = tarb."guid"
+        WHERE tarb."final_state" = -1 and arrn."res_guid" is not null
+    </sql>
+
+
+    <insert id="initTbAttResRsbNorspi">
+        INSERT INTO SJZT_MD."tb_att_res_rsb_norspi"
+        (
+            "guid",
+            "name",
+            "num",
+            "res_guid",
+            "spillway_type",
+            "is_loc_dam_body",
+
+            "is_gate",
+            "weir_top_elevation",
+            "weir_top_width",
+            "working_gate_type",
+            "gate_num",
+
+            "gate_length",
+            "gate_wide",
+            "checking_flood_discharge",
+            "oc_type",
+            "oc_power",
+
+            "dis_energy_type",
+            "check_state",
+            "create_time"
+        )
+<include refid="getAttResRsbNorspi"></include>
+    </insert>
 
 
 
+    <sql id="getAttResRsbSpillway">
+        SELECT
+            arrs."guid",
+            arrs."build_name",
+            numTmp.num,
+            arrs."res_guid",
+            case
+                when arrs."spillway_type" = '城门洞型' then '城门洞型'
+                when arrs."spillway_type" = '马蹄形' then '马蹄形'
+                when arrs."spillway_type" = '圆形' then '圆形'
+                when arrs."spillway_type" = '矩形' then '矩形'
+                else '其他,'
+                end,
+            NULL,
+            arrs."threshold_elevation",
+            NULL,
+            arrs."hole_num",
+            NULL,
+            NULL,
+            arrs."checking_flood_discharge",
+            arrs."working_gate_type",
+            arrs."oc_type",
+            NULL,
+            '0' as "check_state",
+            NOW() as "create_time"
+        FROM SJZT_MD."tb_att_res_base" tarb
+                 LEFT JOIN SJZT_MD."att_res_rsb_spillway" arrs on arrs."res_guid" = tarb."guid"
+
+                 LEFT JOIN (
+            SELECT COUNT(*) NUM ,"res_guid" FROM SJZT_MD."att_res_rsb_spillway" group by "res_guid"
+        )numTmp on numTmp."res_guid" = tarb."guid"
+        WHERE tarb."final_state" = -1 and arrs."res_guid" is not null
+    </sql>
+
+
+    <insert id="initTbAttResRsbSpillway">
+        INSERT INTO SJZT_MD."tb_att_res_rsb_spillway"
+        (
+            "guid",
+            "name",
+            "num",
+            "res_guid",
+            "spillway_type",
+            "cove_length",
+
+            "threshold_elevation",
+            "export_elevation",
+            "section_num",
+            "section_length",
+            "section_wide",
+
+            "check_fl_dis_charge",
+            "working_gate_type",
+            "oc_type",
+            "oc_power",
+
+            "check_state",
+            "create_time"
+        )
+    <include refid="getAttResRsbSpillway"></include>
+    </insert>
 
 
 
+    <sql id="getTbAttResRsbVerspi">
+        SELECT
+            basic."enable_standards",
+            basic."checking_flood_discharge",
+            basic."guid",
+            basic."build_name",
+            numTmp.num,
+            basic."res_guid",
+            basic."spillway_type",
+            basic."weir_top_elevation",
+
+            '0' as "check_state",
+            NOW() as "create_time"
+
+
+        FROM SJZT_MD."tb_att_res_base" tarb
+                 LEFT JOIN SJZT_MD."att_res_rsb_verspi" basic on basic."res_guid" = tarb."guid"
+
+                 LEFT JOIN (
+            SELECT COUNT(*) NUM ,"res_guid" FROM SJZT_MD."att_res_rsb_verspi" group by "res_guid"
+        )numTmp on numTmp."res_guid" = tarb."guid"
+        WHERE tarb."final_state" = -1 and basic."res_guid" is not null
+    </sql>
+
+    <insert id="initTbAttResRsbVerspi">
+        INSERT INTO SJZT_MD."tb_att_res_rsb_verspi"
+        (
+            "enable_standards",
+            "checking_flood_discharge",
+            "guid",
+            "name",
+            "num",
+            "res_guid",
+            "spillway_type",
+            "weir_top_width",
+
+            "check_state",
+            "create_time"
+        )
+        <include refid="getTbAttResRsbVerspi"></include>
+
+    </insert>
+
+    <sql id="getTbAttResWaterDelivery">
+        SELECT
+            basic."guid",
+            '',
+            numTmp.num,
+            basic."res_guid",
+            CASE WHEN basic."aqueduct_type" != 9 then basic."aqueduct_type" else '9,' end,
+
+            basic."aqueduct_length",
+            NULL,
+            NULL,
+            NULL,
+            NULL,
+
+            basic."design_flow",
+            NULL,
+            NULL,
+            NULL,
+            NULL,
+
+            '0' as "check_state",
+            NOW() as "create_time"
+
+
+        FROM SJZT_MD."tb_att_res_base" tarb
+                 LEFT JOIN SJZT_MD."att_res_water_delivery" basic on basic."res_guid" = tarb."guid"
+
+                 LEFT JOIN (
+            SELECT COUNT(*) NUM ,"res_guid" FROM SJZT_MD."att_res_water_delivery" group by "res_guid"
+        )numTmp on numTmp."res_guid" = tarb."guid"
+        WHERE tarb."final_state" = -1 and basic."res_guid" is not null
+    </sql>
 
 
 
+    <insert id="initTbAttResWaterDelivery">
+
+        INSERT INTO SJZT_MD."tb_att_res_water_delivery"
+        (
+            "guid",
+            "name",
+            "num",
+            "res_guid",
+            "aqueduct_type",
+
+            "aqueduct_length",
+            "threshold_elevation",
+            "export_elevation",
+            "section_wide",
+            "section_high",
+
+            "design_flow",
+            "working_gate_type",
+            "oc_type",
+            "oc_power",
+            "is_across_dam_body",
+
+            "check_state",
+            "create_time"
+        )
+        <include refid="getTbAttResWaterDelivery"></include>
+
+    </insert>
+
+
+    <sql id="getTbAttResPowerStation">
+        SELECT
+            basic."id",
+            '',
+            numTmp.num,
+            basic."rs_id",
+            basic."plant_layout_type",
+
+            basic."installed_capacity",
+            NULL,
+
+
+            '0' as "check_state",
+            NOW() as "create_time"
+
+
+        FROM SJZT_MD."tb_att_res_base" tarb
+                 LEFT JOIN SJZT_ODS."yg_rsvr_power_st" basic on basic."rs_id" = tarb."guid"
+
+                 LEFT JOIN (
+            SELECT COUNT(*) NUM ,"rs_id" FROM SJZT_ODS."yg_rsvr_power_st" group by "rs_id"
+        )numTmp on numTmp."rs_id" = tarb."guid"
+        WHERE tarb."final_state" = -1 and basic."rs_id" is not null
+    </sql>
 
 
 
+    <insert id="initTbAttResPowerStation">
+        INSERT INTO SJZT_MD."tb_att_res_power_station"
+        (
+            "guid",
+            "name",
+            "num",
+            "res_guid",
+            "plant_layout_type",
+
+            "installed_capacity",
+            "year_avg_hour",
+            "check_state",
+            "create_time"
+        )
+        <include refid="getTbAttResPowerStation"></include>
+    </insert>
 
 
 </mapper>

--
Gitblit v1.9.3