zhitong.yu
7 天以前 7fc9c42987a13c1d8d2159591a5803e70518827f
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
84
85
86
87
88
89
90
91
92
93
94
package com.hxzk.gps.mapper.Warning;
 
import com.hxzk.gps.entity.Warning.TbWarning;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
 
import java.util.List;
 
/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author YuZhiTong
 * @since 2025-05-23
 */
public interface TbWarningMapper extends BaseMapper<TbWarning> {
    //查询当前登录用户公司下的告警列表信息
 
    List<TbWarning> FindWarningInfo(@Param("CompanyName") String CompanyName, @Param("objectid")String objectid, @Param("baoliu10")String baoliu10,@Param("type")String type);
 
    List<TbWarning> FindWarningUntreated(@Param("companyIds") List companyIds,@Param("status")String status);
 
 
    /*
    * 获取统计页面告警数据
    * */
    @Select("<script>"
            + "select count(*) from tb_warning w "
            + "inner join tb_person p on p.p_tagid = w.`objectid` "
            + "where w.type = #{type} "
            + "and p.companyid in "
            + "<foreach item='item' collection='companyids' open='(' separator=',' close=')'>"
            + "#{item}"
            + "</foreach>"
            + "</script>")
    Integer FindDayCountInfo(@Param("type")String type,@Param("companyids")List companyids);
 
    /*
     * 获取统计页面告警数据(日期筛选)
     * */
    @Select({
            "<script>",
            "SELECT count(*) FROM tb_warning w ",
            "INNER JOIN tb_person p ON p.p_tagid = w.objectid ",
            "WHERE w.type = #{type} AND p.company = #{company} ",
            "<if test='timeRange != null'>",
            "   AND w.time >= ",
            "   <choose>",
            "       <when test='timeRange == 1'>DATE_SUB(NOW(), INTERVAL 1 DAY)</when>",
            "       <when test='timeRange == 2'>DATE_SUB(NOW(), INTERVAL 30 DAY)</when>",
            "       <when test='timeRange == 3'>DATE_SUB(NOW(), INTERVAL 3 MONTH)</when>",
            "       <when test='timeRange == 4'>DATE_SUB(NOW(), INTERVAL 6 MONTH)</when>",
            "       <when test='timeRange == 5'>DATE_SUB(NOW(), INTERVAL 1 YEAR)</when>",
            "   </choose>",
            "</if>",
            "</script>"
    })
    Integer FindDayDateCountInfo(
            @Param("type") String type,
            @Param("company") String company,
            @Param("timeRange") Integer timeRange
    );
 
 
 
    /*
    * 统计分析所有告警功能
    * */
    @Select(" SELECT w.id, w.type, w.objectid, w.status, w.time, w.baoliu1, w.baoliu2, w.baoliu3, w.baoliu4, w.baoliu5, w.baoliu6,w.baoliu7, p.p_name as baoliu10\n" +
            " FROM tb_warning w" +
            " INNER JOIN tb_person p on p.p_tagid = w.objectid" +
            " WHERE p.company = #{CompanyName}")
    public List<TbWarning> FindWarningAll(@Param("CompanyName") String CompanyName);
 
    @Select("<script>" +
            "SELECT w.id, w.type, w.objectid, w.status, w.time, w.baoliu1, w.baoliu2, w.baoliu3, w.baoliu4, w.baoliu5, w.baoliu6, w.baoliu7, p.p_name as baoliu10 " +
            "FROM tb_warning w " +
            "INNER JOIN tb_person p ON p.p_tagid = w.objectid " +
            "WHERE w.status = '未处理' and p.companyid IN " +
            "<foreach item='company' collection='Companyids' open='(' separator=',' close=')'>" +
            "   #{company}" +
            "</foreach>" +
            " AND w.type = #{type}" +
            "</script>")
    public List<TbWarning> FindWarningInfoType(@Param("Companyids") List Companyids,@Param("type") String type);
 
    /*
    * 获取引擎更新时间
    * */
    @Select("select addtime from warn_tongji limit 0,1")
    String FindCSDATE();
}