Commit cf40a06d by 罗绍泽

主题查询bug修复

parent 07d9f753
......@@ -22,6 +22,9 @@
<sql id="where_topic_reply">
<where>
<trim prefixOverrides="AND |OR">
<if test="CONTENT_LIKE != null and CONTENT_LIKE != ''">
and ftr.CONTENT LIKE #{CONTENT_LIKE}
</if>
<if test="UUID != null and UUID != ''">
and ftr.UUID = #{UUID}
</if>
......@@ -44,13 +47,17 @@
uu1.USER_NAME AS POST_USER_NAME,
uu2.USER_NAME AS CREATE_USER_NAME,
uu3.USER_NAME AS UPDATE_USER_NAME,
IFNULL(vtr.reply_count,0) AS REPLY_COUNT
IFNULL(reply.reply_count,0) AS REPLY_COUNT
FROM FORUM_TOPIC ft
LEFT JOIN forum_classify fc ON ft.classify_id = fc.uuid
LEFT JOIN uicm_user uu1 ON ft.post_user = uu1.USER_ID
LEFT JOIN uicm_user uu2 ON ft.CREATE_ID = uu2.USER_ID
LEFT JOIN uicm_user uu3 ON ft.UPDATE_ID = uu3.USER_ID
LEFT JOIN view_forum_topic_reply vtr ON vtr.topic_id = ft.uuid
LEFT JOIN (
SELECT topic_id,COUNT(*) as reply_count
FROM forum_topic_reply
GROUP BY topic_id
) reply ON reply.topic_id = ft.uuid
]]>
<include refid="where_topic" />
ORDER BY ft.stick_flag DESC,ft.post_time DESC
......@@ -64,7 +71,11 @@
LEFT JOIN uicm_user uu1 ON ft.post_user = uu1.USER_ID
LEFT JOIN uicm_user uu2 ON ft.CREATE_ID = uu2.USER_ID
LEFT JOIN uicm_user uu3 ON ft.UPDATE_ID = uu3.USER_ID
LEFT JOIN view_forum_topic_reply vtr ON vtr.topic_id = ft.uuid
LEFT JOIN (
SELECT topic_id,COUNT(*) as reply_count
FROM forum_topic_reply
GROUP BY topic_id
) reply ON reply.topic_id = ft.uuid
]]>
<include refid="where_topic" />
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment