FaultInfoMapper.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.FaultInfoMapper">
  4. <select id="queryFaultInfo" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
  5. SELECT
  6. h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
  7. s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
  8. s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
  9. s.alertText,s.modelId
  10. FROM
  11. faulthistory h left join faultsnap s on h.snapid = s.id
  12. <where>
  13. 1=1
  14. <if test="starttime !=null and endtime !=null">
  15. and h.faulttime &gt;= #{starttime} and h.faulttime &lt;= #{endtime}
  16. </if>
  17. <if test="stid !=null and stid !=''">
  18. and s.stationid=#{stid}
  19. </if>
  20. <if test="keyword !=null and keyword !=''">
  21. and s.alerttext like #{keyword}
  22. </if>
  23. <if test="messageType !=null and messageType !=''">
  24. and h.messagetype = #{messageType}
  25. </if>
  26. <if test="likeString !=null and likeString !=''">
  27. and (s.alerttext like '%故障停机状态%' or s.alerttext like '%总故障%')
  28. </if>
  29. </where>
  30. order by h.faultTime desc
  31. </select>
  32. <select id="getFaultInfoByIds" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
  33. SELECT
  34. h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
  35. s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
  36. s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
  37. s.alertText,s.modelId
  38. FROM
  39. faulthistory h left join faultsnap s on h.snapid = s.id
  40. where h.id in
  41. <foreach collection="array" item="ids" index="index" open="(" close=")" separator=",">
  42. #{ids}
  43. </foreach>
  44. order by h.faultTime desc
  45. </select>
  46. <select id="getRecentFault" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
  47. SELECT
  48. h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
  49. s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
  50. s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
  51. (concat(concat(s.alertText,''),h.ALERTTEXTLAST)) AS alertText,s.modelId
  52. FROM
  53. faulthistory h left join faultsnap s on h.snapid = s.id
  54. WHERE
  55. h.confirmType = 0
  56. AND s.isopened = 1
  57. AND h.messageType = 1
  58. AND h.faultTime >= #{faulttime}
  59. order by h.faultTime desc
  60. </select>
  61. <select id="getTopNumFault" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
  62. select * from (
  63. SELECT
  64. h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
  65. s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
  66. s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
  67. (concat(concat(s.alertText,''),h.ALERTTEXTLAST)) AS alertText,s.modelId
  68. FROM
  69. faulthistory h left join faultsnap s on h.snapid = s.id
  70. order by h.faultTime desc)
  71. where rownum &lt;= #{topnum}
  72. </select>
  73. <select id="queryFaultInfo1" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
  74. SELECT
  75. h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
  76. s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
  77. s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
  78. (concat(concat(s.alertText,''),h.ALERTTEXTLAST)) AS alertText,s.modelId
  79. FROM
  80. faulthistory h left join faultsnap s on h.snapid = s.id
  81. <where>
  82. 1=1
  83. <if test="starttime !=null and endtime !=null">
  84. and h.faulttime &gt;= #{starttime} and h.faulttime &lt;= #{endtime}
  85. </if>
  86. <if test="stid !=null and stid !=''">
  87. and s.stationid=#{stid}
  88. </if>
  89. <if test="keyword !=null and keyword !=''">
  90. and s.alerttext like #{keyword}
  91. </if>
  92. <if test="category1 !=null and category1 !=''">
  93. and s.category1=#{category1}
  94. </if>
  95. <if test="isopened !=null ">
  96. and s.isopened=#{isopened}
  97. </if>
  98. </where>
  99. order by h.faultTime desc
  100. </select>
  101. </mapper>