点赞++2
This commit is contained in:
@@ -4,5 +4,5 @@ import com.lovenav.entity.Comment;
|
||||
|
||||
public interface CommentService {
|
||||
// 点赞
|
||||
public int AddLikeCount(Comment comment);
|
||||
public String AddLikeCount(Comment comment);
|
||||
}
|
||||
|
@@ -1,17 +1,21 @@
|
||||
package com.lovenav.service.serviceImpl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.lovenav.dao.CommentDao;
|
||||
import com.lovenav.entity.Comment;
|
||||
import com.lovenav.service.CommentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class CommentServiceImpl implements CommentService {
|
||||
|
||||
private CommentDao commentDao;
|
||||
|
||||
// 点赞++
|
||||
public int AddLikeCount(Comment comment){
|
||||
public String AddLikeCount(Comment comment){
|
||||
comment.setLikeCount(comment.getLikeCount()+1);
|
||||
return commentDao.updateByPrimaryKeySelective(comment);
|
||||
commentDao.updateByPrimaryKeySelective(comment);
|
||||
return JSONObject.toJSONString(comment);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user