xieb
2023-10-19 1dd5d8f8a616f5cf3caa7828d46989c7d3dcafc4
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
<?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="cn.gistack.nky.mapper.AlarmGetMapper">
 
    <resultMap id="vo" type="cn.gistack.nky.vo.AlarmGetVO">
        <id column="id" property="id"/>
        <result property="damId" column="dam_id"/>
        <result property="type" column="type"/>
        <result property="status" column="status"/>
        <result property="baojingzhi" column="baojingzhi"/>
        <result property="createTime" column="create_time"/>
        <result property="desc" column="desc"/>
        <result property="level" column="level"/>
        <result property="originId" column="origin_id"/>
        <result property="pointId" column="point_id"/>
        <result property="value" column="value"/>
        <result property="time" column="time"/>
        <result property="taskCategory" column="task_category"/>
        <result property="forward" column="forward" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
        <result property="reverse" column="reverse" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
        <result property="ratio" column="ratio" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
    </resultMap>
 
 
    <select id="getAlarmDetail" resultMap="vo">
        SELECT * FROM NKY_ALARM_GET
        WHERE 1=1
        <if test="vo.startTime != null and vo.startTime != ''">
            AND DATE_FORMAT(time,'%Y-%m-%d')  &gt;= #{vo.startTime}
        </if>
        <if test="vo.endTime != null and vo.endTime !='' ">
            AND DATE_FORMAT(time,'%Y-%m-%d') &lt;= #{vo.endTime}
        </if>
        <if test="vo.level != null and vo.level !='' ">
            AND level = #{vo.level}
        </if>
        <if test="vo.status != null and vo.status !='' ">
            AND status = #{vo.status}
        </if>
        <if test="vo.type != null and vo.type !='' ">
            AND type = #{vo.type}
        </if>
        AND dam_id =  #{vo.damId}
    </select>
    <select id="getAlarmDetailPage" resultType="cn.gistack.nky.vo.AlarmGetVO">
        SELECT
            ID,DAM_ID,POINT_ID,TYPE,
            (
                CASE
                    WHEN TYPE=1 THEN '渗压'
                    WHEN TYPE=2 THEN '渗流'
                    WHEN (TYPE=3 OR TYPE=4 OR TYPE=5) THEN '位移'
                END) AS typeName,
            "TIME","VALUE","DESC",CREATE_TIME,TASK_CATEGORY,"LEVEL",BAOJINGZHI,ORIGIN_ID,FORWARD,"REVERSE",RATIO,STATUS
 
        FROM YWXT.NKY_ALARM_GET
        WHERE 1=1
        <if test="vo.startTime != null and vo.startTime != ''">
            AND DATE_FORMAT(time,'%Y-%m-%d')  &gt;= #{vo.startTime}
        </if>
        <if test="vo.endTime != null and vo.endTime !='' ">
            AND DATE_FORMAT(time,'%Y-%m-%d') &lt;= #{vo.endTime}
        </if>
        <if test="vo.level != null and vo.level !='' ">
            AND level = #{vo.level}
        </if>
        <if test="vo.status != null and vo.status !='' ">
            AND status = #{vo.status}
        </if>
        <if test="vo.type != null and vo.type !='' and vo.type == 1 ">
            AND type = #{vo.type}
        </if>
        <if test="vo.type != null and vo.type !='' and vo.type == 2">
            AND type = #{vo.type}
        </if>
        <if test="vo.type != null and vo.type !='' and vo.type == 3">
            AND (type = '3' or type = '4' or type = '5')
        </if>
        <if test="vo.pointId != null and vo.pointId !='' ">
            AND POINT_id = #{vo.pointId}
        </if>
        AND dam_id =  #{vo.damId}
    </select>
</mapper>