🎨 评论管理功能优化

This commit is contained in:
ronger 2021-06-28 09:57:08 +08:00
parent a7e0f7feee
commit 62d67e70b6
2 changed files with 5 additions and 2 deletions

View File

@ -42,4 +42,6 @@ public class CommentDTO {
private Author commenter; private Author commenter;
private String timeAgo; private String timeAgo;
private String articleTitle;
} }

View File

@ -28,6 +28,7 @@
<result column="comment_reply_count" property="commentReplyCount"></result> <result column="comment_reply_count" property="commentReplyCount"></result>
<result column="comment_visible" property="commentVisible"></result> <result column="comment_visible" property="commentVisible"></result>
<result column="created_time" property="createdTime"></result> <result column="created_time" property="createdTime"></result>
<result column="article_title" property="articleTitle"></result>
</resultMap> </resultMap>
<resultMap id="AuthorResultMap" type="com.rymcu.forest.dto.Author"> <resultMap id="AuthorResultMap" type="com.rymcu.forest.dto.Author">
<result column="id" property="idUser"/> <result column="id" property="idUser"/>
@ -39,7 +40,7 @@
update forest_comment set comment_sharp_url = #{commentSharpUrl} where id = #{idComment} update forest_comment set comment_sharp_url = #{commentSharpUrl} where id = #{idComment}
</update> </update>
<select id="selectArticleComments" resultMap="DTOResultMap"> <select id="selectArticleComments" resultMap="DTOResultMap">
select * from forest_comment where comment_article_id = #{idArticle} order by created_time desc select fc.*, fa.article_title from forest_comment fc join forest_article fa on fc.comment_article_id = fa.id where comment_article_id = #{idArticle} order by fc.created_time desc
</select> </select>
<select id="selectAuthor" resultMap="AuthorResultMap"> <select id="selectAuthor" resultMap="AuthorResultMap">
select id,nickname,avatar_url,account from forest_user where id = #{commentAuthorId} select id,nickname,avatar_url,account from forest_user where id = #{commentAuthorId}
@ -48,6 +49,6 @@
select vu.id,vu.nickname,vu.avatar_url,vu.account from forest_comment vc left join forest_user vu on vu.id = vc.comment_author_id where vc.id = #{commentOriginalCommentId} select vu.id,vu.nickname,vu.avatar_url,vu.account from forest_comment vc left join forest_user vu on vu.id = vc.comment_author_id where vc.id = #{commentOriginalCommentId}
</select> </select>
<select id="selectComments" resultMap="DTOResultMap"> <select id="selectComments" resultMap="DTOResultMap">
select * from forest_comment order by created_time desc select fc.*, fa.article_title from forest_comment fc join forest_article fa on fc.comment_article_id = fa.id order by fc.created_time desc
</select> </select>
</mapper> </mapper>