MessageDao.xml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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="platform.modules.sys.dao.MessageDao">
  4. <!-- 查找对应单位的消息列表 -->
  5. <select id="findMessageList" resultType="platform.modules.sys.entity.Message">
  6. SELECT
  7. m.*,
  8. d.is_read as is_read,
  9. d.id as message_detail_id
  10. from c_message_detail d
  11. left join c_message m on d.message_id = m.id
  12. where m.del_flag=0 and d.del_flag=0
  13. <if test="push_id != null and push_id != '' and push_user_id != null and push_user_id != ''">
  14. and (d.push_id = #{push_id} or d.push_user_id = #{push_user_id})
  15. </if>
  16. <if test="push_id != null and push_id != '' and (push_user_id == null or push_user_id == '')">
  17. and d.push_id = #{push_id}
  18. </if>
  19. <if test="push_user_id != null and push_user_id != '' and (push_id == null or push_id == '')">
  20. and d.push_id = #{push_user_id}
  21. </if>
  22. <if test="push_user_type != null and push_user_type != ''">
  23. and d.user_type = #{push_user_type}
  24. </if>
  25. <if test="business_type != null and business_type != ''">
  26. and m.business_type = #{business_type}
  27. </if>
  28. <if test="keyword != null and keyword != ''">
  29. and m.title LIKE CONCAT ('%',#{keyword},'%')
  30. </if>
  31. <if test="is_read != null ">
  32. and d.is_read = #{is_read}
  33. </if>
  34. order by d.create_time desc
  35. </select>
  36. <!-- 首页查询我的消息列表 -->
  37. <select id="findMyMessageList" resultType="platform.modules.sys.entity.Message">
  38. SELECT
  39. m.*,
  40. d.is_read as is_read,
  41. d.id as message_detail_id
  42. from c_message_detail d
  43. left join c_message m on d.message_id = m.id
  44. where m.del_flag=0 and d.del_flag=0 and d.is_read = 0
  45. <if test="push_id != null and push_id != ''">
  46. and d.push_id = #{push_id}
  47. </if>
  48. <if test="push_user_id != null and push_user_id != ''">
  49. and d.push_id = #{push_user_id}
  50. </if>
  51. <if test="push_user_type != null and push_user_type != ''">
  52. and d.user_type = #{push_user_type}
  53. </if>
  54. order by d.create_time desc
  55. limit 0,5
  56. </select>
  57. <select id="findMyUnreadMessageList" resultType="platform.modules.sys.entity.Message">
  58. SELECT
  59. m.*
  60. from c_message_detail d
  61. left join c_message m on d.message_id = m.id
  62. where m.del_flag=0 and d.del_flag=0
  63. <if test="push_id != null and push_id != ''">
  64. and d.push_id = #{push_id}
  65. </if>
  66. <if test="push_user_id != null and push_user_id != ''">
  67. and d.push_id = #{push_user_id}
  68. </if>
  69. <if test="push_user_type != null and push_user_type != ''">
  70. and d.user_type = #{push_user_type}
  71. </if>
  72. and d.is_read = 0
  73. </select>
  74. <select id="selectByBusinessTypeAndApplyId" resultType="platform.modules.sys.entity.Message">
  75. SELECT
  76. *
  77. from c_message
  78. where business_type = #{businessType}
  79. and apply_id = #{applyId}
  80. </select>
  81. </mapper>