cloudroam
2025-06-04 ed0dc655e6732f15d30f399c0d460ad7b9fe42da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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);
    }
}