package com.mzl.flower.mapper.film; import com.mzl.flower.entity.film.CommentLikes; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; import org.springframework.stereotype.Repository; /** * 评论点赞表 Mapper */ @Repository public interface CommentLikesMapper extends BaseMapper { /** * 根据评论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); @Update("UPDATE comment_likes SET status = #{status}, update_by = #{updateBy}, update_time = NOW() WHERE id = #{id}") int updateStatusById(@Param("id") Long id, @Param("status") Boolean status, @Param("updateBy") String updateBy); }