| | |
| | | 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, |
| | |
| | | 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", |
| | |
| | | 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 ( |
| | | |
| | |
| | | |
| | | |
| | | ) sl ON sl."res_cd" = baseRes."guid" |
| | | |
| | | |
| | | LEFT JOIN ( |
| | | SELECT DAM_ID ,COUNT(*) errorNum FROM NKY_ALARM_GET |
| | | WHERE 1=1 |
| | |
| | | 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> |
| | | |
| | |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | ORDER BY NAG.TIME DESC |
| | | |
| | | </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 '1' as type,'渗压' as typeName, SUM(TMP.allNum) total,sum(TMP.errorNum) errorNum,sum(normalNum) normalNum FROM ( |
| | | select "ad_code","ad_name",allNum,errorNum,allNum-errorNum normalNum from ( |
| | |
| | | FROM ywxt.NKY_ALARM_GET NAG |
| | | where |
| | | TYPE = 1 |
| | | AND DATE_FORMAT(time,'%Y-%m-%d')>= CURDATE() |
| | | AND time>= CURDATE() |
| | | group by NAG.dam_id |
| | | ) NAG |
| | | left join sjzt_md."att_res_base" res on (res."guid" = NAG.dam_id) |
| | |
| | | select max(NAG.dam_id) dam_id |
| | | FROM ywxt.NKY_ALARM_GET NAG |
| | | where TYPE = 2 |
| | | AND DATE_FORMAT(time,'%Y-%m-%d')>= CURDATE() |
| | | AND time>= CURDATE() |
| | | group by NAG.dam_id |
| | | ) NAG |
| | | left join sjzt_md."att_res_base" res on (res."guid" = NAG.dam_id) |
| | |
| | | select max(NAG.dam_id) dam_id |
| | | FROM ywxt.NKY_ALARM_GET NAG |
| | | where (TYPE = 3 or type = 4 or type = 5) |
| | | AND DATE_FORMAT(time,'%Y-%m-%d')>= CURDATE() |
| | | AND time>= CURDATE() |
| | | group by NAG.dam_id |
| | | ) NAG |
| | | left join sjzt_md."att_res_base" res on (res."guid" = NAG.dam_id) |