package com.mzl.flower.service.film.impl;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.mzl.flower.config.security.SecurityUtils;
|
import com.mzl.flower.dto.request.film.CommentLikesDTO;
|
import com.mzl.flower.dto.request.film.CommentLikesQueryDTO;
|
import com.mzl.flower.dto.response.film.CommentLikesVO;
|
import com.mzl.flower.entity.film.CommentLikes;
|
import com.mzl.flower.mapper.film.CommentLikesMapper;
|
import com.mzl.flower.service.film.CommentLikesService;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
|
/**
|
* @author generator@Fang
|
* @since 2025-05-29
|
*/
|
@Service
|
public class CommentLikesServiceImpl extends ServiceImpl<CommentLikesMapper, CommentLikes> implements CommentLikesService {
|
|
@Resource
|
private CommentLikesMapper commentLikesMapper;
|
|
@Override
|
public void saveCommentLikes(CommentLikesDTO commentLikesDTO) {
|
|
}
|
|
@Override
|
public void updateCommentLikes(CommentLikesDTO commentLikesDTO) {
|
//查询有没有对应人员的点赞信息
|
CommentLikes commentLikes = commentLikesMapper.getCommentLikeByUserIdAndCommentId(SecurityUtils.getUserId(), commentLikesDTO.getCommentId());
|
if (commentLikes == null) {
|
CommentLikes commentLikes1 = new CommentLikes();
|
commentLikes1.setCommentId(commentLikesDTO.getCommentId());
|
commentLikes1.setStatus(true);
|
commentLikes1.create();
|
commentLikesMapper.insert(commentLikes1);
|
} else {
|
// 状态取反
|
commentLikes.setStatus(!commentLikes.getStatus());
|
commentLikes.update(SecurityUtils.getUserId());
|
commentLikesMapper.updateById(commentLikes);
|
}
|
}
|
|
@Override
|
public void deleteCommentLikes(String id) {
|
|
}
|
|
@Override
|
public Page<CommentLikesVO> queryPage(CommentLikesQueryDTO commentLikesQueryDTO, Page page) {
|
return null;
|
}
|
|
@Override
|
public Long getLikeCountCommentId(Integer id) {
|
return commentLikesMapper.getLikeCountCommentId(id);
|
}
|
|
@Override
|
public Boolean isLike(Integer commentId, String userId) {
|
return commentLikesMapper.isLike(commentId,userId);
|
}
|
}
|