blob: d59e1106e28c37ffa328c6da5d9db975d997571b [file] [log] [blame]
刘嘉昕f28ea232025-04-15 16:55:43 +08001package com.pt5.pthouduan.mapper;
2
3import com.pt5.pthouduan.entity.Comment;
4import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5import org.apache.ibatis.annotations.Mapper;
ym92355ec83a2025-06-03 17:15:13 +08006import org.apache.ibatis.annotations.Param;
7
8import java.util.List;
刘嘉昕f28ea232025-04-15 16:55:43 +08009
10/**
11 * <p>
ym92355ec83a2025-06-03 17:15:13 +080012 * 评论 Mapper 接口
刘嘉昕f28ea232025-04-15 16:55:43 +080013 * </p>
14 *
ym92355ec83a2025-06-03 17:15:13 +080015 * 功能:增、删、改、查(按帖子ID)
16 *
17 * @author ym
刘嘉昕f28ea232025-04-15 16:55:43 +080018 * @since 2025-04-14
19 */
20@Mapper
21public interface CommentMapper extends BaseMapper<Comment> {
22
ym92355ec83a2025-06-03 17:15:13 +080023 // 创建评论
24 void save(Comment comment);
25
26 // 根据评论ID删除
27 int deleteByCommentid(@Param("commentid") Integer commentid);
28
29 // 更新评论
30 int updateComment(Comment comment);
31
32 // 获取指定帖子下的所有评论
33 List<Comment> selectByPostid(@Param("postid") Integer postid);
34
35 // 点赞 +1
36 int incrementLikes(@Param("commentid") Integer commentid);
37
38 // 取消点赞 -1(最小为0)
39 int decrementLikes(@Param("commentid") Integer commentid);
40
刘嘉昕f28ea232025-04-15 16:55:43 +080041}