MsgWebPushMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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.ozs.service.mapper.MsgWebPushMapper">
  4. <select id="webAlarmNum" parameterType="java.lang.String" resultType="java.lang.Integer">
  5. select count(*) from msg_web_push where status = 1 and receive_by in
  6. <foreach item="item" collection="userIds" separator="," open="(" close=")" index="">
  7. #{item}
  8. </foreach>
  9. </select>
  10. <select id="webAlarm" parameterType="java.lang.String" resultType="com.ozs.service.entity.MsgAlarm">
  11. select b.* from (
  12. select alarm_id from msg_web_push where status = 1 and receive_by in
  13. <foreach item="item" collection="userIds" separator="," open="(" close=")" index="">
  14. #{item}
  15. </foreach>
  16. ) a left join (
  17. select * from msg_alarm
  18. ) b on a.alarm_id = b.alarm_id
  19. </select>
  20. <select id="messageMoreByUserIds" parameterType="java.util.List" resultType="java.lang.String">
  21. select alarm_id from msg_web_push where status = #{status} and receive_by in
  22. <foreach item="item" collection="userIds" index="index" separator="," open="(" close=")">
  23. #{item}
  24. </foreach>
  25. </select>
  26. <select id="messageMore" parameterType="com.ozs.service.entity.vo.MsgAlarmVo" resultType="com.ozs.service.entity.MsgAlarm">
  27. select b.* from (
  28. select alarm_id from msg_web_push
  29. <where>
  30. <if test="status != null and status != ''">
  31. and status = #{status}
  32. </if>
  33. <if test="userIds != null and userIds != ''">
  34. and receive_by in
  35. <foreach item="item" collection="userIds" index="index" separator="," open="(" close=")">
  36. #{item}
  37. </foreach>
  38. </if>
  39. </where>
  40. ) a left join (
  41. select * from msg_alarm
  42. <where>
  43. <if test="alarmType != null and alarmType != ''">
  44. and alarm_type = #{alarmType}
  45. </if>
  46. <if test="beginAlarmTime != null and beginAlarmTime != ''">
  47. and alarm_time &gt;= #{beginAlarmTime}
  48. </if>
  49. <if test="endAlarmTime != null and endAlarmTime != ''">
  50. and alarm_time &lt;= #{endAlarmTime}
  51. </if>
  52. <if test="isLock != null and isLock != ''">
  53. and is_lock = #{isLock}
  54. </if>
  55. </where>
  56. ) b on a.alarm_id = b.alarm_id left join (
  57. select * from base_camera_management
  58. <where>
  59. <if test="railwayCode != null and railwayCode != ''">
  60. and railway_code = #{railwayCode}
  61. </if>
  62. <if test="beginMile != null and beginMile != ''">
  63. and begin_mile &gt;= #{beginMile}
  64. </if>
  65. <if test="endMile != null and endMile != ''">
  66. and end_mile &lt;= #{endMile}
  67. </if>
  68. </where>
  69. ) c on b.camera_code = c.camera_code
  70. </select>
  71. <select id="messageMoreCount" parameterType="com.ozs.service.entity.vo.MsgAlarmVo" resultType="java.lang.Integer">
  72. select count(b.*) from (
  73. select alarm_id from msg_web_push
  74. <where>
  75. <if test="status != null and status != ''">
  76. and status = #{status}
  77. </if>
  78. <if test="userIds != null and userIds != ''">
  79. and receive_by in
  80. <foreach item="item" collection="userIds" index="index" separator="," open="(" close=")">
  81. #{item}
  82. </foreach>
  83. </if>
  84. </where>
  85. ) a left join (
  86. select * from msg_alarm
  87. <where>
  88. <if test="alarmType != null and alarmType != ''">
  89. and alarm_type = #{alarmType}
  90. </if>
  91. <if test="beginAlarmTime != null and beginAlarmTime != ''">
  92. and alarm_time &gt;= #{beginAlarmTime}
  93. </if>
  94. <if test="endAlarmTime != null and endAlarmTime != ''">
  95. and alarm_time &lt;= #{endAlarmTime}
  96. </if>
  97. <if test="isLock != null and isLock != ''">
  98. and is_lock = #{isLock}
  99. </if>
  100. </where>
  101. ) b on a.alarm_id = b.alarm_id left join (
  102. select * from base_camera_management
  103. <where>
  104. <if test="railwayCode != null and railwayCode != ''">
  105. and railway_code = #{railwayCode}
  106. </if>
  107. <if test="beginMile != null and beginMile != ''">
  108. and begin_mile &gt;= #{beginMile}
  109. </if>
  110. <if test="endMile != null and endMile != ''">
  111. and end_mile &lt;= #{endMile}
  112. </if>
  113. </where>
  114. ) c on b.camera_code = c.camera_code
  115. </select>
  116. <select id="messageMoreNum" parameterType="com.ozs.service.entity.vo.MsgAlarmVo" resultType="java.util.Map">
  117. select count(id) count, SUM(CASE status WHEN '1' THEN 1 ELSE 0 end) AS 'noCount' from msg_web_push
  118. <where>
  119. <if test="userIds != null and userIds != ''">
  120. and receive_by in
  121. <foreach item="item" collection="userIds" index="index" separator="," open="(" close=")">
  122. #{item}
  123. </foreach>
  124. </if>
  125. </where>
  126. </select>
  127. </mapper>