添加Comment相关文件
Change-Id: I823c09a1b576af5b176538f45b30e81cc7789550
diff --git a/src/main/java/com/pt5/pthouduan/mapper/CommentMapper.java b/src/main/java/com/pt5/pthouduan/mapper/CommentMapper.java
index 755a2b5..d59e110 100644
--- a/src/main/java/com/pt5/pthouduan/mapper/CommentMapper.java
+++ b/src/main/java/com/pt5/pthouduan/mapper/CommentMapper.java
@@ -3,16 +3,39 @@
import com.pt5.pthouduan.entity.Comment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
* <p>
- * Mapper 接口
+ * 评论 Mapper 接口
* </p>
*
- * @author ljx
+ * 功能:增、删、改、查(按帖子ID)
+ *
+ * @author ym
* @since 2025-04-14
*/
@Mapper
public interface CommentMapper extends BaseMapper<Comment> {
+ // 创建评论
+ void save(Comment comment);
+
+ // 根据评论ID删除
+ int deleteByCommentid(@Param("commentid") Integer commentid);
+
+ // 更新评论
+ int updateComment(Comment comment);
+
+ // 获取指定帖子下的所有评论
+ List<Comment> selectByPostid(@Param("postid") Integer postid);
+
+ // 点赞 +1
+ int incrementLikes(@Param("commentid") Integer commentid);
+
+ // 取消点赞 -1(最小为0)
+ int decrementLikes(@Param("commentid") Integer commentid);
+
}