添加点赞++功能

This commit is contained in:
sjm
2023-12-20 17:22:56 +08:00
parent a001f2f05f
commit 09165ec608
4 changed files with 127 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
package com.lovenav.service;
import com.lovenav.entity.Comment;
public interface CommentService {
// 点赞
public int AddLikeCount(Comment comment);
}

View File

@@ -0,0 +1,17 @@
package com.lovenav.service.serviceImpl;
import com.lovenav.dao.CommentDao;
import com.lovenav.entity.Comment;
import com.lovenav.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
public class CommentServiceImpl implements CommentService {
private CommentDao commentDao;
// 点赞++
public int AddLikeCount(Comment comment){
comment.setLikeCount(comment.getLikeCount()+1);
return commentDao.updateByPrimaryKeySelective(comment);
}
}