| | |
| | | </select> |
| | | <select id="tableResCount" resultType="cn.gistack.sm.damSecurity.vo.DamStationStatistics"> |
| | | |
| | | SELECT info."guid",info."name",info."eng_scal",info."town_ad_code",info."town_ad_name",info."county_ad_code",info."county_ad_name",info."city_ad_code",info."city_ad_name", |
| | | (info.wy+info.sy+info.sl) total,(info.wy+info.sy+info.sl-info.errorNum) normalNum,info.errorNum FROM |
| | | SELECT |
| | | info."guid" AS resCd, |
| | | 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 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", |
| | |
| | | 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" ) |
| | | GROUP BY "res_cd" |
| | | ) sl ON sl."res_cd" = baseRes."guid" |
| | | LEFT JOIN ( SELECT DAM_ID ,COUNT(*) errorNum FROM YWXT.NKY_ALARM_GET GROUP BY "DAM_ID" ) alarm ON alarm.DAM_ID = 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} |
| | | </if> |
| | | <if test="dam.endTime != null and dam.endTime !='' "> |
| | | AND DATE_FORMAT(time,'%Y-%m-%d') <= #{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 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> |
| | | 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" |
| | |
| | | <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 |
| | | |
| | | </select> |
| | | |
| | | <select id="tableResCountPage" resultType="cn.gistack.sm.damSecurity.vo.DamStationStatistics"> |
| | | |
| | | SELECT |