123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?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.gyee.wisdom.alarm.sharding.mapper.FaultInfoMapper">
- <select id="queryFaultInfo" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
- SELECT
- h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
- s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
- s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
- s.alertText,s.modelId
- FROM
- faulthistory h left join faultsnap s on h.snapid = s.id
- <where>
- 1=1
- <if test="starttime !=null and endtime !=null">
- and h.faulttime >= #{starttime} and h.faulttime <= #{endtime}
- </if>
- <if test="stid !=null and stid !=''">
- and s.stationid=#{stid}
- </if>
- <if test="keyword !=null and keyword !=''">
- and s.alerttext like #{keyword}
- </if>
- <if test="messageType !=null and messageType !=''">
- and h.messagetype = #{messageType}
- </if>
- <if test="likeString !=null and likeString !=''">
- and (s.alerttext like '%故障停机状态%' or s.alerttext like '%总故障%')
- </if>
- </where>
- order by h.faultTime desc
- </select>
- <select id="getFaultInfoByIds" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
- SELECT
- h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
- s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
- s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
- s.alertText,s.modelId
- FROM
- faulthistory h left join faultsnap s on h.snapid = s.id
- where h.id in
- <foreach collection="array" item="ids" index="index" open="(" close=")" separator=",">
- #{ids}
- </foreach>
- order by h.faultTime desc
- </select>
- <select id="getRecentFault" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
- SELECT
- h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
- s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
- s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
- (concat(concat(s.alertText,''),h.ALERTTEXTLAST)) AS alertText,s.modelId
- FROM
- faulthistory h left join faultsnap s on h.snapid = s.id
- WHERE
- h.confirmType = 0
- AND s.isopened = 1
- AND h.messageType = 1
- AND h.faultTime >= #{faulttime}
- order by h.faultTime desc
- </select>
- <select id="getTopNumFault" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
- select * from (
- SELECT
- h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
- s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
- s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
- (concat(concat(s.alertText,''),h.ALERTTEXTLAST)) AS alertText,s.modelId
- FROM
- faulthistory h left join faultsnap s on h.snapid = s.id
- order by h.faultTime desc)
- where rownum <= #{topnum}
- </select>
- <select id="queryFaultInfo1" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
- SELECT
- h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
- s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
- s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
- (concat(concat(s.alertText,''),h.ALERTTEXTLAST)) AS alertText,s.modelId
- FROM
- faulthistory h left join faultsnap s on h.snapid = s.id
- <where>
- 1=1
- <if test="starttime !=null and endtime !=null">
- and h.faulttime >= #{starttime} and h.faulttime <= #{endtime}
- </if>
- <if test="stid !=null and stid !=''">
- and s.stationid=#{stid}
- </if>
- <if test="keyword !=null and keyword !=''">
- and s.alerttext like #{keyword}
- </if>
- <if test="category1 !=null and category1 !=''">
- and s.category1=#{category1}
- </if>
- <if test="isopened !=null ">
- and s.isopened=#{isopened}
- </if>
- </where>
- order by h.faultTime desc
- </select>
- </mapper>
|