From 10234ae97b1031e0d4bf816efb5eaaee7e52dff7 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Tue, 23 Jan 2024 11:34:12 +0800
Subject: [PATCH] 大坝业务一张图接口逻辑修改

---
 skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/damSecurity/mapper/DamSecurityMapper.xml |  641 +++++++++++++++++++++++++++-------------------------------
 1 files changed, 297 insertions(+), 344 deletions(-)

diff --git a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/damSecurity/mapper/DamSecurityMapper.xml b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/damSecurity/mapper/DamSecurityMapper.xml
index bd2582a..809085d 100644
--- a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/damSecurity/mapper/DamSecurityMapper.xml
+++ b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/damSecurity/mapper/DamSecurityMapper.xml
@@ -1488,24 +1488,21 @@
         FROM(
 
 
-        SELECT "res_cd", COUNT(*) syStation
+        SELECT
+        distinct (dri."res_cd")
         FROM
-        (
-        SELECT b."guid" as "res_cd",'sy' as "sys_resource"
-        FROM sjzt_ods."dsm_spg_spprmp" a
-        LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-        WHERE b."guid" is not null
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        sjzt_dw."dim_res_info_a" dri
+        LEFT JOIN sjzt_ods."dsm_spg_spprmp" dss ON dri."oth_reg_cd" = dss."rscd"
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        WHERE 1=1
+
+        where dss."rscd" is not null
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
 
 
         ) resList
@@ -1557,24 +1554,21 @@
         FROM(
 
 
-        SELECT "res_cd", COUNT(*) syStation
+        SELECT
+        distinct (dri."res_cd")
         FROM
-        (
-        SELECT b."guid" as "res_cd",'sy' as "sys_resource"
-        FROM sjzt_ods."dsm_spg_spprmp" a
-        LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-        WHERE b."guid" is not null
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        sjzt_dw."dim_res_info_a" dri
+        LEFT JOIN sjzt_ods."dsm_spg_spprmp" dss ON dri."oth_reg_cd" = dss."rscd"
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        WHERE 1=1
+
+        where dss."rscd" is not null
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
 
 
         ) resList
@@ -1625,24 +1619,21 @@
         FROM(
 
 
-        SELECT "res_cd", COUNT(*) syStation
+        SELECT
+        distinct (dri."res_cd")
         FROM
-        (
-        SELECT b."guid" as "res_cd",'sy' as "sys_resource"
-        FROM sjzt_ods."dsm_spg_spprmp" a
-        LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-        WHERE b."guid" is not null
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        sjzt_dw."dim_res_info_a" dri
+        LEFT JOIN sjzt_ods."dsm_spg_spprmp" dss ON dri."oth_reg_cd" = dss."rscd"
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        WHERE 1=1
+
+        where dss."rscd" is not null
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
 
 
         ) resList
@@ -1693,24 +1684,21 @@
     FROM(
 
 
-    SELECT "res_cd", COUNT(*) syStation
-    FROM
-    (
-    SELECT b."guid" as "res_cd",'sy' as "sys_resource"
-    FROM sjzt_ods."dsm_spg_spprmp" a
-    LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-    WHERE b."guid" is not null
-    ) temp
-    LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
-    LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
-    LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
-    LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
-    LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-    WHERE 1=1
-    <if test=" dam.adCode!= null and dam.adCode !='' ">
-        AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
-    </if>
-    GROUP BY "res_cd"
+        SELECT
+        distinct (dri."res_cd")
+        FROM
+        sjzt_dw."dim_res_info_a" dri
+        LEFT JOIN sjzt_ods."dsm_spg_spprmp" dss ON dri."oth_reg_cd" = dss."rscd"
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
+        LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
+        LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
+        LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
+        LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
+
+        where dss."rscd" is not null
+        <if test=" dam.adCode!= null and dam.adCode !='' ">
+            AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
+        </if>
 
 
     ) resList
@@ -1763,31 +1751,18 @@
             FROM(
 
 
-            SELECT
-            "res_cd",
-            COUNT(*) slStation
-            FROM (
-            SELECT
-            b."guid" as "res_cd",
-            'sl' as "sys_resource"
-            FROM sjzt_ods."dsm_spg_spqn" a
-            LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-            WHERE
-            b."guid" IS NOT NULL
-            AND a."mstm" &gt;=now()-30 and a."mstm"&lt;= now()
-
-
-            group by b."guid"
-            ) temp
-            LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+            SELECT distinct(dri."res_cd")
+            from sjzt_dw."dim_res_info_a" dri
+            left join sjzt_ods."dsm_spg_spqnmp" dss on trim(dss."rscd") = dri."oth_reg_cd"
+            LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
             LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
             LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
             LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
             LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
+            where dss."rscd" is not null
             <if test=" dam.adCode!= null and dam.adCode !='' ">
                 AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
             </if>
-            GROUP BY "res_cd"
 
 
             ) resList
@@ -1839,32 +1814,18 @@
         FROM(
 
 
-        SELECT
-        "res_cd",
-        COUNT(*) slStation
-        FROM (
-        SELECT
-        b."guid" as "res_cd",
-        'sl' as "sys_resource"
-        FROM sjzt_ods."dsm_spg_spqn" a
-        LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-        WHERE
-        b."guid" IS NOT NULL
-        AND a."mstm" &gt;=now()-30 and a."mstm"&lt;= now()
-
-
-        group by b."guid"
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        SELECT distinct(dri."res_cd")
+        from sjzt_dw."dim_res_info_a" dri
+        left join sjzt_ods."dsm_spg_spqnmp" dss on trim(dss."rscd") = dri."oth_reg_cd"
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        where 1=1
+        where dss."rscd" is not null
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
 
 
         ) resList
@@ -1915,33 +1876,18 @@
         FROM(
 
 
-
-        SELECT
-        "res_cd",
-        COUNT(*) slStation
-        FROM (
-        SELECT
-        b."guid" as "res_cd",
-        'sl' as "sys_resource"
-        FROM sjzt_ods."dsm_spg_spqn" a
-        LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-        WHERE
-        b."guid" IS NOT NULL
-        AND a."mstm" &gt;=now()-30 and a."mstm"&lt;= now()
-
-
-        group by b."guid"
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        SELECT distinct(dri."res_cd")
+        from sjzt_dw."dim_res_info_a" dri
+        left join sjzt_ods."dsm_spg_spqnmp" dss on trim(dss."rscd") = dri."oth_reg_cd"
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        where 1=1
+        where dss."rscd" is not null
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
 
 
         ) resList
@@ -1992,32 +1938,18 @@
 
 
 
-        SELECT
-        "res_cd",
-        COUNT(*) slStation
-        FROM (
-        SELECT
-        b."guid" as "res_cd",
-        'sl' as "sys_resource"
-        FROM sjzt_ods."dsm_spg_spqn" a
-        LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-        WHERE
-        b."guid" IS NOT NULL
-        AND a."mstm" &gt;=now()-30 and a."mstm"&lt;= now()
-
-
-        group by b."guid"
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        SELECT distinct(dri."res_cd")
+        from sjzt_dw."dim_res_info_a" dri
+        left join sjzt_ods."dsm_spg_spqnmp" dss on trim(dss."rscd") = dri."oth_reg_cd"
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        where 1=1
+        where dss."rscd" is not null
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
 
 
         ) resList
@@ -2069,26 +2001,16 @@
             FROM(
 
 
-            SELECT "res_cd",COUNT(*) wyStation
-            FROM
-            (
-            SELECT b."guid" as "res_cd",'wy' as "sys_resource"
-            FROM
-            (
-            SELECT "station_code" from sjzt_md."att_mqtt_calc_data" group by "station_code"
-            ) a LEFT JOIN SJZT_MD."att_res_base" b on substr(a."station_code",0,length(a."station_code")-2) = b."guid"
-            where b."guid" is not null
-            ) temp
-            LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+            SELECT distinct("res_cd") from sjzt_md."att_wy_cd_base" awcb
+            LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = awcb."res_cd"
             LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
             LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
             LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
             LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-            WHERE 1= 1
+            where awcb."cd" != '00'
             <if test=" dam.adCode!= null and dam.adCode !='' ">
                 AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
             </if>
-            GROUP BY "res_cd"
 
 
             ) resList
@@ -2140,26 +2062,16 @@
         FROM(
 
 
-        SELECT "res_cd",COUNT(*) wyStation
-        FROM
-        (
-        SELECT b."guid" as "res_cd",'wy' as "sys_resource"
-        FROM
-        (
-        SELECT "station_code" from sjzt_md."att_mqtt_calc_data" group by "station_code"
-        ) a LEFT JOIN SJZT_MD."att_res_base" b on substr(a."station_code",0,length(a."station_code")-2) = b."guid"
-        where b."guid" is not null
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        SELECT distinct("res_cd") from sjzt_md."att_wy_cd_base" awcb
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = awcb."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        WHERE 1= 1
+        where awcb."cd" != '00'
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
 
 
         ) resList
@@ -2211,26 +2123,16 @@
 
 
 
-        SELECT "res_cd",COUNT(*) wyStation
-        FROM
-        (
-        SELECT b."guid" as "res_cd",'wy' as "sys_resource"
-        FROM
-        (
-        SELECT "station_code" from sjzt_md."att_mqtt_calc_data" group by "station_code"
-        ) a LEFT JOIN SJZT_MD."att_res_base" b on substr(a."station_code",0,length(a."station_code")-2) = b."guid"
-        where b."guid" is not null
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        SELECT distinct("res_cd") from sjzt_md."att_wy_cd_base" awcb
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = awcb."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        WHERE 1= 1
+        where awcb."cd" != '00'
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
 
 
         ) resList
@@ -2282,26 +2184,16 @@
 
 
 
-        SELECT "res_cd",COUNT(*) wyStation
-        FROM
-        (
-        SELECT b."guid" as "res_cd",'wy' as "sys_resource"
-        FROM
-        (
-        SELECT "station_code" from sjzt_md."att_mqtt_calc_data" group by "station_code"
-        ) a LEFT JOIN SJZT_MD."att_res_base" b on substr(a."station_code",0,length(a."station_code")-2) = b."guid"
-        where b."guid" is not null
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        SELECT distinct("res_cd") from sjzt_md."att_wy_cd_base" awcb
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = awcb."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        WHERE 1= 1
+        where awcb."cd" != '00'
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
 
 
         ) resList
@@ -2640,24 +2532,21 @@
 
 
 
-            SELECT "res_cd", COUNT(*) syStation
+            SELECT
+            distinct (dri."res_cd")
             FROM
-            (
-            SELECT b."guid" as "res_cd",'sy' as "sys_resource"
-            FROM sjzt_ods."dsm_spg_spprmp" a
-            LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-            WHERE b."guid" is not null
-            ) temp
-            LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+            sjzt_dw."dim_res_info_a" dri
+            LEFT JOIN sjzt_ods."dsm_spg_spprmp" dss ON dri."oth_reg_cd" = dss."rscd"
+            LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
             LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
             LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
             LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
             LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-            WHERE 1=1
+
+            where dss."rscd" is not null
             <if test=" dam.adCode!= null and dam.adCode !='' ">
                 AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
             </if>
-            GROUP BY "res_cd"
 
 
 
@@ -2739,24 +2628,26 @@
 
         SELECT normalList."res_cd" as resCd FROM (
         SELECT allList."res_cd",errorList."name" FROM (
-        SELECT "res_cd", COUNT(*) syStation
+
+
+        SELECT
+        distinct (dri."res_cd")
         FROM
-        (
-        SELECT b."guid" as "res_cd",'sy' as "sys_resource"
-        FROM sjzt_ods."dsm_spg_spprmp" a
-        LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-        WHERE b."guid" is not null
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        sjzt_dw."dim_res_info_a" dri
+        LEFT JOIN sjzt_ods."dsm_spg_spprmp" dss ON dri."oth_reg_cd" = dss."rscd"
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        WHERE 1=1
+
+        where dss."rscd" is not null
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
+
+
+
         ) allList LEFT JOIN
 
         (
@@ -2835,24 +2726,29 @@
 
         SELECT normalList."res_cd" as resCd FROM (
         SELECT allList."res_cd",errorList."name" FROM (
-        SELECT "res_cd", COUNT(*) syStation
+
+
+
+
+        SELECT
+        distinct (dri."res_cd")
         FROM
-        (
-        SELECT b."guid" as "res_cd",'sy' as "sys_resource"
-        FROM sjzt_ods."dsm_spg_spprmp" a
-        LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-        WHERE b."guid" is not null
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        sjzt_dw."dim_res_info_a" dri
+        LEFT JOIN sjzt_ods."dsm_spg_spprmp" dss ON dri."oth_reg_cd" = dss."rscd"
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        WHERE 1=1
+
+        where dss."rscd" is not null
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
+
+
+
+
         ) allList LEFT JOIN
 
         (
@@ -2929,24 +2825,29 @@
 
         SELECT normalList."res_cd" as resCd FROM (
         SELECT allList."res_cd",errorList."name" FROM (
-        SELECT "res_cd", COUNT(*) syStation
+
+
+
+
+        SELECT
+        distinct (dri."res_cd")
         FROM
-        (
-        SELECT b."guid" as "res_cd",'sy' as "sys_resource"
-        FROM sjzt_ods."dsm_spg_spprmp" a
-        LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-        WHERE b."guid" is not null
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        sjzt_dw."dim_res_info_a" dri
+        LEFT JOIN sjzt_ods."dsm_spg_spprmp" dss ON dri."oth_reg_cd" = dss."rscd"
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        WHERE 1=1
+
+        where dss."rscd" is not null
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
+
+
+
+
         ) allList LEFT JOIN
 
         (
@@ -3028,32 +2929,18 @@
 
 
 
-            SELECT
-            "res_cd",
-            COUNT(*) slStation
-            FROM (
-            SELECT
-            b."guid" as "res_cd",
-            'sl' as "sys_resource"
-            FROM sjzt_ods."dsm_spg_spqn" a
-            LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-            WHERE
-            b."guid" IS NOT NULL
-            AND a."mstm" &gt;=now()-30 and a."mstm"&lt;= now()
-
-
-            group by b."guid"
-            ) temp
-            LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+            SELECT distinct(dri."res_cd")
+            from sjzt_dw."dim_res_info_a" dri
+            left join sjzt_ods."dsm_spg_spqnmp" dss on trim(dss."rscd") = dri."oth_reg_cd"
+            LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
             LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
             LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
             LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
             LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-            where 1=1
+            where dss."rscd" is not null
             <if test=" dam.adCode!= null and dam.adCode !='' ">
                 AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
             </if>
-            GROUP BY "res_cd"
 
 
 
@@ -3139,32 +3026,18 @@
 
 
 
-        SELECT
-        "res_cd",
-        COUNT(*) slStation
-        FROM (
-        SELECT
-        b."guid" as "res_cd",
-        'sl' as "sys_resource"
-        FROM sjzt_ods."dsm_spg_spqn" a
-        LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-        WHERE
-        b."guid" IS NOT NULL
-        AND a."mstm" &gt;=now()-30 and a."mstm"&lt;= now()
-
-
-        group by b."guid"
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        SELECT distinct(dri."res_cd")
+        from sjzt_dw."dim_res_info_a" dri
+        left join sjzt_ods."dsm_spg_spqnmp" dss on trim(dss."rscd") = dri."oth_reg_cd"
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        where 1=1
+        where dss."rscd" is not null
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
 
 
 
@@ -3249,32 +3122,18 @@
 
 
 
-        SELECT
-        "res_cd",
-        COUNT(*) slStation
-        FROM (
-        SELECT
-        b."guid" as "res_cd",
-        'sl' as "sys_resource"
-        FROM sjzt_ods."dsm_spg_spqn" a
-        LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-        WHERE
-        b."guid" IS NOT NULL
-        AND a."mstm" &gt;=now()-30 and a."mstm"&lt;= now()
-
-
-        group by b."guid"
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        SELECT distinct(dri."res_cd")
+        from sjzt_dw."dim_res_info_a" dri
+        left join sjzt_ods."dsm_spg_spqnmp" dss on trim(dss."rscd") = dri."oth_reg_cd"
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        where 1=1
+        where dss."rscd" is not null
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
 
 
 
@@ -3357,32 +3216,18 @@
 
 
 
-        SELECT
-        "res_cd",
-        COUNT(*) slStation
-        FROM (
-        SELECT
-        b."guid" as "res_cd",
-        'sl' as "sys_resource"
-        FROM sjzt_ods."dsm_spg_spqn" a
-        LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code"
-        WHERE
-        b."guid" IS NOT NULL
-        AND a."mstm" &gt;=now()-30 and a."mstm"&lt;= now()
-
-
-        group by b."guid"
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        SELECT distinct(dri."res_cd")
+        from sjzt_dw."dim_res_info_a" dri
+        left join sjzt_ods."dsm_spg_spqnmp" dss on trim(dss."rscd") = dri."oth_reg_cd"
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        where 1=1
+        where dss."rscd" is not null
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
 
 
 
@@ -3474,26 +3319,16 @@
 
 
 
-            SELECT "res_cd",COUNT(*) wyStation
-            FROM
-            (
-            SELECT b."guid" as "res_cd",'wy' as "sys_resource"
-            FROM
-            (
-            SELECT "station_code" from sjzt_md."att_mqtt_calc_data" group by "station_code"
-            ) a LEFT JOIN SJZT_MD."att_res_base" b on substr(a."station_code",0,length(a."station_code")-2) = b."guid"
-            where b."guid" is not null
-            ) temp
-            LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+            SELECT distinct("res_cd") from sjzt_md."att_wy_cd_base" awcb
+            LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = awcb."res_cd"
             LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
             LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
             LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
             LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-            WHERE 1= 1
+            where awcb."cd" != '00'
             <if test=" dam.adCode!= null and dam.adCode !='' ">
                 AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
             </if>
-            GROUP BY "res_cd"
 
 
 
@@ -3579,26 +3414,16 @@
 
 
 
-        SELECT "res_cd",COUNT(*) wyStation
-        FROM
-        (
-        SELECT b."guid" as "res_cd",'wy' as "sys_resource"
-        FROM
-        (
-        SELECT "station_code" from sjzt_md."att_mqtt_calc_data" group by "station_code"
-        ) a LEFT JOIN SJZT_MD."att_res_base" b on substr(a."station_code",0,length(a."station_code")-2) = b."guid"
-        where b."guid" is not null
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        SELECT distinct("res_cd") from sjzt_md."att_wy_cd_base" awcb
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = awcb."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        WHERE 1= 1
+        where awcb."cd" != '00'
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
 
 
 
@@ -3685,26 +3510,16 @@
 
 
 
-        SELECT "res_cd",COUNT(*) wyStation
-        FROM
-        (
-        SELECT b."guid" as "res_cd",'wy' as "sys_resource"
-        FROM
-        (
-        SELECT "station_code" from sjzt_md."att_mqtt_calc_data" group by "station_code"
-        ) a LEFT JOIN SJZT_MD."att_res_base" b on substr(a."station_code",0,length(a."station_code")-2) = b."guid"
-        where b."guid" is not null
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        SELECT distinct("res_cd") from sjzt_md."att_wy_cd_base" awcb
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = awcb."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        WHERE 1= 1
+        where awcb."cd" != '00'
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
 
 
 
@@ -3788,26 +3603,16 @@
 
 
 
-        SELECT "res_cd",COUNT(*) wyStation
-        FROM
-        (
-        SELECT b."guid" as "res_cd",'wy' as "sys_resource"
-        FROM
-        (
-        SELECT "station_code" from sjzt_md."att_mqtt_calc_data" group by "station_code"
-        ) a LEFT JOIN SJZT_MD."att_res_base" b on substr(a."station_code",0,length(a."station_code")-2) = b."guid"
-        where b."guid" is not null
-        ) temp
-        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp."res_cd"
+        SELECT distinct("res_cd") from sjzt_md."att_wy_cd_base" awcb
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = awcb."res_cd"
         LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
         LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
         LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
-        WHERE 1= 1
+        where awcb."cd" != '00'
         <if test=" dam.adCode!= null and dam.adCode !='' ">
             AND (province."ad_code" =#{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode})
         </if>
-        GROUP BY "res_cd"
 
 
 
@@ -3853,4 +3658,152 @@
     </select>
 
 
+
+
+    <select id="damResInfoCountSy" resultType="cn.gistack.sm.damSecurity.vo.DamStatisticsRes">
+        SELECT
+            base.total,
+            base.errorNum,
+            (base.total-base.errorNum) as normalNum,
+            base.typeName,
+            base.type FROM (
+                SELECT
+                COUNT(*) total,
+                '渗压' AS typeName ,
+                '1' AS type,
+                (SELECT COUNT(*) FROM
+                (
+                SELECT DAM_ID FROM YWXT.NKY_ALARM_GET temp
+                LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp.dam_id
+                LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
+                LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
+                LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
+                LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
+                WHERE
+                TYPE = 1
+                AND DATE_FORMAT(time,'%Y-%m-%d')>= CURDATE()
+                <if test=" adCode!= null and adCode !='' ">
+                    AND (province."ad_code" =#{adCode} or city."ad_code" = #{adCode} or county."ad_code" = #{adCode})
+                </if>
+                GROUP BY DAM_ID
+                )
+                ) errorNum
+                FROM
+                (
+                SELECT
+                distinct (dri."res_cd")
+                FROM
+                sjzt_dw."dim_res_info_a" dri
+                LEFT JOIN sjzt_ods."dsm_spg_spprmp" dss ON dri."oth_reg_cd" = dss."rscd"
+                LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
+                LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
+                LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
+                LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
+                LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
+
+                where dss."rscd" is not null
+                <if test=" adCode!= null and adCode !='' ">
+                    AND (province."ad_code" =#{adCode} or city."ad_code" = #{adCode} or county."ad_code" = #{adCode})
+                </if>
+                )
+        )base
+
+
+
+    </select>
+    <select id="damResInfoCountSl" resultType="cn.gistack.sm.damSecurity.vo.DamStatisticsRes">
+        SELECT
+        base.total,
+        base.errorNum,
+        (base.total-base.errorNum) as normalNum,
+        base.typeName,
+        base.type FROM (
+            SELECT
+            COUNT(*) total,
+            '渗流' AS typeName ,
+            '2' AS type,
+            (SELECT COUNT(*) FROM
+            (
+            SELECT DAM_ID FROM YWXT.NKY_ALARM_GET temp
+            LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp.dam_id
+            LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
+            LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
+            LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
+            LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
+            WHERE
+            TYPE = 2
+            AND DATE_FORMAT(time,'%Y-%m-%d')>= CURDATE()
+            <if test=" adCode!= null and adCode !='' ">
+                AND (province."ad_code" =#{adCode} or city."ad_code" = #{adCode} or county."ad_code" = #{adCode})
+            </if>
+            GROUP BY DAM_ID
+            )
+            ) errorNum
+            FROM
+            (
+            select distinct(dri."res_cd")
+            from sjzt_dw."dim_res_info_a" dri
+            left join sjzt_ods."dsm_spg_spqnmp" dss on trim(dss."rscd") = dri."oth_reg_cd"
+            LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = dri."res_cd"
+            LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
+            LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
+            LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
+            LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
+            where dss."rscd" is not null
+            <if test=" adCode!= null and adCode !='' ">
+                AND (province."ad_code" =#{adCode} or city."ad_code" = #{adCode} or county."ad_code" = #{adCode})
+            </if>
+            )
+        )base
+
+
+    </select>
+    <select id="damResInfoCountWy" resultType="cn.gistack.sm.damSecurity.vo.DamStatisticsRes">
+        SELECT
+        base.total,
+        base.errorNum,
+        (base.total-base.errorNum) as normalNum,
+        base.typeName,
+        base.type FROM (
+        SELECT
+        COUNT(*) total,
+        '位移' AS typeName ,
+        '3' AS type,
+        (SELECT COUNT(*) FROM
+        (
+        SELECT DAM_ID FROM YWXT.NKY_ALARM_GET temp
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = temp.dam_id
+        LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
+        LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
+        LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
+        LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
+        WHERE
+        (TYPE = 3 or type = 4 or type = 5)
+        AND DATE_FORMAT(time,'%Y-%m-%d')>= CURDATE()
+        <if test=" adCode!= null and adCode !='' ">
+            AND (province."ad_code" =#{adCode} or city."ad_code" = #{adCode} or county."ad_code" = #{adCode})
+        </if>
+        GROUP BY DAM_ID
+        )
+        ) errorNum
+        FROM
+        (
+
+        select distinct("res_cd") from sjzt_md."att_wy_cd_base" awcb
+        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = awcb."res_cd"
+        LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = arb."interior_ad_guid"
+        LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
+        LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
+        LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code"
+        where awcb."cd" != '00'
+        <if test=" adCode!= null and adCode !='' ">
+            AND (province."ad_code" =#{adCode} or city."ad_code" = #{adCode} or county."ad_code" = #{adCode})
+        </if>
+        )
+        )base
+
+
+    </select>
+
+
 </mapper>

--
Gitblit v1.9.3