| | |
| | | </if> |
| | | |
| | | <if test="dam.startTime != null and dam.startTime != ''"> |
| | | AND DATE_FORMAT(time,'%Y-%m-%d') >= #{dam.startTime} |
| | | AND time >= #{dam.startTime} |
| | | </if> |
| | | <if test="dam.endTime != null and dam.endTime !='' "> |
| | | AND DATE_FORMAT(time,'%Y-%m-%d') <= #{dam.endTime} |
| | | AND time <= #{dam.endTime} |
| | | </if> |
| | | )) errorNum |
| | | ),SJZT_MD."att_ad_base" aab |
| | |
| | | |
| | | |
| | | </select> |
| | | <select id="getSingleRegionCountOptimize" resultType="cn.gistack.sm.damSecurity.vo.DamSecurityStatistics"> |
| | | SELECT SUM(TMP.allNum) allNum,sum(TMP.errorNum) errorNum,sum(normalNum) normalNum FROM ( |
| | | select "ad_code","ad_name",allNum,errorNum,allNum-errorNum normalNum from ( |
| | | select "ad_code","ad_name", |
| | | ( |
| | | select count(*) from ( |
| | | select max(NAG.dam_id) dam_id |
| | | FROM ywxt.NKY_ALARM_GET NAG |
| | | where time >= #{dam.startTime} AND time <= #{dam.endTime} |
| | | group by NAG.dam_id |
| | | ) NAG |
| | | left join sjzt_md."att_res_base" res on (res."guid" = NAG.dam_id) |
| | | left join sjzt_md."att_ad_base" ada on (ada."guid" = res."interior_ad_guid") |
| | | left join sjzt_md."att_ad_base" adb on (adb."guid" = ada."p_ad_code") |
| | | 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 ( |
| | | SELECT a."guid",a."name",a."eng_scal", |
| | | 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" = 3 THEN |
| | | b."ad_code" |
| | | WHEN c."ad_grad" = 3 THEN |
| | | c."ad_code" |
| | | END AS "county_ad_code", |
| | | CASE |
| | | WHEN b."ad_grad" = 3 THEN |
| | | b."ad_name" |
| | | WHEN c."ad_grad" = 3 THEN |
| | | C."ad_name" |
| | | END AS "county_ad_name", |
| | | CASE |
| | | WHEN b."ad_grad" = 3 THEN |
| | | b."order_id" |
| | | WHEN c."ad_grad" = 3 THEN |
| | | C."order_id" |
| | | END AS "county_order_id", |
| | | CASE |
| | | WHEN b."ad_grad" = 2 THEN |
| | | b."ad_code" |
| | | WHEN c."ad_grad" = 2 THEN |
| | | c."ad_code" |
| | | ELSE d."ad_code" |
| | | END AS "city_ad_code", |
| | | CASE |
| | | WHEN b."ad_grad" = 2 THEN |
| | | b."ad_name" |
| | | WHEN c."ad_grad" = 2 THEN |
| | | c."ad_name" |
| | | ELSE d."ad_name" |
| | | END AS "city_ad_name", |
| | | CASE |
| | | WHEN b."ad_grad" = 2 THEN |
| | | b."order_id" |
| | | WHEN c."ad_grad" = 2 THEN |
| | | c."order_id" |
| | | ELSE d."order_id" |
| | | END AS "city_order_id", |
| | | CASE |
| | | WHEN b."ad_grad" = 1 THEN |
| | | b."ad_code" |
| | | WHEN c."ad_grad" = 1 THEN |
| | | c."ad_code" |
| | | WHEN d."ad_grad" = 1 THEN |
| | | d."ad_code" |
| | | ELSE e."ad_code" |
| | | END AS "province_ad_code", |
| | | CASE |
| | | WHEN b."ad_grad" = 1 THEN |
| | | b."ad_name" |
| | | WHEN c."ad_grad" = 1 THEN |
| | | c."ad_name" |
| | | WHEN d."ad_grad" = 1 THEN |
| | | d."ad_name" |
| | | ELSE e."ad_name" |
| | | END AS "province_ad_name", |
| | | 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" |
| | | 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 |
| | | ) |
| | | AND (d."ad_code" = aab."guid" |
| | | OR c."ad_code" = aab."guid" |
| | | OR b."ad_code" = aab."guid" ) |
| | | ) |
| | | ) allNum |
| | | |
| | | FROM SJZT_MD."att_ad_base" aab |
| | | where |
| | | <choose> |
| | | <when test="dam.adCode != null and dam.adCode !='' "> |
| | | "p_ad_code" = #{dam.adCode} |
| | | </when> |
| | | <otherwise> |
| | | "ad_grad" = 2 |
| | | </otherwise> |
| | | </choose> |
| | | ) |
| | | )TMP |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="listRegionCount" resultType="cn.gistack.sm.damSecurity.vo.DamSecurityStatistics"> |
| | | |
| | |
| | | LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code" |
| | | UNION |
| | | 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 "res_cd" is not null) f ON a."guid" = |
| | | f."res_cd" |
| | | LEFT JOIN (SELECT |
| | | "res_cd", |
| | | "sys_resource" |
| | | FROM |
| | |
| | | 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 DATE_FORMAT(time,'%Y-%m-%d') >= #{dam.startTime} |
| | | AND time >= #{dam.startTime} |
| | | </if> |
| | | <if test="dam.endTime != null and dam.endTime !='' "> |
| | | AND DATE_FORMAT(time,'%Y-%m-%d') <= #{dam.endTime} |
| | | AND time <= #{dam.endTime} |
| | | </if> |
| | | |
| | | )) errorNum, |
| | |
| | | ) |
| | | |
| | | </select> |
| | | <select id="listRegionCountOptimize" resultType="cn.gistack.sm.damSecurity.vo.DamSecurityStatistics"> |
| | | select "ad_code","ad_name",allNum,errorNum,allNum-errorNum normalNum from ( |
| | | select "ad_code","ad_name", |
| | | ( |
| | | select count(*) from ( |
| | | select max(NAG.dam_id) dam_id |
| | | FROM ywxt.NKY_ALARM_GET NAG |
| | | where time >= #{dam.startTime} AND time <= #{dam.endTime} |
| | | group by NAG.dam_id |
| | | ) NAG |
| | | left join sjzt_md."att_res_base" res on (res."guid" = NAG.dam_id) |
| | | left join sjzt_md."att_ad_base" ada on (ada."guid" = res."interior_ad_guid") |
| | | left join sjzt_md."att_ad_base" adb on (adb."guid" = ada."p_ad_code") |
| | | 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 ( |
| | | SELECT a."guid",a."name",a."eng_scal", |
| | | 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" = 3 THEN |
| | | b."ad_code" |
| | | WHEN c."ad_grad" = 3 THEN |
| | | c."ad_code" |
| | | END AS "county_ad_code", |
| | | CASE |
| | | WHEN b."ad_grad" = 3 THEN |
| | | b."ad_name" |
| | | WHEN c."ad_grad" = 3 THEN |
| | | C."ad_name" |
| | | END AS "county_ad_name", |
| | | CASE |
| | | WHEN b."ad_grad" = 3 THEN |
| | | b."order_id" |
| | | WHEN c."ad_grad" = 3 THEN |
| | | C."order_id" |
| | | END AS "county_order_id", |
| | | CASE |
| | | WHEN b."ad_grad" = 2 THEN |
| | | b."ad_code" |
| | | WHEN c."ad_grad" = 2 THEN |
| | | c."ad_code" |
| | | ELSE d."ad_code" |
| | | END AS "city_ad_code", |
| | | CASE |
| | | WHEN b."ad_grad" = 2 THEN |
| | | b."ad_name" |
| | | WHEN c."ad_grad" = 2 THEN |
| | | c."ad_name" |
| | | ELSE d."ad_name" |
| | | END AS "city_ad_name", |
| | | CASE |
| | | WHEN b."ad_grad" = 2 THEN |
| | | b."order_id" |
| | | WHEN c."ad_grad" = 2 THEN |
| | | c."order_id" |
| | | ELSE d."order_id" |
| | | END AS "city_order_id", |
| | | CASE |
| | | WHEN b."ad_grad" = 1 THEN |
| | | b."ad_code" |
| | | WHEN c."ad_grad" = 1 THEN |
| | | c."ad_code" |
| | | WHEN d."ad_grad" = 1 THEN |
| | | d."ad_code" |
| | | ELSE e."ad_code" |
| | | END AS "province_ad_code", |
| | | CASE |
| | | WHEN b."ad_grad" = 1 THEN |
| | | b."ad_name" |
| | | WHEN c."ad_grad" = 1 THEN |
| | | c."ad_name" |
| | | WHEN d."ad_grad" = 1 THEN |
| | | d."ad_name" |
| | | ELSE e."ad_name" |
| | | END AS "province_ad_name", |
| | | 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" |
| | | 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 |
| | | ) |
| | | AND (d."ad_code" = aab."guid" |
| | | OR c."ad_code" = aab."guid" |
| | | OR b."ad_code" = aab."guid" ) |
| | | ) |
| | | ) allNum |
| | | |
| | | FROM SJZT_MD."att_ad_base" aab |
| | | where |
| | | <choose> |
| | | <when test="dam.adCode != null and dam.adCode !='' "> |
| | | "p_ad_code" = #{dam.adCode} |
| | | </when> |
| | | <otherwise> |
| | | "ad_grad" = 2 |
| | | </otherwise> |
| | | </choose> |
| | | ) |
| | | </select> |
| | | |
| | | |
| | | <select id="tableResCount" resultType="cn.gistack.sm.damSecurity.vo.DamStationStatistics"> |
| | | |
| | |
| | | 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", |
| | |
| | | d."order_id" ELSE e."order_id" END AS "province_order_id" |
| | | FROM sjzt_md."att_res_base" a |
| | | LEFT JOIN ( |
| | | SELECT "res_cd","sys_resource" FROM (SELECT b."guid" as "res_cd",'sy' as "sys_resource" FROM |
| | | sjzt_ods."dsm_spg_pztb" a LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code" |
| | | UNION |
| | | 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 "res_cd" is not null) f ON a."guid" = f."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" |
| | | where dss."rscd" is not null |
| | | |
| | | ) f ON a."guid" = f."res_cd" |
| | | LEFT JOIN ( |
| | | SELECT "res_cd", "sys_resource" FROM (SELECT b."guid" as "res_cd", 'sl' as "sys_resource" FROM |
| | | sjzt_ods."dsm_spg_spqnmp" a LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code" group by b."guid") |
| | | WHERE "res_cd" is not null) G on a."guid" = g."res_cd" |
| | | LEFT JOIN (SELECT "res_cd", "sys_resource" 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" group by b."guid") |
| | | WHERE "res_cd" is not null) h ON a."guid" = h."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" |
| | | 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" |
| | | 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 ( |
| | | 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 |
| | | ) |
| | | GROUP BY "res_cd" |
| | | |
| | | |
| | | 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_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 |
| | | ) |
| | | GROUP BY "res_cd" |
| | | |
| | | select res."res_cd",count(*) syStation 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" |
| | | 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_cd",COUNT(*) slStation |
| | | FROM ( SELECT b."guid" as "res_cd",'sl' as "sys_resource" |
| | | FROM sjzt_ods."dsm_spg_spqnmp" a LEFT JOIN SJZT_MD."att_res_base" b on a."rscd" = b."res_reg_code" |
| | | WHERE b."guid" is not null |
| | | group by b."guid" ) |
| | | GROUP BY "res_cd" |
| | | |
| | | |
| | | 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 DATE_FORMAT(time,'%Y-%m-%d') >= #{dam.startTime} |
| | | AND time >= #{dam.startTime} |
| | | </if> |
| | | <if test="dam.endTime != null and dam.endTime !='' "> |
| | | AND DATE_FORMAT(time,'%Y-%m-%d') <= #{dam.endTime} |
| | | AND time <= #{dam.endTime} |
| | | </if> |
| | | |
| | | |
| | |
| | | SELECT DAM_ID, COUNT(*) FROM YWXT.NKY_ALARM_GET |
| | | WHERE 1=1 |
| | | <if test="dam.startTime != null and dam.startTime != ''"> |
| | | AND DATE_FORMAT(time,'%Y-%m-%d') >= #{dam.startTime} |
| | | AND time >= #{dam.startTime} |
| | | </if> |
| | | <if test="dam.endTime != null and dam.endTime !='' "> |
| | | AND DATE_FORMAT(time,'%Y-%m-%d') <= #{dam.endTime} |
| | | AND time <= #{dam.endTime} |
| | | </if> |
| | | 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> |
| | | |
| | |
| | | WHERE 1=1 |
| | | |
| | | <if test="dam.startTime != null and dam.startTime != ''"> |
| | | AND DATE_FORMAT(time,'%Y-%m-%d') >= #{dam.startTime} |
| | | AND time >= #{dam.startTime} |
| | | </if> |
| | | <if test="dam.endTime != null and dam.endTime !='' "> |
| | | AND DATE_FORMAT(time,'%Y-%m-%d') <= #{dam.endTime} |
| | | AND time <= #{dam.endTime} |
| | | </if> |
| | | |
| | | |
| | |
| | | SELECT DAM_ID, COUNT(*) FROM YWXT.NKY_ALARM_GET |
| | | WHERE 1=1 |
| | | <if test="dam.startTime != null and dam.startTime != ''"> |
| | | AND DATE_FORMAT(time,'%Y-%m-%d') >= #{dam.startTime} |
| | | AND time >= #{dam.startTime} |
| | | </if> |
| | | <if test="dam.endTime != null and dam.endTime !='' "> |
| | | AND DATE_FORMAT(time,'%Y-%m-%d') <= #{dam.endTime} |
| | | AND time <= #{dam.endTime} |
| | | </if> |
| | | GROUP BY DAM_ID,POINT_ID |
| | | ) baseCount GROUP BY DAM_ID) c1 ON c1.dam_id = baseRes."guid" |
| | |
| | | |
| | | </select> |
| | | |
| | | |
| | | <select id="tableResCountPageOptimize" resultType="cn.gistack.sm.damSecurity.vo.DamStationStatistics"> |
| | | |
| | | SELECT |
| | | info."guid" AS resCd, |
| | | info."res_reg_code" as resRegCode, |
| | | info."name" AS resName, |
| | | info."eng_scal" AS engScal, |
| | | info."town_ad_code" AS townCode, |
| | | info."town_ad_name" AS townName, |
| | | info."county_ad_code" AS countyCode, |
| | | info."county_ad_name" AS countyName , |
| | | info."city_ad_code" AS cityCode, |
| | | info."city_ad_name" AS cityName, |
| | | (info.wy+info.sy+info.sl) AS total, |
| | | (info.wy+info.sy+info.sl-info.errorCountNum) AS normalNum, |
| | | info.errorNum AS errorNum |
| | | FROM |
| | | ( |
| | | SELECT baseRes.*,ifnull(wy.wyStation,0) wy ,ifnull(sy.syStation,0) sy,ifnull(sl.slStation,0) |
| | | sl,ifnull(alarm.errorNum,0) errorNum, ifnull(c1.errorCountNum,0) errorCountNum FROM |
| | | ( |
| | | SELECT |
| | | 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" = 3 THEN b."ad_code" when c."ad_grad" = 3 THEN c."ad_code" END AS "county_ad_code", |
| | | case when b."ad_grad" = 3 THEN b."ad_name" when c."ad_grad" = 3 THEN C."ad_name" END AS "county_ad_name", |
| | | case when b."ad_grad" = 3 THEN b."order_id" when c."ad_grad" = 3 THEN C."order_id" END AS "county_order_id", |
| | | case when b."ad_grad" = 2 THEN b."ad_code" when c."ad_grad" = 2 THEN c."ad_code" ELSE d."ad_code" END AS |
| | | "city_ad_code", |
| | | case when b."ad_grad" = 2 THEN b."ad_name" when c."ad_grad" = 2 THEN c."ad_name" ELSE d."ad_name" END AS |
| | | "city_ad_name", |
| | | case when b."ad_grad" = 2 THEN b."order_id" when c."ad_grad" = 2 THEN c."order_id" ELSE d."order_id" END AS |
| | | "city_order_id", |
| | | case when b."ad_grad" = 1 THEN b."ad_code" when c."ad_grad" = 1 THEN c."ad_code" when d."ad_grad" = 1 THEN |
| | | d."ad_code" ELSE e."ad_code" END AS "province_ad_code", |
| | | case when b."ad_grad" = 1 THEN b."ad_name" when c."ad_grad" = 1 THEN c."ad_name" when d."ad_grad" = 1 THEN |
| | | d."ad_name" ELSE e."ad_name" END AS "province_ad_name", |
| | | 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" |
| | | 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 ( |
| | | |
| | | |
| | | 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") |
| | | 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 |
| | | )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 >= #{dam.startTime} |
| | | </if> |
| | | <if test="dam.endTime != null and dam.endTime !='' "> |
| | | AND time <= #{dam.endTime} |
| | | </if> |
| | | |
| | | |
| | | GROUP BY "DAM_ID" |
| | | ) alarm ON alarm.DAM_ID = baseRes."guid" |
| | | |
| | | LEFT JOIN ( |
| | | SELECT DAM_ID ,COUNT(*) errorCountNum |
| | | FROM ( |
| | | SELECT DAM_ID, COUNT(*) FROM YWXT.NKY_ALARM_GET |
| | | WHERE 1=1 |
| | | <if test="dam.startTime != null and dam.startTime != ''"> |
| | | AND time >= #{dam.startTime} |
| | | </if> |
| | | <if test="dam.endTime != null and dam.endTime !='' "> |
| | | AND time <= #{dam.endTime} |
| | | </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> |
| | | ) info order by info.errorNum desc |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="alarmResCount" resultType="cn.gistack.sm.damSecurity.vo.DamStationStatistics"> |
| | | SELECT |
| | | arb."center_long" AS longitude, |
| | | arb."center_lat" AS latitude, |
| | | arb."name" as resName, |
| | | resCd, |
| | | abb."code" AS basCode, |
| | | abb."name" AS basName |
| | |
| | | ) errorNum |
| | | 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=" adCode!= null and adCode !='' "> |
| | | AND (province."ad_code" =#{adCode} or city."ad_code" = #{adCode} or county."ad_code" = #{adCode}) |
| | | </if> |
| | | GROUP BY "res_cd" |
| | | |
| | | |
| | | ) |
| | | UNION ALL |
| | | |
| | | |
| | | -- 渗压水库数 |
| | | SELECT |
| | | COUNT(*) total, |
| | |
| | | ) errorNum |
| | | 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=" adCode!= null and adCode !='' "> |
| | | AND (province."ad_code" =#{adCode} or city."ad_code" = #{adCode} or county."ad_code" = #{adCode}) |
| | | </if> |
| | | GROUP BY "res_cd" |
| | | |
| | | |
| | | ) |
| | | UNION ALL |
| | | |
| | | |
| | | -- 渗流水库数 |
| | | SELECT |
| | | COUNT(*) total, |
| | |
| | | ) errorNum |
| | | 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" >=now()-30 and a."mstm"<= 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=" adCode!= null and adCode !='' "> |
| | | AND (province."ad_code" =#{adCode} or city."ad_code" = #{adCode} or county."ad_code" = #{adCode}) |
| | | </if> |
| | | GROUP BY "res_cd" |
| | | |
| | | |
| | | |
| | | ) |
| | | ) |
| | | ) base |
| | |
| | | arb."center_long" AS longitude, |
| | | arb."center_lat" AS latitude |
| | | 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 |
| | | 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 |
| | | |
| | | <if test="status ==2"> |
| | | AND b."guid" NOT IN ( |
| | | AND dri."res_cd" NOT IN ( |
| | | ifnull( |
| | | ( |
| | | SELECT wm_concat(temp.resCd) |
| | |
| | | </if> |
| | | |
| | | <if test="status == 3"> |
| | | AND b."guid" IN ( |
| | | AND dri."res_cd" IN ( |
| | | ifnull( |
| | | ( |
| | | SELECT wm_concat(temp.resCd) |
| | |
| | | arb."center_long" AS longitude, |
| | | arb."center_lat" AS latitude |
| | | 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" >=now()-30 and a."mstm"<= now() |
| | | |
| | | 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 |
| | | |
| | | <if test="status == 2"> |
| | | AND b."guid" NOT IN ( |
| | | AND dri."res_cd" NOT IN ( |
| | | ifnull( |
| | | (SELECT wm_concat(temp.resCd) FROM |
| | | ( |
| | |
| | | </if> |
| | | |
| | | <if test="status == 3"> |
| | | AND b."guid" IN ( |
| | | AND dri."res_cd" IN ( |
| | | ifnull( |
| | | (SELECT wm_concat(temp.resCd) FROM |
| | | ( |
| | |
| | | ) |
| | | ) |
| | | </if> |
| | | group by b."guid" ) baseRes |
| | | |
| | | ) baseRes |
| | | LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = baseRes."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" |
| | |
| | | arb."center_long" AS longitude, |
| | | arb."center_lat" AS latitude |
| | | 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 |
| | | |
| | | SELECT distinct("res_cd") from sjzt_md."att_wy_cd_base" awcb |
| | | where awcb."cd" != '00' |
| | | |
| | | <if test="status == 2"> |
| | | |
| | | and b."guid" NOT IN ( |
| | | and awcb."res_cd" NOT IN ( |
| | | ifnull( |
| | | ( |
| | | SELECT wm_concat(temp.resCd) FROM( |
| | |
| | | </if> |
| | | <if test="status == 3"> |
| | | |
| | | and b."guid" IN ( |
| | | and awcb."res_cd" IN ( |
| | | ifnull( |
| | | ( |
| | | SELECT wm_concat(temp.resCd) FROM( |
| | |
| | | LEFT JOIN SJZT_MD."att_bas_base" abb ON abb."code" = rrbl."bas_guid" |
| | | LEFT JOIN SJZT_MD."att_bas_base" pabb ON abb."p_code" = pabb."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 DATE_FORMAT(time,'%Y-%m-%d') >= #{dam.startTime} |
| | | </if> |
| | | <if test="dam.endTime != null and dam.endTime !='' "> |
| | | AND DATE_FORMAT(time,'%Y-%m-%d') <= #{dam.endTime} |
| | | </if> |
| | | <if test="dam.startTime != null and dam.startTime != ''"> |
| | | AND time >= #{dam.startTime} |
| | | </if> |
| | | <if test="dam.endTime != null and dam.endTime !='' "> |
| | | AND time <= #{dam.endTime} |
| | | </if> |
| | | |
| | | <if test="dam.engScal != null and dam.engScal !='' "> |
| | | AND arb."eng_scal" = #{dam.engScal} |
| | |
| | | LEFT JOIN SJZT_MD."att_bas_base" abb ON abb."code" = rrbl."bas_guid" |
| | | LEFT JOIN SJZT_MD."att_bas_base" pabb ON abb."p_code" = pabb."code" |
| | | where 1=1 and NAG.level != 5 |
| | | AND (province."ad_code" = #{dam.adCode} or city."ad_code" = #{dam.adCode} or county."ad_code" = #{dam.adCode} or town."ad_code" = #{dam.adCode}) |
| | | |
| | | AND CONCAT(province."ad_code",city."ad_code",county."ad_code",town."ad_code") LIKE CONCAT('%',#{dam.adCode},'%') |
| | | <if test="dam.startTime != null and dam.startTime != ''"> |
| | | AND DATE_FORMAT(time,'%Y-%m-%d') >= #{dam.startTime} |
| | | AND time >= #{dam.startTime} |
| | | </if> |
| | | <if test="dam.endTime != null and dam.endTime !='' "> |
| | | AND DATE_FORMAT(time,'%Y-%m-%d') <= #{dam.endTime} |
| | | AND time <= #{dam.endTime} |
| | | </if> |
| | | |
| | | <if test="dam.engScal != null and dam.engScal !='' "> |
| | |
| | | LEFT JOIN SJZT_MD."att_cd_base" acb ON acb."res_cd" = NAG.DAM_ID AND NAG.POINT_ID = acb."cd" |
| | | WHERE 1=1 and level != 5 |
| | | <if test=" vo.adCode != null and vo.adCode !='' "> |
| | | AND (province."ad_code" =#{vo.adCode} or city."ad_code" = #{vo.adCode} or county."ad_code" = #{vo.adCode}) |
| | | AND CONCAT(province."ad_code",city."ad_code",county."ad_code",town."ad_code") LIKE CONCAT('%',#{vo.adCode},'%') |
| | | </if> |
| | | |
| | | <if test="vo.startTime != null and vo.startTime != ''"> |
| | | AND DATE_FORMAT(NAG.time,'%Y-%m-%d') >= #{vo.startTime} |
| | | AND NAG.time >= #{vo.startTime} |
| | | </if> |
| | | |
| | | <if test="vo.endTime != null and vo.endTime !='' "> |
| | | AND DATE_FORMAT(NAG.time,'%Y-%m-%d') <= #{vo.endTime} |
| | | AND NAG.time <= #{vo.endTime} |
| | | </if> |
| | | |
| | | <if test="vo.level != null and vo.level !='' "> |
| | |
| | | LEFT JOIN SJZT_MD."att_wy_cd_base" awcb ON awcb."res_cd" = NAG.DAM_ID AND NAG.POINT_ID = awcb."cd" |
| | | WHERE 1=1 and level != 5 |
| | | <if test=" vo.adCode != null and vo.adCode !='' "> |
| | | AND (province."ad_code" =#{vo.adCode} or city."ad_code" = #{vo.adCode} or county."ad_code" = #{vo.adCode}) |
| | | AND CONCAT(province."ad_code",city."ad_code",county."ad_code",town."ad_code") LIKE CONCAT('%',#{vo.adCode},'%') |
| | | </if> |
| | | |
| | | <if test="vo.startTime != null and vo.startTime != ''"> |
| | | AND DATE_FORMAT(NAG.time,'%Y-%m-%d') >= #{vo.startTime} |
| | | AND NAG.time >= #{vo.startTime} |
| | | </if> |
| | | |
| | | <if test="vo.endTime != null and vo.endTime !='' "> |
| | | AND DATE_FORMAT(NAG.time,'%Y-%m-%d') <= #{vo.endTime} |
| | | AND NAG.time <= #{vo.endTime} |
| | | </if> |
| | | |
| | | <if test="vo.level != null and vo.level !='' "> |
| | |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | ORDER BY NAG.TIME DESC |
| | | |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="levelMonitorPie" resultType="cn.gistack.sm.damSecurity.vo.LevelPo"> |
| | | |
| | | </select> |
| | | |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | parent."p_ad_name" pAdName |
| | | FROM( |
| | | SELECT |
| | | r.countyCode as adCode, |
| | | r.countyName as adName, |
| | | r.countyCode as adCode, |
| | | count(*) as total, |
| | | '3' AS adGrad |
| | | FROM ( |
| | |
| | | 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 |
| | |
| | | LEFT JOIN SJZT_MD."att_ad_base" province ON province."guid" = city."p_ad_code" )r |
| | | group by r.countyCode,r.countyName)TMP |
| | | LEFT JOIN SJZT_MD."att_ad_base" parent ON parent."guid" = tmp.adCode |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | tmp.*, |
| | | 'sy' as type, |
| | | parent."p_ad_code" pAdCode, |
| | | parent."p_ad_name" pAdName |
| | | FROM( |
| | | SELECT |
| | | r.townName as adName, |
| | | r.townCode as adCode, |
| | | count(*) as total, |
| | | '4' AS adGrad |
| | | FROM ( |
| | | SELECT |
| | | resList."res_cd", |
| | | case when town."ad_grad" = 4 THEN town."ad_code" ELSE NULL END AS townCode, |
| | | case when town."ad_grad" = 4 THEN town."ad_name" ELSE NULL END AS townName, |
| | | case when town."ad_grad" = 3 THEN town."ad_code" |
| | | when county."ad_grad" = 3 THEN county."ad_code" END AS countyCode, |
| | | case when town."ad_grad" = 3 THEN town."ad_name" |
| | | when county."ad_grad" = 3 THEN county."ad_name" END AS countyName, |
| | | case when town."ad_grad" = 2 THEN town."ad_code" |
| | | when county."ad_grad" = 2 THEN county."ad_code" |
| | | ELSE city."ad_code" END AS cityCode, |
| | | case when town."ad_grad" = 2 THEN town."ad_name" |
| | | when county."ad_grad" = 2 THEN county."ad_name" |
| | | ELSE city."ad_name" END AS cityName, |
| | | case when town."ad_grad" = 1 THEN town."ad_code" |
| | | when county."ad_grad" = 1 THEN county."ad_code" |
| | | when city."ad_grad" = 1 THEN city."ad_code" |
| | | ELSE province."ad_code" END AS provinceCode, |
| | | case when town."ad_grad" = 1 THEN town."ad_name" |
| | | when county."ad_grad" = 1 THEN county."ad_name" |
| | | when city."ad_grad" = 1 THEN city."ad_name" |
| | | ELSE province."ad_name" END AS provinceName |
| | | 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=" 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 |
| | | LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = resList."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" )r |
| | | group by r.townName, r.townCode)TMP |
| | | LEFT JOIN SJZT_MD."att_ad_base" parent ON parent."guid" = tmp.adCode |
| | | |
| | | |
| | | </select> |
| | |
| | | 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" >=now()-30 and a."mstm"<= 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 |
| | |
| | | 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" >=now()-30 and a."mstm"<= 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 |
| | |
| | | parent."p_ad_name" pAdName |
| | | FROM( |
| | | SELECT |
| | | r.countyCode as adCode, |
| | | r.countyName as adName, |
| | | r.countyCode as adCode, |
| | | count(*) as total, |
| | | '3' AS adGrad |
| | | FROM ( |
| | |
| | | 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" >=now()-30 and a."mstm"<= 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 |
| | |
| | | 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" )r |
| | | group by r.countyCode,r.countyName)TMP |
| | | LEFT JOIN SJZT_MD."att_ad_base" parent ON parent."guid" = tmp.adCode |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | tmp.*, |
| | | 'sl' as type, |
| | | parent."p_ad_code" pAdCode, |
| | | parent."p_ad_name" pAdName |
| | | FROM( |
| | | SELECT |
| | | r.townName as adName, |
| | | r.townCode as adCode, |
| | | count(*) as total, |
| | | '4' AS adGrad |
| | | FROM ( |
| | | SELECT |
| | | resList."res_cd", |
| | | case when town."ad_grad" = 4 THEN town."ad_code" ELSE NULL END AS townCode, |
| | | case when town."ad_grad" = 4 THEN town."ad_name" ELSE NULL END AS townName, |
| | | case when town."ad_grad" = 3 THEN town."ad_code" |
| | | when county."ad_grad" = 3 THEN county."ad_code" END AS countyCode, |
| | | case when town."ad_grad" = 3 THEN town."ad_name" |
| | | when county."ad_grad" = 3 THEN county."ad_name" END AS countyName, |
| | | case when town."ad_grad" = 2 THEN town."ad_code" |
| | | when county."ad_grad" = 2 THEN county."ad_code" |
| | | ELSE city."ad_code" END AS cityCode, |
| | | case when town."ad_grad" = 2 THEN town."ad_name" |
| | | when county."ad_grad" = 2 THEN county."ad_name" |
| | | ELSE city."ad_name" END AS cityName, |
| | | case when town."ad_grad" = 1 THEN town."ad_code" |
| | | when county."ad_grad" = 1 THEN county."ad_code" |
| | | when city."ad_grad" = 1 THEN city."ad_code" |
| | | ELSE province."ad_code" END AS provinceCode, |
| | | case when town."ad_grad" = 1 THEN town."ad_name" |
| | | when county."ad_grad" = 1 THEN county."ad_name" |
| | | when city."ad_grad" = 1 THEN city."ad_name" |
| | | ELSE province."ad_name" END AS provinceName |
| | | 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=" 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 |
| | | LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = resList."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" )r |
| | | group by r.townCode,r.townName)TMP |
| | | LEFT JOIN SJZT_MD."att_ad_base" parent ON parent."guid" = tmp.adCode |
| | | </select> |
| | | |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | parent."p_ad_name" pAdName |
| | | FROM( |
| | | SELECT |
| | | r.countyCode as adCode, |
| | | r.countyName as adName, |
| | | r.countyCode as adCode, |
| | | count(*) as total, |
| | | '3' AS adGrad |
| | | 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 |
| | |
| | | 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" )r |
| | | group by r.countyCode,r.countyName)TMP |
| | | LEFT JOIN SJZT_MD."att_ad_base" parent ON parent."guid" = tmp.adCode |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | tmp.*, |
| | | 'wy' as type, |
| | | parent."p_ad_code" pAdCode, |
| | | parent."p_ad_name" pAdName |
| | | FROM( |
| | | SELECT |
| | | r.townName as adName, |
| | | r.townCode as adCode, |
| | | count(*) as total, |
| | | '4' AS adGrad |
| | | FROM ( |
| | | SELECT |
| | | resList."res_cd", |
| | | case when town."ad_grad" = 4 THEN town."ad_code" ELSE NULL END AS townCode, |
| | | case when town."ad_grad" = 4 THEN town."ad_name" ELSE NULL END AS townName, |
| | | case when town."ad_grad" = 3 THEN town."ad_code" |
| | | when county."ad_grad" = 3 THEN county."ad_code" END AS countyCode, |
| | | case when town."ad_grad" = 3 THEN town."ad_name" |
| | | when county."ad_grad" = 3 THEN county."ad_name" END AS countyName, |
| | | case when town."ad_grad" = 2 THEN town."ad_code" |
| | | when county."ad_grad" = 2 THEN county."ad_code" |
| | | ELSE city."ad_code" END AS cityCode, |
| | | case when town."ad_grad" = 2 THEN town."ad_name" |
| | | when county."ad_grad" = 2 THEN county."ad_name" |
| | | ELSE city."ad_name" END AS cityName, |
| | | case when town."ad_grad" = 1 THEN town."ad_code" |
| | | when county."ad_grad" = 1 THEN county."ad_code" |
| | | when city."ad_grad" = 1 THEN city."ad_code" |
| | | ELSE province."ad_code" END AS provinceCode, |
| | | case when town."ad_grad" = 1 THEN town."ad_name" |
| | | when county."ad_grad" = 1 THEN county."ad_name" |
| | | when city."ad_grad" = 1 THEN city."ad_name" |
| | | ELSE province."ad_name" END AS provinceName |
| | | 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=" 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 |
| | | LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = resList."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" )r |
| | | group by r.townCode,r.townName)TMP |
| | | LEFT JOIN SJZT_MD."att_ad_base" parent ON parent."guid" = tmp.adCode |
| | | </select> |
| | | |
| | |
| | | parent."p_ad_name" pAdName |
| | | FROM( |
| | | SELECT |
| | | r.countyCode as adCode, |
| | | r.countyName as adName, |
| | | r.countyCode as adCode, |
| | | |
| | | count(*) as total, |
| | | '3' AS adGrad |
| | | FROM ( |
| | |
| | | group by r.countyCode,r.countyName)TMP |
| | | LEFT JOIN SJZT_MD."att_ad_base" parent ON parent."guid" = tmp.adCode |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | tmp.*, |
| | | parent."p_ad_code" pAdCode, |
| | | parent."p_ad_name" pAdName |
| | | FROM( |
| | | SELECT |
| | | r.townName as adName, |
| | | r.townCode as adCode, |
| | | |
| | | count(*) as total, |
| | | '4' AS adGrad |
| | | FROM ( |
| | | SELECT |
| | | resList.resCd, |
| | | case when town."ad_grad" = 4 THEN town."ad_code" ELSE NULL END AS townCode, |
| | | case when town."ad_grad" = 4 THEN town."ad_name" ELSE NULL END AS townName, |
| | | case when town."ad_grad" = 3 THEN town."ad_code" |
| | | when county."ad_grad" = 3 THEN county."ad_code" END AS countyCode, |
| | | case when town."ad_grad" = 3 THEN town."ad_name" |
| | | when county."ad_grad" = 3 THEN county."ad_name" END AS countyName, |
| | | case when town."ad_grad" = 2 THEN town."ad_code" |
| | | when county."ad_grad" = 2 THEN county."ad_code" |
| | | ELSE city."ad_code" END AS cityCode, |
| | | case when town."ad_grad" = 2 THEN town."ad_name" |
| | | when county."ad_grad" = 2 THEN county."ad_name" |
| | | ELSE city."ad_name" END AS cityName, |
| | | case when town."ad_grad" = 1 THEN town."ad_code" |
| | | when county."ad_grad" = 1 THEN county."ad_code" |
| | | when city."ad_grad" = 1 THEN city."ad_code" |
| | | ELSE province."ad_code" END AS provinceCode, |
| | | case when town."ad_grad" = 1 THEN town."ad_name" |
| | | when county."ad_grad" = 1 THEN county."ad_name" |
| | | when city."ad_grad" = 1 THEN city."ad_name" |
| | | ELSE province."ad_name" END AS provinceName |
| | | FROM( |
| | | |
| | | SELECT DAM_ID as resCd FROM YWXT.NKY_ALARM_GET NAG |
| | | LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = NAG.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 1= 1 AND DATE_FORMAT(time,'%Y-%m-%d')>= CURDATE() |
| | | <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.type =='sy' "> |
| | | AND NAG.type = '1' |
| | | </if> |
| | | <if test="dam.type =='sl' "> |
| | | AND NAG.type = '2' |
| | | </if> |
| | | <if test="dam.type =='wy' "> |
| | | AND (NAG.type = '3' or NAG.type ='4' or NAG.type ='5' ) |
| | | </if> |
| | | |
| | | GROUP BY DAM_ID |
| | | ) resList |
| | | LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = resList.resCd |
| | | 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" )r |
| | | group by r.townCode,r.townName)TMP |
| | | LEFT JOIN SJZT_MD."att_ad_base" parent ON parent."guid" = tmp.adCode |
| | | |
| | | |
| | | |
| | | </select> |
| | |
| | | |
| | | |
| | | |
| | | 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" |
| | | |
| | | |
| | | |
| | |
| | | |
| | | 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 |
| | | |
| | | ( |
| | |
| | | parent."p_ad_name" pAdName |
| | | FROM( |
| | | SELECT |
| | | r.countyCode as adCode, |
| | | r.countyName as adName, |
| | | r.countyCode as adCode, |
| | | count(*) as total, |
| | | '3' AS adGrad |
| | | FROM ( |
| | |
| | | |
| | | 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 |
| | | |
| | | ( |
| | |
| | | group by r.countyCode,r.countyName)TMP |
| | | LEFT JOIN SJZT_MD."att_ad_base" parent ON parent."guid" = tmp.adCode |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | tmp.*, |
| | | parent."p_ad_code" pAdCode, |
| | | parent."p_ad_name" pAdName |
| | | FROM( |
| | | SELECT |
| | | r.townName as adName, |
| | | r.townCode as adCode, |
| | | count(*) as total, |
| | | '4' AS adGrad |
| | | FROM ( |
| | | SELECT |
| | | resList.resCd, |
| | | case when town."ad_grad" = 4 THEN town."ad_code" ELSE NULL END AS townCode, |
| | | case when town."ad_grad" = 4 THEN town."ad_name" ELSE NULL END AS townName, |
| | | case when town."ad_grad" = 3 THEN town."ad_code" |
| | | when county."ad_grad" = 3 THEN county."ad_code" END AS countyCode, |
| | | case when town."ad_grad" = 3 THEN town."ad_name" |
| | | when county."ad_grad" = 3 THEN county."ad_name" END AS countyName, |
| | | case when town."ad_grad" = 2 THEN town."ad_code" |
| | | when county."ad_grad" = 2 THEN county."ad_code" |
| | | ELSE city."ad_code" END AS cityCode, |
| | | case when town."ad_grad" = 2 THEN town."ad_name" |
| | | when county."ad_grad" = 2 THEN county."ad_name" |
| | | ELSE city."ad_name" END AS cityName, |
| | | case when town."ad_grad" = 1 THEN town."ad_code" |
| | | when county."ad_grad" = 1 THEN county."ad_code" |
| | | when city."ad_grad" = 1 THEN city."ad_code" |
| | | ELSE province."ad_code" END AS provinceCode, |
| | | case when town."ad_grad" = 1 THEN town."ad_name" |
| | | when county."ad_grad" = 1 THEN county."ad_name" |
| | | when city."ad_grad" = 1 THEN city."ad_name" |
| | | ELSE province."ad_name" END AS provinceName |
| | | FROM( |
| | | |
| | | SELECT normalList."res_cd" as resCd FROM ( |
| | | SELECT allList."res_cd",errorList."name" 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=" 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> |
| | | |
| | | |
| | | |
| | | |
| | | ) allList LEFT JOIN |
| | | |
| | | ( |
| | | SELECT DAM_ID as resCd,arb."name" FROM YWXT.NKY_ALARM_GET NAG |
| | | LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = NAG.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 1= 1 AND DATE_FORMAT(time,'%Y-%m-%d')>= CURDATE() |
| | | <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.type =='sy' "> |
| | | AND NAG.type = '1' |
| | | </if> |
| | | <if test="dam.type =='sl' "> |
| | | AND NAG.type = '2' |
| | | </if> |
| | | <if test="dam.type =='wy' "> |
| | | AND (NAG.type = '3' or NAG.type ='4' or NAG.type ='5' ) |
| | | </if> |
| | | |
| | | GROUP BY DAM_ID,arb."name" |
| | | |
| | | |
| | | ) errorList ON allList."res_cd" = errorList.resCd |
| | | )normalList where normalList."name" is null |
| | | ) resList |
| | | LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = resList.resCd |
| | | 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" )r |
| | | group by r.townCode,r.townName)TMP |
| | | LEFT JOIN SJZT_MD."att_ad_base" parent ON parent."guid" = tmp.adCode |
| | | |
| | | </select> |
| | | <select id="getDamSlRegionNormal" resultType="cn.gistack.sm.damSecurity.vo.DamStatisticsRegion"> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <if test="dam.adCode == '420000000000'"> |
| | | SELECT |
| | | tmp.*, |
| | |
| | | |
| | | |
| | | |
| | | 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" >=now()-30 and a."mstm"<= 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" |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | 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" >=now()-30 and a."mstm"<= 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" |
| | | |
| | | |
| | | |
| | |
| | | parent."p_ad_name" pAdName |
| | | FROM( |
| | | SELECT |
| | | r.countyCode as adCode, |
| | | r.countyName as adName, |
| | | r.countyCode as adCode, |
| | | count(*) as total, |
| | | '3' AS adGrad |
| | | 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" >=now()-30 and a."mstm"<= 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" |
| | | |
| | | |
| | | |
| | |
| | | group by r.countyCode,r.countyName)TMP |
| | | LEFT JOIN SJZT_MD."att_ad_base" parent ON parent."guid" = tmp.adCode |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | tmp.*, |
| | | parent."p_ad_code" pAdCode, |
| | | parent."p_ad_name" pAdName |
| | | FROM( |
| | | SELECT |
| | | r.townName as adName, |
| | | r.townCode as adCode, |
| | | count(*) as total, |
| | | '4' AS adGrad |
| | | FROM ( |
| | | SELECT |
| | | resList.resCd, |
| | | case when town."ad_grad" = 4 THEN town."ad_code" ELSE NULL END AS townCode, |
| | | case when town."ad_grad" = 4 THEN town."ad_name" ELSE NULL END AS townName, |
| | | case when town."ad_grad" = 3 THEN town."ad_code" |
| | | when county."ad_grad" = 3 THEN county."ad_code" END AS countyCode, |
| | | case when town."ad_grad" = 3 THEN town."ad_name" |
| | | when county."ad_grad" = 3 THEN county."ad_name" END AS countyName, |
| | | case when town."ad_grad" = 2 THEN town."ad_code" |
| | | when county."ad_grad" = 2 THEN county."ad_code" |
| | | ELSE city."ad_code" END AS cityCode, |
| | | case when town."ad_grad" = 2 THEN town."ad_name" |
| | | when county."ad_grad" = 2 THEN county."ad_name" |
| | | ELSE city."ad_name" END AS cityName, |
| | | case when town."ad_grad" = 1 THEN town."ad_code" |
| | | when county."ad_grad" = 1 THEN county."ad_code" |
| | | when city."ad_grad" = 1 THEN city."ad_code" |
| | | ELSE province."ad_code" END AS provinceCode, |
| | | case when town."ad_grad" = 1 THEN town."ad_name" |
| | | when county."ad_grad" = 1 THEN county."ad_name" |
| | | when city."ad_grad" = 1 THEN city."ad_name" |
| | | ELSE province."ad_name" END AS provinceName |
| | | FROM( |
| | | SELECT normalList."res_cd" as resCd FROM ( |
| | | SELECT allList."res_cd",errorList."name" 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=" 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> |
| | | |
| | | |
| | | |
| | | ) allList LEFT JOIN |
| | | |
| | | ( |
| | | SELECT DAM_ID as resCd,arb."name" FROM YWXT.NKY_ALARM_GET NAG |
| | | LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = NAG.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 1= 1 AND DATE_FORMAT(time,'%Y-%m-%d')>= CURDATE() |
| | | <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.type =='sy' "> |
| | | AND NAG.type = '1' |
| | | </if> |
| | | <if test="dam.type =='sl' "> |
| | | AND NAG.type = '2' |
| | | </if> |
| | | <if test="dam.type =='wy' "> |
| | | AND (NAG.type = '3' or NAG.type ='4' or NAG.type ='5' ) |
| | | </if> |
| | | |
| | | GROUP BY DAM_ID,arb."name" |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | ) errorList ON allList."res_cd" = errorList.resCd |
| | | )normalList where normalList."name" is null |
| | | ) resList |
| | | LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = resList.resCd |
| | | 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" )r |
| | | group by r.townCode,r.townName)TMP |
| | | LEFT JOIN SJZT_MD."att_ad_base" parent ON parent."guid" = tmp.adCode |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | 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" |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | 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" |
| | | |
| | | |
| | | |
| | |
| | | parent."p_ad_name" pAdName |
| | | FROM( |
| | | SELECT |
| | | r.countyCode as adCode, |
| | | r.countyName as adName, |
| | | r.countyCode as adCode, |
| | | count(*) as total, |
| | | '3' AS adGrad |
| | | 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" |
| | | |
| | | |
| | | |
| | |
| | | group by r.countyCode,r.countyName)TMP |
| | | LEFT JOIN SJZT_MD."att_ad_base" parent ON parent."guid" = tmp.adCode |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | tmp.*, |
| | | parent."p_ad_code" pAdCode, |
| | | parent."p_ad_name" pAdName |
| | | FROM( |
| | | SELECT |
| | | r.townName as adName, |
| | | r.townCode as adCode, |
| | | count(*) as total, |
| | | '4' AS adGrad |
| | | FROM ( |
| | | SELECT |
| | | resList.resCd, |
| | | case when town."ad_grad" = 4 THEN town."ad_code" ELSE NULL END AS townCode, |
| | | case when town."ad_grad" = 4 THEN town."ad_name" ELSE NULL END AS townName, |
| | | case when town."ad_grad" = 3 THEN town."ad_code" |
| | | when county."ad_grad" = 3 THEN county."ad_code" END AS countyCode, |
| | | case when town."ad_grad" = 3 THEN town."ad_name" |
| | | when county."ad_grad" = 3 THEN county."ad_name" END AS countyName, |
| | | case when town."ad_grad" = 2 THEN town."ad_code" |
| | | when county."ad_grad" = 2 THEN county."ad_code" |
| | | ELSE city."ad_code" END AS cityCode, |
| | | case when town."ad_grad" = 2 THEN town."ad_name" |
| | | when county."ad_grad" = 2 THEN county."ad_name" |
| | | ELSE city."ad_name" END AS cityName, |
| | | case when town."ad_grad" = 1 THEN town."ad_code" |
| | | when county."ad_grad" = 1 THEN county."ad_code" |
| | | when city."ad_grad" = 1 THEN city."ad_code" |
| | | ELSE province."ad_code" END AS provinceCode, |
| | | case when town."ad_grad" = 1 THEN town."ad_name" |
| | | when county."ad_grad" = 1 THEN county."ad_name" |
| | | when city."ad_grad" = 1 THEN city."ad_name" |
| | | ELSE province."ad_name" END AS provinceName |
| | | FROM( |
| | | |
| | | SELECT normalList."res_cd" as resCd FROM ( |
| | | SELECT allList."res_cd",errorList."name" 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=" 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> |
| | | |
| | | |
| | | |
| | | ) allList LEFT JOIN |
| | | |
| | | ( |
| | | SELECT DAM_ID as resCd,arb."name" FROM YWXT.NKY_ALARM_GET NAG |
| | | LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = NAG.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 1= 1 AND DATE_FORMAT(time,'%Y-%m-%d')>= CURDATE() |
| | | <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.type =='sy' "> |
| | | AND NAG.type = '1' |
| | | </if> |
| | | <if test="dam.type =='sl' "> |
| | | AND NAG.type = '2' |
| | | </if> |
| | | <if test="dam.type =='wy' "> |
| | | AND (NAG.type = '3' or NAG.type ='4' or NAG.type ='5' ) |
| | | </if> |
| | | |
| | | GROUP BY DAM_ID,arb."name" |
| | | |
| | | |
| | | ) errorList ON allList."res_cd" = errorList.resCd |
| | | )normalList where normalList."name" is null |
| | | ) resList |
| | | LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = resList.resCd |
| | | 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" )r |
| | | group by r.townCode,r.townName)TMP |
| | | LEFT JOIN SJZT_MD."att_ad_base" parent ON parent."guid" = tmp.adCode |
| | | |
| | | |
| | | |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="damResInfoCountSy" resultType="cn.gistack.sm.damSecurity.vo.DamStatisticsRes"> |
| | | |
| | | 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 ( |
| | | select "ad_code","ad_name", |
| | | ( |
| | | select count(*) from ( |
| | | select max(NAG.dam_id) dam_id |
| | | FROM ywxt.NKY_ALARM_GET NAG |
| | | where |
| | | TYPE = 1 |
| | | AND time>= CURDATE() |
| | | group by NAG.dam_id |
| | | ) NAG |
| | | left join sjzt_md."att_res_base" res on (res."guid" = NAG.dam_id) |
| | | left join sjzt_md."att_ad_base" ada on (ada."guid" = res."interior_ad_guid") |
| | | left join sjzt_md."att_ad_base" adb on (adb."guid" = ada."p_ad_code") |
| | | 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 ( |
| | | SELECT a."guid",a."name",a."eng_scal", |
| | | 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" = 3 THEN |
| | | b."ad_code" |
| | | WHEN c."ad_grad" = 3 THEN |
| | | c."ad_code" |
| | | END AS "county_ad_code", |
| | | CASE |
| | | WHEN b."ad_grad" = 3 THEN |
| | | b."ad_name" |
| | | WHEN c."ad_grad" = 3 THEN |
| | | C."ad_name" |
| | | END AS "county_ad_name", |
| | | CASE |
| | | WHEN b."ad_grad" = 3 THEN |
| | | b."order_id" |
| | | WHEN c."ad_grad" = 3 THEN |
| | | C."order_id" |
| | | END AS "county_order_id", |
| | | CASE |
| | | WHEN b."ad_grad" = 2 THEN |
| | | b."ad_code" |
| | | WHEN c."ad_grad" = 2 THEN |
| | | c."ad_code" |
| | | ELSE d."ad_code" |
| | | END AS "city_ad_code", |
| | | CASE |
| | | WHEN b."ad_grad" = 2 THEN |
| | | b."ad_name" |
| | | WHEN c."ad_grad" = 2 THEN |
| | | c."ad_name" |
| | | ELSE d."ad_name" |
| | | END AS "city_ad_name", |
| | | CASE |
| | | WHEN b."ad_grad" = 2 THEN |
| | | b."order_id" |
| | | WHEN c."ad_grad" = 2 THEN |
| | | c."order_id" |
| | | ELSE d."order_id" |
| | | END AS "city_order_id", |
| | | CASE |
| | | WHEN b."ad_grad" = 1 THEN |
| | | b."ad_code" |
| | | WHEN c."ad_grad" = 1 THEN |
| | | c."ad_code" |
| | | WHEN d."ad_grad" = 1 THEN |
| | | d."ad_code" |
| | | ELSE e."ad_code" |
| | | END AS "province_ad_code", |
| | | CASE |
| | | WHEN b."ad_grad" = 1 THEN |
| | | b."ad_name" |
| | | WHEN c."ad_grad" = 1 THEN |
| | | c."ad_name" |
| | | WHEN d."ad_grad" = 1 THEN |
| | | d."ad_name" |
| | | ELSE e."ad_name" |
| | | END AS "province_ad_name", |
| | | 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 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 |
| | | ) |
| | | AND (d."ad_code" = aab."guid" |
| | | OR c."ad_code" = aab."guid" |
| | | OR b."ad_code" = aab."guid" ) |
| | | ) |
| | | ) allNum |
| | | |
| | | FROM SJZT_MD."att_ad_base" aab |
| | | where |
| | | <choose> |
| | | <when test="adCode != null and adCode !='' "> |
| | | "p_ad_code" = #{adCode} |
| | | </when> |
| | | <otherwise> |
| | | "ad_grad" = 2 |
| | | </otherwise> |
| | | </choose> |
| | | ) |
| | | )TMP |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | </select> |
| | | <select id="damResInfoCountSl" resultType="cn.gistack.sm.damSecurity.vo.DamStatisticsRes"> |
| | | |
| | | SELECT '2' 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 ( |
| | | select "ad_code","ad_name", |
| | | ( |
| | | select count(*) from ( |
| | | select max(NAG.dam_id) dam_id |
| | | FROM ywxt.NKY_ALARM_GET NAG |
| | | where TYPE = 2 |
| | | AND time>= CURDATE() |
| | | group by NAG.dam_id |
| | | ) NAG |
| | | left join sjzt_md."att_res_base" res on (res."guid" = NAG.dam_id) |
| | | left join sjzt_md."att_ad_base" ada on (ada."guid" = res."interior_ad_guid") |
| | | left join sjzt_md."att_ad_base" adb on (adb."guid" = ada."p_ad_code") |
| | | 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 ( |
| | | SELECT a."guid",a."name",a."eng_scal", |
| | | 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" = 3 THEN |
| | | b."ad_code" |
| | | WHEN c."ad_grad" = 3 THEN |
| | | c."ad_code" |
| | | END AS "county_ad_code", |
| | | CASE |
| | | WHEN b."ad_grad" = 3 THEN |
| | | b."ad_name" |
| | | WHEN c."ad_grad" = 3 THEN |
| | | C."ad_name" |
| | | END AS "county_ad_name", |
| | | CASE |
| | | WHEN b."ad_grad" = 3 THEN |
| | | b."order_id" |
| | | WHEN c."ad_grad" = 3 THEN |
| | | C."order_id" |
| | | END AS "county_order_id", |
| | | CASE |
| | | WHEN b."ad_grad" = 2 THEN |
| | | b."ad_code" |
| | | WHEN c."ad_grad" = 2 THEN |
| | | c."ad_code" |
| | | ELSE d."ad_code" |
| | | END AS "city_ad_code", |
| | | CASE |
| | | WHEN b."ad_grad" = 2 THEN |
| | | b."ad_name" |
| | | WHEN c."ad_grad" = 2 THEN |
| | | c."ad_name" |
| | | ELSE d."ad_name" |
| | | END AS "city_ad_name", |
| | | CASE |
| | | WHEN b."ad_grad" = 2 THEN |
| | | b."order_id" |
| | | WHEN c."ad_grad" = 2 THEN |
| | | c."order_id" |
| | | ELSE d."order_id" |
| | | END AS "city_order_id", |
| | | CASE |
| | | WHEN b."ad_grad" = 1 THEN |
| | | b."ad_code" |
| | | WHEN c."ad_grad" = 1 THEN |
| | | c."ad_code" |
| | | WHEN d."ad_grad" = 1 THEN |
| | | d."ad_code" |
| | | ELSE e."ad_code" |
| | | END AS "province_ad_code", |
| | | CASE |
| | | WHEN b."ad_grad" = 1 THEN |
| | | b."ad_name" |
| | | WHEN c."ad_grad" = 1 THEN |
| | | c."ad_name" |
| | | WHEN d."ad_grad" = 1 THEN |
| | | d."ad_name" |
| | | ELSE e."ad_name" |
| | | END AS "province_ad_name", |
| | | 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_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 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 |
| | | ( |
| | | g."res_cd" is NOT null |
| | | ) |
| | | AND (d."ad_code" = aab."guid" |
| | | OR c."ad_code" = aab."guid" |
| | | OR b."ad_code" = aab."guid" ) |
| | | ) |
| | | ) allNum |
| | | |
| | | FROM SJZT_MD."att_ad_base" aab |
| | | where |
| | | <choose> |
| | | <when test="adCode != null and adCode !='' "> |
| | | "p_ad_code" = #{adCode} |
| | | </when> |
| | | <otherwise> |
| | | "ad_grad" = 2 |
| | | </otherwise> |
| | | </choose> |
| | | ) |
| | | )TMP |
| | | |
| | | |
| | | </select> |
| | | <select id="damResInfoCountWy" resultType="cn.gistack.sm.damSecurity.vo.DamStatisticsRes"> |
| | | |
| | | |
| | | SELECT '3' 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 ( |
| | | select "ad_code","ad_name", |
| | | ( |
| | | select count(*) from ( |
| | | select max(NAG.dam_id) dam_id |
| | | FROM ywxt.NKY_ALARM_GET NAG |
| | | where (TYPE = 3 or type = 4 or type = 5) |
| | | AND time>= CURDATE() |
| | | group by NAG.dam_id |
| | | ) NAG |
| | | left join sjzt_md."att_res_base" res on (res."guid" = NAG.dam_id) |
| | | left join sjzt_md."att_ad_base" ada on (ada."guid" = res."interior_ad_guid") |
| | | left join sjzt_md."att_ad_base" adb on (adb."guid" = ada."p_ad_code") |
| | | 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 ( |
| | | SELECT a."guid",a."name",a."eng_scal", |
| | | 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" = 3 THEN |
| | | b."ad_code" |
| | | WHEN c."ad_grad" = 3 THEN |
| | | c."ad_code" |
| | | END AS "county_ad_code", |
| | | CASE |
| | | WHEN b."ad_grad" = 3 THEN |
| | | b."ad_name" |
| | | WHEN c."ad_grad" = 3 THEN |
| | | C."ad_name" |
| | | END AS "county_ad_name", |
| | | CASE |
| | | WHEN b."ad_grad" = 3 THEN |
| | | b."order_id" |
| | | WHEN c."ad_grad" = 3 THEN |
| | | C."order_id" |
| | | END AS "county_order_id", |
| | | CASE |
| | | WHEN b."ad_grad" = 2 THEN |
| | | b."ad_code" |
| | | WHEN c."ad_grad" = 2 THEN |
| | | c."ad_code" |
| | | ELSE d."ad_code" |
| | | END AS "city_ad_code", |
| | | CASE |
| | | WHEN b."ad_grad" = 2 THEN |
| | | b."ad_name" |
| | | WHEN c."ad_grad" = 2 THEN |
| | | c."ad_name" |
| | | ELSE d."ad_name" |
| | | END AS "city_ad_name", |
| | | CASE |
| | | WHEN b."ad_grad" = 2 THEN |
| | | b."order_id" |
| | | WHEN c."ad_grad" = 2 THEN |
| | | c."order_id" |
| | | ELSE d."order_id" |
| | | END AS "city_order_id", |
| | | CASE |
| | | WHEN b."ad_grad" = 1 THEN |
| | | b."ad_code" |
| | | WHEN c."ad_grad" = 1 THEN |
| | | c."ad_code" |
| | | WHEN d."ad_grad" = 1 THEN |
| | | d."ad_code" |
| | | ELSE e."ad_code" |
| | | END AS "province_ad_code", |
| | | CASE |
| | | WHEN b."ad_grad" = 1 THEN |
| | | b."ad_name" |
| | | WHEN c."ad_grad" = 1 THEN |
| | | c."ad_name" |
| | | WHEN d."ad_grad" = 1 THEN |
| | | d."ad_name" |
| | | ELSE e."ad_name" |
| | | END AS "province_ad_name", |
| | | 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("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" |
| | | 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 |
| | | ( |
| | | h."res_cd" is NOT null |
| | | ) |
| | | AND (d."ad_code" = aab."guid" |
| | | OR c."ad_code" = aab."guid" |
| | | OR b."ad_code" = aab."guid" ) |
| | | ) |
| | | ) allNum |
| | | |
| | | FROM SJZT_MD."att_ad_base" aab |
| | | where |
| | | <choose> |
| | | <when test="adCode != null and adCode !='' "> |
| | | "p_ad_code" = #{adCode} |
| | | </when> |
| | | <otherwise> |
| | | "ad_grad" = 2 |
| | | </otherwise> |
| | | </choose> |
| | | ) |
| | | )TMP |
| | | </select> |
| | | <select id="getLatestResRecord" resultType="cn.gistack.nky.vo.AlarmGetVO"> |
| | | SELECT |
| | | NAG.DAM_ID, |
| | | NAG.POINT_ID, |
| | | NAG.TYPE, |
| | | NAG.TIME, |
| | | NAG.VALUE, |
| | | NAG."DESC", |
| | | NAG.CREATE_TIME, |
| | | NAG.TASK_CATEGORY, |
| | | NAG.LEVEL, |
| | | NAG.BAOJINGZHI, |
| | | NAG.ORIGIN_ID, |
| | | NAG.FORWARD, |
| | | NAG."REVERSE", |
| | | NAG.RATIO, |
| | | |
| | | ARB."name" reservoirName, |
| | | acb."cd_nm" cdName, |
| | | |
| | | case when town."ad_grad" = 4 THEN town."ad_code" ELSE NULL END AS townCode, |
| | | case when town."ad_grad" = 4 THEN town."ad_name" ELSE NULL END AS townName, |
| | | case |
| | | when town."ad_grad" = 3 THEN town."ad_code" |
| | | when county."ad_grad" = 3 THEN county."ad_code" END AS countyCode, |
| | | case |
| | | when town."ad_grad" = 3 THEN town."ad_name" |
| | | when county."ad_grad" = 3 THEN county."ad_name" END AS countyName, |
| | | case |
| | | when town."ad_grad" = 2 THEN town."ad_code" |
| | | when county."ad_grad" = 2 THEN county."ad_code" |
| | | ELSE city."ad_code" END AS cityCode, |
| | | case |
| | | when town."ad_grad" = 2 THEN town."ad_name" |
| | | when county."ad_grad" = 2 THEN county."ad_name" |
| | | ELSE city."ad_name" END AS cityName |
| | | |
| | | FROM YWXT.NKY_ALARM_GET NAG |
| | | right JOIN ( |
| | | SELECT |
| | | NAG.DAM_ID, |
| | | NAG.POINT_ID, |
| | | MAX(NAG.TIME)TIME, |
| | | NAG.TYPE |
| | | FROM YWXT.NKY_ALARM_GET NAG |
| | | LEFT JOIN SJZT_MD."att_res_base" arb on arb."guid" = nag.dam_id |
| | | |
| | | WHERE |
| | | dam_id = #{alarmGet.damId} |
| | | and type = #{alarmGet.type} |
| | | GROUP BY |
| | | NAG.DAM_ID, |
| | | NAG.POINT_ID, |
| | | NAG.TYPE |
| | | |
| | | )TMP ON ( |
| | | TMP.DAM_ID = NAG.DAM_ID |
| | | AND TMP.POINT_ID = NAG.POINT_ID |
| | | AND TMP.TYPE = NAG.TYPE |
| | | AND TMP.TIME = NAG.TIME |
| | | ) |
| | | LEFT JOIN SJZT_MD."att_res_base" arb on arb."guid" = NAG.DAM_ID |
| | | |
| | | LEFT JOIN SJZT_MD."att_ad_base" town ON town."ad_code" = arb."interior_ad_guid" |
| | | LEFT JOIN SJZT_MD."att_ad_base" county ON county."ad_code" = town."p_ad_code" |
| | | LEFT JOIN SJZT_MD."att_ad_base" city ON city."ad_code" = county."p_ad_code" |
| | | |
| | | LEFT JOIN SJZT_MD."att_cd_base" acb on |
| | | acb."res_cd" = #{alarmGet.damId} |
| | | and acb."cd" = nag.point_id |
| | | <if test="alarmGet.type == 1"> |
| | | and acb."cd_type" = 'sy' |
| | | </if> |
| | | <if test="alarmGet.type == 2"> |
| | | and acb."cd_type" = 'sl' |
| | | </if> |
| | | ORDER BY POINT_ID |
| | | </select> |
| | | <select id="getLatestResRecordWy" resultType="cn.gistack.nky.vo.AlarmGetVO"> |
| | | SELECT |
| | | NAG.DAM_ID, |
| | | NAG.POINT_ID, |
| | | NAG.TYPE, |
| | | NAG.TIME, |
| | | NAG.VALUE, |
| | | NAG."DESC", |
| | | NAG.CREATE_TIME, |
| | | NAG.TASK_CATEGORY, |
| | | NAG.LEVEL, |
| | | NAG.BAOJINGZHI, |
| | | NAG.ORIGIN_ID, |
| | | NAG.FORWARD, |
| | | NAG."REVERSE", |
| | | NAG.RATIO, |
| | | |
| | | ARB."name" reservoirName, |
| | | acb."cd_nm" cdName, |
| | | |
| | | case when town."ad_grad" = 4 THEN town."ad_code" ELSE NULL END AS townCode, |
| | | case when town."ad_grad" = 4 THEN town."ad_name" ELSE NULL END AS townName, |
| | | case |
| | | when town."ad_grad" = 3 THEN town."ad_code" |
| | | when county."ad_grad" = 3 THEN county."ad_code" END AS countyCode, |
| | | case |
| | | when town."ad_grad" = 3 THEN town."ad_name" |
| | | when county."ad_grad" = 3 THEN county."ad_name" END AS countyName, |
| | | case |
| | | when town."ad_grad" = 2 THEN town."ad_code" |
| | | when county."ad_grad" = 2 THEN county."ad_code" |
| | | ELSE city."ad_code" END AS cityCode, |
| | | case |
| | | when town."ad_grad" = 2 THEN town."ad_name" |
| | | when county."ad_grad" = 2 THEN county."ad_name" |
| | | ELSE city."ad_name" END AS cityName |
| | | |
| | | FROM YWXT.NKY_ALARM_GET NAG |
| | | right JOIN ( |
| | | SELECT |
| | | NAG.DAM_ID, |
| | | NAG.POINT_ID, |
| | | MAX(NAG.TIME)TIME, |
| | | MAX(NAG.CREATE_TIME) CREATE_TIME, |
| | | NAG.TYPE |
| | | FROM YWXT.NKY_ALARM_GET NAG |
| | | LEFT JOIN SJZT_MD."att_res_base" arb on arb."guid" = nag.dam_id |
| | | |
| | | WHERE |
| | | dam_id = #{alarmGet.damId} |
| | | and (type = '3' or type = '4' or type = '5') |
| | | GROUP BY |
| | | NAG.DAM_ID, |
| | | NAG.POINT_ID, |
| | | NAG.TYPE |
| | | |
| | | )TMP ON ( |
| | | TMP.DAM_ID = NAG.DAM_ID |
| | | AND TMP.POINT_ID = NAG.POINT_ID |
| | | AND TMP.TYPE = NAG.TYPE |
| | | AND TMP.TIME = NAG.TIME |
| | | AND TMP.CREATE_TIME = NAG.CREATE_TIME |
| | | ) |
| | | LEFT JOIN SJZT_MD."att_res_base" arb on arb."guid" = NAG.DAM_ID |
| | | |
| | | LEFT JOIN SJZT_MD."att_ad_base" town ON town."ad_code" = arb."interior_ad_guid" |
| | | LEFT JOIN SJZT_MD."att_ad_base" county ON county."ad_code" = town."p_ad_code" |
| | | LEFT JOIN SJZT_MD."att_ad_base" city ON city."ad_code" = county."p_ad_code" |
| | | |
| | | LEFT JOIN SJZT_MD."att_wy_cd_base" acb on |
| | | acb."res_cd" = #{alarmGet.damId} |
| | | and acb."cd" = nag.point_id |
| | | and acb."cd_type" = 'wy' |
| | | ORDER BY POINT_ID |
| | | </select> |
| | | |
| | | |