|
|
|
@ -20,6 +20,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
<result property="status" column="status" /> |
|
|
|
<result property="status" column="status" /> |
|
|
|
<result property="batch" column="batch" /> |
|
|
|
<result property="batch" column="batch" /> |
|
|
|
<result property="message" column="message" /> |
|
|
|
<result property="message" column="message" /> |
|
|
|
|
|
|
|
<result property="alertRuleId" column="alert_rule_id" /> |
|
|
|
|
|
|
|
|
|
|
|
</resultMap> |
|
|
|
</resultMap> |
|
|
|
|
|
|
|
|
|
|
|
<select id="selectMaxBatch" resultType="integer"> |
|
|
|
<select id="selectMaxBatch" resultType="integer"> |
|
|
|
@ -30,12 +32,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
|
|
|
|
|
|
|
|
<insert id="batchInsert" parameterType="java.util.List"> |
|
|
|
<insert id="batchInsert" parameterType="java.util.List"> |
|
|
|
INSERT INTO alert_message |
|
|
|
INSERT INTO alert_message |
|
|
|
(equ_id, type, equ_type, solution, level, occur_time, handler, handle_time, status,batch,message) |
|
|
|
(equ_id, type, equ_type, solution, level, occur_time, handler, handle_time, status,batch,message,alert_rule_id) |
|
|
|
VALUES |
|
|
|
VALUES |
|
|
|
<foreach collection="list" item="msg" separator=","> |
|
|
|
<foreach collection="list" item="msg" separator=","> |
|
|
|
(#{msg.equId},#{msg.type}, #{msg.equType}, |
|
|
|
(#{msg.equId},#{msg.type}, #{msg.equType}, |
|
|
|
#{msg.solution}, #{msg.level}, #{msg.occurTime}, |
|
|
|
#{msg.solution}, #{msg.level}, #{msg.occurTime}, |
|
|
|
#{msg.handler}, #{msg.handleTime}, #{msg.status}, #{msg.batch}, #{msg.message}) |
|
|
|
#{msg.handler}, #{msg.handleTime}, #{msg.status}, #{msg.batch}, #{msg.message}, #{msg.alertRuleId}) |
|
|
|
</foreach> |
|
|
|
</foreach> |
|
|
|
</insert> |
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
|
|
@ -86,21 +88,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
</select> |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询最新预警信息(按时间排序,取前N条) --> |
|
|
|
<!-- 查询最新预警信息(按时间排序,取前N条) --> |
|
|
|
|
|
|
|
<!-- <select id="selectStaticAlertMessageList" resultType="homeEquAlertMessageVo">--> |
|
|
|
|
|
|
|
<!-- SELECT--> |
|
|
|
|
|
|
|
<!-- a.level,--> |
|
|
|
|
|
|
|
<!-- a.occur_time AS occurTime,--> |
|
|
|
|
|
|
|
<!-- a.status,--> |
|
|
|
|
|
|
|
<!-- a.message,--> |
|
|
|
|
|
|
|
<!-- e.name,--> |
|
|
|
|
|
|
|
<!-- e.location--> |
|
|
|
|
|
|
|
<!-- FROM alert_message a--> |
|
|
|
|
|
|
|
<!-- LEFT JOIN equ_base e ON a.equ_id = e.id--> |
|
|
|
|
|
|
|
<!-- ORDER BY a.occur_time DESC--> |
|
|
|
|
|
|
|
<!-- </select>--> |
|
|
|
|
|
|
|
<!-- 查询最新预警信息(按时间排序,取前N条),关联规则名称 --> |
|
|
|
<select id="selectStaticAlertMessageList" resultType="homeEquAlertMessageVo"> |
|
|
|
<select id="selectStaticAlertMessageList" resultType="homeEquAlertMessageVo"> |
|
|
|
SELECT |
|
|
|
SELECT |
|
|
|
a.level, |
|
|
|
a.level, |
|
|
|
a.occur_time AS occurTime, |
|
|
|
a.occur_time AS occurTime, |
|
|
|
a.status, |
|
|
|
a.status, |
|
|
|
a.message, |
|
|
|
a.message, |
|
|
|
e.name, |
|
|
|
e.name, |
|
|
|
e.location |
|
|
|
e.location, |
|
|
|
|
|
|
|
r.rule_name AS ruleName <!-- 新增字段 --> |
|
|
|
FROM alert_message a |
|
|
|
FROM alert_message a |
|
|
|
LEFT JOIN equ_base e ON a.equ_id = e.id |
|
|
|
LEFT JOIN equ_base e ON a.equ_id = e.id |
|
|
|
|
|
|
|
LEFT JOIN alert_rule r ON a.alert_rule_id = r.id <!-- 新增关联 --> |
|
|
|
ORDER BY a.occur_time DESC |
|
|
|
ORDER BY a.occur_time DESC |
|
|
|
</select> |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectAlertMessageById" parameterType="Long" resultMap="AlertMessageResult"> |
|
|
|
<select id="selectAlertMessageById" parameterType="Long" resultMap="AlertMessageResult"> |
|
|
|
<include refid="selectAlertMessageVo"/> |
|
|
|
<include refid="selectAlertMessageVo"/> |
|
|
|
where am.id = #{id} |
|
|
|
where am.id = #{id} |
|
|
|
|