<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.tievd.jyz.mapper.OiloutEventMapper">
|
|
<select id="oilOutStatis" parameterType="map" resultType="java.util.Map">
|
select
|
a.algorithm_name algorithmName,
|
a.phrase,
|
count(IF(e.event_type=2,1,null)) eventCount,
|
FLOOR(count(IF(e.event_type=2,1,null))/count(e.id)*100) percent
|
from t_sys_algorithm_item a
|
LEFT JOIN t_oilout_event e on e.algorithm_code=a.algorithm_code
|
where a.region=1
|
<if test="orgCode!=null and orgCode!=''">and e.org_code like concat(#{orgCode}, '%')</if>
|
<if test="startTime!=null and startTime!=''">and e.event_time >= #{startTime}</if>
|
<if test="endTime!=null and endTime!=''">and e.event_time <= #{endTime}</if>
|
GROUP BY a.sort;
|
</select>
|
|
<select id="monthlyAlarmCount" parameterType="map" resultType="int">
|
select
|
count(1)
|
from
|
t_oilout_event toe
|
where
|
toe.org_code like concat(#{orgCode}, '%')
|
and date_format(TOE.event_time, '%Y-%m') = #{date}
|
and event_type = 2
|
</select>
|
|
<select id="alarmStat" parameterType="map" resultType="com.tievd.jyz.entity.vo.AlarmOverviewVO">
|
select
|
count(toe.id) alarmCount,
|
count(toe.audit_time) dealedAlarmCount,
|
count(if(toe.audit_result = 1, 1, null)) confirmedAlarmCount
|
from
|
t_oilout_event toe
|
where
|
toe.org_code like concat(#{orgCode}, '%')
|
and date_format(TOE.event_time, '%Y-%m-%d') = #{date}
|
and event_type = 2
|
</select>
|
|
<select id="alarmStatRange" parameterType="map" resultType="com.tievd.jyz.dto.AlarmStatDTO">
|
select
|
count(toe.id) alarmCount,
|
count(if(toe.audit_result = 1, 1, null)) confirmedAlarmCount,
|
a.date
|
from
|
(
|
select
|
date_format(date_add(#{endDay}, interval -t.help_topic_id day), '%Y-%m-%d') as 'date'
|
from
|
mysql.help_topic t
|
where
|
t.help_topic_id <![CDATA[ < ]]> #{intervalDay}
|
) as a
|
left join t_oilout_event toe on toe.event_day = a.date
|
and toe.org_code = #{orgCode}
|
and toe.event_type = 2
|
group by a.date
|
order by a.date asc
|
</select>
|
|
<select id="alarmTrendStatRange" parameterType="map" resultType="com.tievd.jyz.dto.AlarmStatDTO">
|
select
|
count(toe.id) oiloutEventAlarmCount,
|
a.date
|
from
|
(
|
select
|
date_format(date_add(#{endDay}, interval -t.help_topic_id day), '%Y-%m-%d') as 'date'
|
from
|
mysql.help_topic t
|
where t.help_topic_id <![CDATA[ < ]]> #{intervalDay}
|
) as a
|
left join t_oilout_event toe on toe.event_day = a.date
|
and toe.org_code like concat(#{orgCode}, '%')
|
and toe.event_type = 2
|
group by a.date
|
order by a.date asc
|
</select>
|
</mapper>
|