dongyukun
2025-01-24 ae3258f8191e911c697249476747d016a75922c5
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
<?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.iailab.module.model.mcs.sche.dao.StScheduleSchemeDao">
 
    <select id="getAlarmAndSuggestPage" resultType="com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestRespVO">
        select
        t.type,
        t.title,
        t.content,
        t.time,
        t.obj
        from (
                 select 'alarm' type, t1.title, t1.content, t1.alarm_time `time`, t1.alarm_obj obj
                 from t_mm_predict_alarm_message t1
                 UNION
                 select 'suggest' type, t2.title, t2.content, t2.schedule_time `time`, t2.schedule_obj obj
                 from t_st_schedule_suggest t2
        ) t
        <where>
            <if test="params.obj != null and params.obj != ''">
                and t.obj = #{params.obj}
            </if>
            <if test="params.type != null and params.type != ''">
                and t.type = #{params.type}
            </if>
            <if test="params.objs != null and !params.objs.isEmpty()">
                and t.obj in
                <foreach item="obj" collection="params.objs" open="(" separator="," close=")">
                    #{obj}
                </foreach>
            </if>
            <if test="params.startTime != null">
                and t.time &gt;= #{params.startTime}
            </if>
            <if test="params.endTime != null">
                and t.time &lt;= #{params.endTime}
            </if>
            <if test="params.objList != null">
                and t.obj in
                <foreach collection="params.objList" item="item" open="(" close=")" separator=",">
                    #{item}
                </foreach>
            </if>
        </where>
        order by t.time desc
 
    </select>
</mapper>