mitao
2025-06-11 0184bf471382f9328df9bdd47acf451e4e2c5cb0
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
95
96
97
98
99
100
101
102
103
104
105
106
<?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.sinata.system.mapper.MwWarningRecordMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.sinata.system.domain.MwWarningRecord">
        <id column="ID" property="id" />
        <result column="DEL_FLAG" property="delFlag" />
        <result column="CREATE_BY" property="createBy" />
        <result column="CREATE_TIME" property="createTime" />
        <result column="UPDATE_BY" property="updateBy" />
        <result column="UPDATE_TIME" property="updateTime" />
        <result column="WARN_TIME" property="warnTime" />
        <result column="WARNING_TARGET_ID" property="warningTargetId" />
        <result column="WARNING_TARGET_NAME" property="warningTargetName" />
        <result column="TYPE" property="type" />
        <result column="MESSAGE" property="message" />
        <result column="STATUS" property="status" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        DEL_FLAG,
        CREATE_BY,
        CREATE_TIME,
        UPDATE_BY,
        UPDATE_TIME,
        ID, WARN_TIME, WARNING_TARGET_ID, WARNING_TARGET_NAME, TYPE, MESSAGE, STATUS
    </sql>
    <select id="pageList" resultType="com.sinata.system.domain.vo.MwWarningRecordVO">
        SELECT MWR.ID,
        MWR.WARN_TIME,
        MWR.WARNING_TARGET_ID,
        MWR.WARNING_TARGET_NAME,
        MWR.TYPE,
        MWR.MESSAGE,
        MWR.STATUS,
        MWR.DEL_FLAG,
        MWR.CREATE_BY,
        MWR.CREATE_TIME,
        MWR.UPDATE_BY,
        MWR.UPDATE_TIME,
        MWR.DEPARTMENT_ID,
        MWR.CURRENT_VALUE,
        MWR.NORMAL_RANGE,
        MWR.DEPARTMENT_NAME
        FROM MW_WARNING_RECORD MWR
        LEFT JOIN SYS_DEPARTMENT SD ON SD.ID = MWR.DEPARTMENT_ID
        <where>
            MWR.DEL_FLAG = 0
            <if test="treeCode != null and treeCode != ''">
                AND SD.TREE_CODE LIKE CONCAT(#{treeCode}, '%')
            </if>
            <if test="query.type !=null">
                AND MWR.TYPE = #{query.type}
            </if>
            <if test="query.status != null">
                AND MWR.STATUS = #{query.status}
            </if>
            <if test="query.startTime != null and query.endTime !=null">
                AND MWR.WARN_TIME BETWEEN #{query.startTime} AND #{query.endTime}
            </if>
        </where>
        ORDER BY MWR.CREATE_TIME DESC
    </select>
    <select id="queryList" resultType="com.sinata.system.domain.vo.MwWarningRecordVO">
        SELECT MWR.ID,
        MWR.WARN_TIME,
        MWR.WARNING_TARGET_ID,
        MWR.WARNING_TARGET_NAME,
        MWR.TYPE,
        MWR.MESSAGE,
        MWR.STATUS,
        MWR.DEL_FLAG,
        MWR.CREATE_BY,
        MWR.CREATE_TIME,
        MWR.UPDATE_BY,
        MWR.UPDATE_TIME,
        MWR.DEPARTMENT_ID,
        MWR.CURRENT_VALUE,
        MWR.NORMAL_RANGE,
        MWR.DEPARTMENT_NAME
        FROM MW_WARNING_RECORD MWR
        LEFT JOIN SYS_DEPARTMENT SD ON SD.ID = MWR.DEPARTMENT_ID
        <where>
            MWR.DEL_FLAG = 0
            <if test="treeCode != null and treeCode != ''">
                AND SD.TREE_CODE LIKE CONCAT(#{treeCode}, '%')
            </if>
            <if test="query.type !=null">
                AND MWR.TYPE = #{query.type}
            </if>
            <if test="query.status != null">
                AND MWR.STATUS = #{query.status}
            </if>
            <if test="query.idList != null and query.idList.size()>0">
                AND MWR.ID IN
                <foreach collection="query.idList" item="id" open="(" separator="," close=")">
                    #{id}
                </foreach>
            </if>
        </where>
        ORDER BY MWR.CREATE_TIME DESC
    </select>
 
</mapper>