修复bug
This commit is contained in:
@@ -21,6 +21,7 @@ public class Comment implements Serializable {
|
||||
|
||||
private Long postId;
|
||||
|
||||
@TableField("tutorialId")
|
||||
private Long tutorialId; // 新增字段
|
||||
|
||||
private String content;
|
||||
|
||||
@@ -14,11 +14,11 @@ import org.apache.ibatis.annotations.Select;
|
||||
public interface LikeMapper extends BaseMapper<Likee> {
|
||||
|
||||
// 获取帖子获赞数
|
||||
@Select("SELECT SUM(like_count) FROM posts WHERE user_openid = #{userOpenid}")
|
||||
|
||||
Long getPostLikeCount(@Param("userOpenid") String userOpenid);
|
||||
|
||||
// 获取评论获赞数
|
||||
@Select("SELECT SUM(like_count) FROM comments WHERE user_openid = #{userOpenid}")
|
||||
|
||||
Long getCommentLikeCount(@Param("userOpenid") String userOpenid);
|
||||
|
||||
// 查询帖子被点赞的总数
|
||||
|
||||
@@ -8,17 +8,30 @@
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="userOpenid" column="user_openid" jdbcType="VARCHAR"/>
|
||||
<result property="postId" column="post_id" jdbcType="BIGINT"/>
|
||||
<result property="tutorialId" column="tutorialId" jdbcType="BIGINT"/>
|
||||
<result property="tutorialId" column="tutorial_id" jdbcType="BIGINT"/>
|
||||
<result property="commentId" column="comment_id" jdbcType="BIGINT"/>
|
||||
<result property="isDeleted" column="is_deleted" jdbcType="TINYINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,user_openid,post_id,tutorialId,
|
||||
comment_id,is_deleted
|
||||
id, user_openid, post_id, tutorial_id, comment_id, is_deleted
|
||||
</sql>
|
||||
<select id="getLikeCountByPostId" resultType="java.lang.Long">
|
||||
SELECT COUNT(*) FROM likee
|
||||
WHERE post_id = #{postId} AND is_deleted = 0
|
||||
|
||||
<!-- 查询用户所有帖子的点赞总数 -->
|
||||
<select id="getPostLikeCount" resultType="java.lang.Long">
|
||||
SELECT COUNT(*)
|
||||
FROM likee
|
||||
WHERE user_openid = #{userOpenid}
|
||||
AND post_id IS NOT NULL
|
||||
AND is_deleted = 0;
|
||||
</select>
|
||||
|
||||
<!-- 查询用户所有评论的点赞总数 -->
|
||||
<select id="getCommentLikeCount" resultType="java.lang.Long">
|
||||
SELECT COUNT(*)
|
||||
FROM likee
|
||||
WHERE user_openid = #{userOpenid}
|
||||
AND comment_id IS NOT NULL
|
||||
AND is_deleted = 0;
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -86,7 +86,6 @@
|
||||
SELECT title
|
||||
FROM post
|
||||
WHERE is_deleted = 0 AND is_public = 1
|
||||
ORDER BY view_count DESC, like_count DESC
|
||||
LIMIT 9
|
||||
</select>
|
||||
<select id="searchPosts" resultType="com.ivmiku.tutorial.entity.Post">
|
||||
|
||||
Reference in New Issue
Block a user