ActivityFeedbackDao.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="platform.modules.sys.dao.ActivityFeedbackDao">
  6. <select id="findPage" parameterType="java.lang.Integer" resultType="platform.modules.sys.entity.ActivityFeedback">
  7. SELECT
  8. feedback.content content,
  9. zuser.nick_name name,
  10. feedback.feedback_time feedback_time
  11. FROM
  12. ac_activity_feedback feedback
  13. LEFT JOIN z_user zuser ON feedback.user_id = zuser.id
  14. WHERE
  15. feedback.activity_id = #{activityId}
  16. ORDER BY
  17. feedback.create_time DESC
  18. </select>
  19. <select id="findFeedbackList" resultType="platform.modules.sys.entity.ActivityFeedback">
  20. select
  21. af.id,
  22. af.user_id,
  23. af.user_type,
  24. af.content,
  25. af.feedback_time,
  26. af.feedback_type,
  27. ad.activity_title,
  28. af.create_name,
  29. af.create_time,
  30. af.is_view,
  31. af.approval_status
  32. from ac_activity_feedback af
  33. left join ac_activity_detail ad on ad .id = af.activity_id
  34. where
  35. af.del_flag = 0 <!-- AND af.feedback_type != 0 -->
  36. <if test="query.is_front!= null and query.is_front != ''">
  37. and af.approval_status = 1
  38. </if>
  39. <if test="query.activity_id!= null and query.activity_id != ''">
  40. and af.activity_id = #{query.activity_id}
  41. </if>
  42. <if test="query.feedback_type != null and query.feedback_type != ''">
  43. and af.feedback_type = #{query.feedback_type}
  44. </if>
  45. <if test="query.approval_status != null and query.approval_status != ''">
  46. and af.approval_status = #{query.approval_status}
  47. </if>
  48. <if test="query.activity_title != null and query.activity_title != ''">
  49. and ad.activity_title LIKE CONCAT('%',#{query.activity_title},'%')
  50. </if>
  51. ORDER BY af.create_time DESC
  52. </select>
  53. <select id="findFeedbackTypelist" resultType="platform.modules.sys.entity.ActivityFeedback">
  54. select COUNT( af.id ) as feedback_count, feedback_type from ac_activity_feedback WHERE del_flag = 0
  55. <if test="query.feedback_type != null and query.feedback_type != ''">
  56. and feedback_type = #{query.feedback_type}
  57. </if>
  58. group by feedback_type
  59. </select>
  60. <select id="findCountByFeedbackType" resultType="platform.modules.sys.entity.ActivityFeedback">
  61. select COUNT( id ) AS feedback_count from ac_activity_feedback WHERE del_flag = 0
  62. <if test="query.feedback_type != null and query.feedback_type != ''">
  63. and feedback_type = #{query.feedback_type}
  64. </if>
  65. <if test="query.approval_status != null and query.approval_status != ''">
  66. and approval_status = #{query.approval_status}
  67. </if>
  68. <if test="query.is_view != null and query.is_view != ''">
  69. and is_view = #{query.is_view}
  70. </if>
  71. </select>
  72. <select id="findAvgStar" resultType="java.lang.Double">
  73. SELECT
  74. IFNULL(AVG( feedback_type ), 0)
  75. FROM
  76. ac_activity_feedback
  77. WHERE
  78. del_flag = 0
  79. AND activity_id = #{activity_id}
  80. </select>
  81. <select id="findUserFeedback" resultType="platform.modules.sys.entity.ActivityFeedback">
  82. select * from ac_activity_feedback where activity_id = #{id} AND user_id = #{userId} AND feedback_type != 0
  83. </select>
  84. <select id="feedbackList" resultType="platform.modules.sys.entity.ActivityFeedback">
  85. SELECT
  86. *
  87. FROM
  88. ac_activity_feedback
  89. WHERE
  90. del_flag = 0
  91. AND activity_id = #{activity_id}
  92. <if test="is_public != null and is_public != ''">
  93. AND is_public = #{is_public}
  94. </if>
  95. <if test="is_view != null and is_view != ''">
  96. AND is_view = #{is_view}
  97. </if>
  98. <if test="minScore != null and minScore != ''">
  99. AND score <![CDATA[>]]> #{minScore}
  100. </if>
  101. <if test="maxScore != null and maxScore != ''">
  102. AND score <![CDATA[<=]]> #{maxScore}
  103. </if>
  104. ORDER BY is_top DESC
  105. </select>
  106. <select id="feedbackPage" resultType="platform.modules.sys.entity.ActivityFeedback">
  107. SELECT
  108. *
  109. FROM
  110. ac_activity_feedback
  111. WHERE
  112. del_flag = 0
  113. AND
  114. activity_id = #{activity_id}
  115. <if test="minScore != null and minScore != ''">
  116. AND score <![CDATA[>]]> #{minScore}
  117. </if>
  118. <if test="maxScore != null and maxScore != ''">
  119. AND score <![CDATA[<=]]> #{maxScore}
  120. </if>
  121. ORDER BY
  122. feedback_time DESC
  123. </select>
  124. </mapper>