zxl
2026-03-25 d1dfb6e35f38e27fd960dc3ad0130c8d0f5c39bb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?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 &lt;= #{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>