xieb
2024-05-21 27dab2d7e2c2940c9a623d2084860868c9e06509
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/damSecurity/mapper/DamSecurityMapper.xml
@@ -110,8 +110,6 @@
        left join sjzt_md."att_ad_base" adc on (adc."guid" = adb."p_ad_code")
        left join sjzt_md."att_ad_base" addd on (addd."guid" = adc."p_ad_code")
        where res."interior_ad_guid" = aab."guid" or ada."guid" = aab."guid" or adb."guid" = aab."guid" or adc."guid" = aab."guid" or addd."guid" = aab."guid"
        ) as errorNum,
        (
        SELECT COUNT(*) FROM (
@@ -231,7 +229,6 @@
        OR b."ad_code" = aab."guid" )
        )
        ) allNum
        FROM SJZT_MD."att_ad_base" aab
        where
        <choose>
@@ -244,21 +241,14 @@
        </choose>
        )
        )TMP
    </select>
    <select id="listRegionCount" resultType="cn.gistack.sm.damSecurity.vo.DamSecurityStatistics">
        SELECT allNum,errorNum, allNum-errorNum normalNum,adName,adCode FROM
        (
        SELECT
        (
        SELECT COUNT(*) FROM
@@ -339,7 +329,6 @@
        or c."ad_code" = aab."guid" or b."ad_code" = aab."guid" )
        )
        ) allNum,
        (
        SELECT COUNT(*)FROM (SELECT distinct DAM_ID FROM NKY_ALARM_GET NAG
        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = NAG.DAM_ID
@@ -347,14 +336,12 @@
        left join SJZT_MD."att_ad_base" c on b."p_ad_code" = c."ad_code"
        left join SJZT_MD."att_ad_base" d on c."p_ad_code" = d."ad_code"
        where (d."ad_code" = aab."guid" or c."ad_code" = aab."guid" or b."ad_code" = aab."guid" )
        <if test="dam.startTime != null and dam.startTime != ''">
            AND time &gt;= #{dam.startTime}
        </if>
        <if test="dam.endTime != null and dam.endTime !='' ">
            AND time &lt;= #{dam.endTime}
        </if>
        )) errorNum,
        aab."ad_name" adName , aab."guid" adCode from SJZT_MD."att_ad_base" aab
        where
@@ -367,7 +354,6 @@
            </otherwise>
        </choose>
        )
    </select>
    <select id="listRegionCountOptimize" resultType="cn.gistack.sm.damSecurity.vo.DamSecurityStatistics">
        select "ad_code","ad_name",allNum,errorNum,allNum-errorNum normalNum from (
@@ -385,8 +371,6 @@
            left join sjzt_md."att_ad_base" adc on (adc."guid" = adb."p_ad_code")
            left join sjzt_md."att_ad_base" addd on (addd."guid" = adc."p_ad_code")
            where res."interior_ad_guid" = aab."guid" or ada."guid" = aab."guid" or adb."guid" = aab."guid" or adc."guid" = aab."guid" or addd."guid" = aab."guid"
            ) as errorNum,
            (
            SELECT COUNT(*) FROM (
@@ -506,7 +490,6 @@
            OR b."ad_code" = aab."guid" )
            )
            ) allNum
            FROM SJZT_MD."att_ad_base" aab
            where
            <choose>
@@ -818,7 +801,6 @@
    <select id="tableResCountPageOptimize" resultType="cn.gistack.sm.damSecurity.vo.DamStationStatistics">
        SELECT
        info."guid" AS resCd,
        info."res_reg_code" as resRegCode,
@@ -863,30 +845,22 @@
        d."order_id" ELSE e."order_id" END AS "province_order_id"
        FROM sjzt_md."att_res_base" a
        LEFT JOIN (
        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"
        where dss."rscd" is not null
        ) f ON a."guid" = f."res_cd"
        LEFT JOIN (
        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"
        where dss."rscd" is not null
        ) G on a."guid" = g."res_cd"
        LEFT JOIN (
        SELECT distinct("res_cd") from sjzt_md."att_wy_cd_base" awcb
        where awcb."cd" != '00'
        ) h ON a."guid" = h."res_cd"
        LEFT JOIN sjzt_md."att_ad_base" b ON a."interior_ad_guid" = b."guid"
        LEFT JOIN sjzt_md."att_ad_base" c ON b."p_ad_code" = c."guid"
@@ -896,23 +870,15 @@
        <if test="dam.adCode != null and dam.adCode !='' ">
            AND (c."ad_code" = #{dam.adCode} or d."ad_code" =#{dam.adCode}or e."ad_code" = #{dam.adCode})
        </if>
        ) baseRes
        LEFT JOIN (
        select res."res_cd",count(*) wyStation from(
            SELECT distinct("res_cd") from sjzt_md."att_wy_cd_base" awcb
            where awcb."cd" != '00'
        )res LEFT JOIN SJZT_MD."att_wy_cd_base" acb ON acb."res_cd" = res."res_cd"
        where acb."cd_type" = 'wy' group by res."res_cd"
        ) wy ON wy."res_cd" = baseRes."guid"
        LEFT JOIN(
                select res."res_cd",count(*) syStation from(
                SELECT
                distinct (dri."res_cd")
@@ -922,40 +888,27 @@
                where dss."rscd" is not null
                )res LEFT JOIN SJZT_MD."att_cd_base" acb ON acb."res_cd" = res."res_cd"
                where acb."cd_type" = 'sy' group by res."res_cd"
        ) sy ON sy."res_cd" = baseRes."guid"
        LEFT JOIN (
        select res."res_cd",count(*) slStation 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"
        where dss."rscd" is not null
        )res LEFT JOIN SJZT_MD."att_cd_base" acb ON acb."res_cd" = res."res_cd"
        where acb."cd_type" = 'sl' group by res."res_cd"
        ) sl ON sl."res_cd" = baseRes."guid"
        LEFT JOIN (
        SELECT DAM_ID ,COUNT(*) errorNum FROM NKY_ALARM_GET
        WHERE 1=1
        <if test="dam.startTime != null and dam.startTime != ''">
            AND time &gt;= #{dam.startTime}
        </if>
        <if test="dam.endTime != null and dam.endTime !='' ">
            AND time &lt;= #{dam.endTime}
        </if>
        GROUP BY "DAM_ID"
        ) alarm ON alarm.DAM_ID = baseRes."guid"
        LEFT JOIN (
        SELECT DAM_ID ,COUNT(*) errorCountNum
        FROM (
@@ -969,12 +922,7 @@
        </if>
        GROUP BY DAM_ID,POINT_ID
        ) baseCount GROUP BY DAM_ID) c1 ON c1.dam_id = baseRes."guid"
        WHERE 1=1
        <!--这里加条件-->
        <if test="dam.resName != null and dam.resName !='' ">
            AND "name" LIKE CONCAT('%',#{dam.resName},'%')
        </if>