2020-03-07 21:51:58 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
2020-11-19 11:52:13 +08:00
<mapper namespace= "com.rymcu.forest.mapper.CommentMapper" >
<resultMap id= "BaseResultMap" type= "com.rymcu.forest.entity.Comment" >
2020-03-07 21:51:58 +08:00
<id column= "id" property= "idComment" > </id>
<result column= "comment_content" property= "commentContent" > </result>
<result column= "comment_author_id" property= "commentAuthorId" > </result>
<result column= "comment_article_id" property= "commentArticleId" > </result>
<result column= "comment_sharp_url" property= "commentSharpUrl" > </result>
<result column= "comment_original_comment_id" property= "commentOriginalCommentId" > </result>
<result column= "comment_status" property= "commentStatus" > </result>
<result column= "comment_ip" property= "commentIP" > </result>
<result column= "comment_ua" property= "commentUA" > </result>
<result column= "comment_anonymous" property= "commentAnonymous" > </result>
<result column= "comment_reply_count" property= "commentReplyCount" > </result>
<result column= "comment_visible" property= "commentVisible" > </result>
<result column= "created_time" property= "createdTime" > </result>
</resultMap>
2020-11-19 11:52:13 +08:00
<resultMap id= "DTOResultMap" type= "com.rymcu.forest.dto.CommentDTO" >
2020-03-07 21:51:58 +08:00
<id column= "id" property= "idComment" > </id>
<result column= "comment_content" property= "commentContent" > </result>
<result column= "comment_author_id" property= "commentAuthorId" > </result>
<result column= "comment_article_id" property= "commentArticleId" > </result>
<result column= "comment_sharp_url" property= "commentSharpUrl" > </result>
<result column= "comment_original_comment_id" property= "commentOriginalCommentId" > </result>
<result column= "comment_status" property= "commentStatus" > </result>
<result column= "comment_anonymous" property= "commentAnonymous" > </result>
<result column= "comment_reply_count" property= "commentReplyCount" > </result>
<result column= "comment_visible" property= "commentVisible" > </result>
<result column= "created_time" property= "createdTime" > </result>
2021-06-28 09:57:08 +08:00
<result column= "article_title" property= "articleTitle" > </result>
2020-03-07 21:51:58 +08:00
</resultMap>
2020-11-19 11:52:13 +08:00
<resultMap id= "AuthorResultMap" type= "com.rymcu.forest.dto.Author" >
2020-03-07 21:51:58 +08:00
<result column= "id" property= "idUser" />
<result column= "nickname" property= "userNickname" />
<result column= "avatar_url" property= "userAvatarURL" />
2021-04-20 08:42:13 +08:00
<result column= "account" property= "userAccount" />
2020-03-07 21:51:58 +08:00
</resultMap>
<update id= "updateCommentSharpUrl" >
2021-01-25 18:27:41 +08:00
update forest_comment set comment_sharp_url = #{commentSharpUrl} where id = #{idComment}
2020-03-07 21:51:58 +08:00
</update>
<select id= "selectArticleComments" resultMap= "DTOResultMap" >
2021-06-28 09:57:08 +08:00
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
2020-03-07 21:51:58 +08:00
</select>
<select id= "selectAuthor" resultMap= "AuthorResultMap" >
2021-04-20 08:42:13 +08:00
select id,nickname,avatar_url,account from forest_user where id = #{commentAuthorId}
2020-03-07 21:51:58 +08:00
</select>
<select id= "selectCommentOriginalAuthor" resultMap= "AuthorResultMap" >
2021-04-20 08:42:13 +08:00
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}
2020-03-07 21:51:58 +08:00
</select>
2021-06-28 08:06:37 +08:00
<select id= "selectComments" resultMap= "DTOResultMap" >
2021-06-28 09:57:08 +08:00
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
2021-06-28 08:06:37 +08:00
</select>
2020-03-07 21:51:58 +08:00
</mapper>