guoshilong
2024-01-30 61a2a1b82d6422e17a2526deefe2906582de9068
大坝预警导出修改
1 files modified
33 ■■■■ changed files
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/damSecurity/mapper/DamSecurityMapper.xml 33 ●●●● patch | view | raw | blame | history
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/damSecurity/mapper/DamSecurityMapper.xml
@@ -527,7 +527,6 @@
        info."guid" AS resCd,
        info."name" AS resName,
        info."eng_scal" AS engScal,
        info."res_reg_code" AS resRegCode,
        info."town_ad_code" AS townCode,
        info."town_ad_name" AS townName,
        info."county_ad_code" AS countyCode,
@@ -546,7 +545,6 @@
        a."guid",
        a."name",
        a."eng_scal",
        a."res_reg_code",
        case when b."ad_grad" = 4 THEN b."ad_code" ELSE NULL END AS "town_ad_code",
        case when b."ad_grad" = 4 THEN b."ad_name" ELSE NULL END AS "town_ad_name",
        case when b."ad_grad" = 4 THEN b."order_id" ELSE NULL END AS "town_order_id",
@@ -566,34 +564,41 @@
        case when b."ad_grad" = 1 THEN b."order_id" when c."ad_grad" = 1 THEN c."order_id" when d."ad_grad" = 1 THEN
        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"
        ) 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"
        LEFT JOIN sjzt_md."att_ad_base" d ON c."p_ad_code" = d."guid"
        LEFT JOIN sjzt_md."att_ad_base" e ON d."p_ad_code" = e."guid"
        where (f."res_cd" is not null OR g."res_cd" is not null OR h."res_cd" is not null)
        <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 (
@@ -638,8 +643,6 @@
        ) sl ON sl."res_cd" = baseRes."guid"
        LEFT JOIN (
        SELECT DAM_ID ,COUNT(*) errorNum FROM NKY_ALARM_GET
        WHERE 1=1
@@ -669,21 +672,15 @@
        GROUP BY DAM_ID,POINT_ID
        ) baseCount GROUP BY DAM_ID) c1 ON c1.dam_id = baseRes."guid"
        LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = "town_ad_code"
        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>
        <if test="dam.resName != null and dam.resName !='' ">
            AND "name" LIKE CONCAT('%',#{dam.resName},'%')
        </if>
        ) info
        ) info order by info.errorNum desc
    </select>