| | |
| | | ) |
| | | )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> |
| | | |
| | | |
| | | </mapper> |