cloudroam
2025-06-04 ed0dc655e6732f15d30f399c0d460ad7b9fe42da
src/main/java/com/mzl/flower/mapper/film/CommentLikesMapper.java
@@ -2,15 +2,32 @@
import com.mzl.flower.entity.film.CommentLikes;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
/**
 * <p>
 * 影视作品点赞表 Mapper 接口
 * </p>
 *
 * @author generator@Fang
 * @since 2025-05-29
 * 评论点赞表 Mapper
 */
@Repository
public interface CommentLikesMapper extends BaseMapper<CommentLikes> {
    /**
     * 根据评论id查询点赞数量
     */
    @Select("select count(1) from comment_likes where  status = '1' and comment_id =#{ id}  ")
    Long getLikeCountCommentId(Integer id);
    /**
     * 判断用户是否点赞
     */
    @Select("select status from comment_likes where comment_id = #{commentId} and create_by = #{userId} ")
    Boolean isLike(Integer commentId, String userId);
    /**
     * 查询人员有没有对应的评论点赞信息
     */
    @Select("select * from comment_likes where create_by = #{userId} and comment_id = #{commentId} ")
    CommentLikes getCommentLikeByUserIdAndCommentId(String userId, Integer commentId);
}