MsgWebPushMapper.xml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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.mapper.MsgWebPushMapper">
  4. <select id="webAlarmNum" parameterType="java.lang.String" resultType="java.lang.Integer">
  5. select count(1) from msg_web_push where status = 1
  6. <if test="userId != null and userId != ''">
  7. and receive_by = #{userId}
  8. </if>
  9. </select>
  10. <select id="webAlarm" parameterType="java.lang.String" resultType="com.ozs.entity.MsgAlarm">
  11. select b.*, a.push_id as msgId
  12. from msg_web_push AS a
  13. join msg_alarm AS b on a.alarm_id = b.alarm_id
  14. where a.status = 1
  15. <if test="userId != null and userId != ''">
  16. and a.receive_by = #{userId}
  17. </if>
  18. </select>
  19. <select id="messageMore" parameterType="com.ozs.entity.vo.MsgAlarmVo" resultType="com.ozs.entity.MsgAlarm">
  20. select b.*, a.status, a.push_id as msgId
  21. from msg_web_push AS a
  22. join msg_alarm AS b on a.alarm_id = b.alarm_id
  23. join base_camera_management AS c on b.camera_code = c.camera_code
  24. <where>
  25. <if test="userId != null and userId != ''">
  26. and a.receive_by = #{userId}
  27. </if>
  28. <if test="status != null and status != ''">
  29. and a.status = #{status}
  30. </if>
  31. <if test="alarmType != null and alarmType != ''">
  32. and b.alarm_type = #{alarmType}
  33. </if>
  34. <if test="beginAlarmTime != null and beginAlarmTime != ''">
  35. and b.alarm_time &gt;= #{beginAlarmTime}
  36. </if>
  37. <if test="endAlarmTime != null and endAlarmTime != ''">
  38. and b.alarm_time &lt;= #{endAlarmTime}
  39. </if>
  40. <if test="isLock != null and isLock != ''">
  41. and b.is_lock = #{isLock}
  42. </if>
  43. <if test="railwayCode != null and railwayCode != ''">
  44. and c.railway_code = #{railwayCode}
  45. </if>
  46. <if test="beginMile != null and beginMile != ''">
  47. and c.begin_mile &gt;= #{beginMile}
  48. </if>
  49. <if test="endMile != null and endMile != ''">
  50. and c.end_mile &lt;= #{endMile}
  51. </if>
  52. </where>
  53. </select>
  54. <select id="messageMoreNum" parameterType="com.ozs.entity.vo.MsgAlarmVo" resultType="java.util.Map">
  55. select count(1) count, SUM(CASE status WHEN '1' THEN 1 ELSE 0 end) AS 'noCount' from msg_web_push
  56. <where>
  57. <if test="userId != null and userId != ''">
  58. and receive_by = #{userId}
  59. </if>
  60. </where>
  61. </select>
  62. <update id="updateByPushId" parameterType="com.ozs.entity.MsgWebPush">
  63. update msg_web_push
  64. <set>
  65. <if test="status != null and status != 0">
  66. status = #{status}
  67. </if>
  68. </set>
  69. <where>
  70. <if test="pushId != null and pushId != ''">
  71. and push_id = #{pushId}
  72. </if>
  73. <if test="id != null and id != 0">
  74. and id = #{id}
  75. </if>
  76. </where>
  77. </update>
  78. <update id="readAll" parameterType="java.lang.String">
  79. update msg_web_push
  80. <set>
  81. status = 2
  82. </set>
  83. where receive_by = #{userId} and status = 1
  84. </update>
  85. </mapper>