| | |
| | | order by sar.id desc |
| | | </select> |
| | | |
| | | <!--按行政区code 查询下级行政区--> |
| | | <select id="getAdNameList" resultType="java.lang.String"> |
| | | select "ad_name" from SJZT_MD."att_ad_base" where "p_ad_code" = #{adCode} order by "guid" |
| | | </select> |
| | | |
| | | <!--查询告警统计数据--> |
| | | <select id="statisticAlarmRecord" resultType="cn.gistack.alerts.alarmRule.vo.StatisticAlarmRecord"> |
| | | select cityName as adName,rule_name as ruleName,count(*) num from ( |
| | | select |
| | | sar.id,sar.alarm_rule_id,sar.create_time,sar.reservoir_number, |
| | | arb."name", |
| | | e.rule_name, |
| | | case when b."ad_grad" = 4 THEN b."ad_name" ELSE NULL END AS townName, |
| | | case when b."ad_grad" = 3 THEN b."ad_name" |
| | | when c."ad_grad" = 3 THEN c."ad_name" END AS countyName, |
| | | case when b."ad_grad" = 3 THEN b."ad_code" |
| | | when c."ad_grad" = 3 THEN c."ad_code" END AS countyCode, |
| | | 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 cityCode, |
| | | 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 cityName |
| | | from YWXT.sm_alarm_record sar |
| | | left join SJZT_MD."att_res_base" arb on arb."guid" = sar.reservoir_number |
| | | left join SJZT_MD."att_ad_base" b ON arb."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 YWXT.sm_alarm_rule e on e.id = sar.alarm_rule_id |
| | | where sar.is_deleted = 0 |
| | | <if test="alarmRecord.reservoirName!=null and alarmRecord.reservoirName!=''"> |
| | | and arb."name" like concat('%',#{alarmRecord.reservoirName},'%') |
| | | </if> |
| | | <if test="alarmRecord.type!=null and alarmRecord.type!=''"> |
| | | and e.type = #{alarmRecord.type} |
| | | </if> |
| | | <if test="alarmRecord.alarmRuleType!=null and alarmRecord.alarmRuleType!=''"> |
| | | and e.alarm_rule_type = #{alarmRecord.alarmRuleType} |
| | | </if> |
| | | <if test="alarmRecord.createAlarmType!=null and alarmRecord.createAlarmType!=''"> |
| | | and e.create_alarm_type = #{alarmRecord.createAlarmType} |
| | | </if> |
| | | <if test="alarmRecord.ruleName!=null and alarmRecord.ruleName!=''"> |
| | | and e.rule_name = #{alarmRecord.ruleName} |
| | | </if> |
| | | <if test="alarmRecord.startTime!=null and alarmRecord.startTime!=''"> |
| | | and date_format(sar.create_time,'%Y-%m-%d') >= #{alarmRecord.startTime} |
| | | </if> |
| | | <if test="alarmRecord.endTime!=null and alarmRecord.endTime!=''"> |
| | | and date_format(sar.create_time,'%Y-%m-%d') <= #{alarmRecord.endTime} |
| | | </if> |
| | | ) f |
| | | group by cityName,rule_name |
| | | </select> |
| | | |
| | | <!--查询符合条件的告警类型--> |
| | | <select id="listAlarmRule" resultType="cn.gistack.alerts.alarmRule.entity.AlarmRule"> |
| | | select * from YWXT.sm_alarm_rule where is_deleted = 0 |
| | | <if test="alarmRecord.type!=null and alarmRecord.type!=''"> |
| | | and type = #{alarmRecord.type} |
| | | </if> |
| | | <if test="alarmRecord.alarmRuleType!=null and alarmRecord.alarmRuleType!=''"> |
| | | and alarm_rule_type = #{alarmRecord.alarmRuleType} |
| | | </if> |
| | | <if test="alarmRecord.createAlarmType!=null and alarmRecord.createAlarmType!=''"> |
| | | and create_alarm_type = #{alarmRecord.createAlarmType} |
| | | </if> |
| | | <if test="alarmRecord.ruleName!=null and alarmRecord.ruleName!=''"> |
| | | and rule_name = #{alarmRecord.ruleName} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |