添加点赞++功能
This commit is contained in:
8
src/main/java/com/lovenav/service/CommentService.java
Normal file
8
src/main/java/com/lovenav/service/CommentService.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.lovenav.service;
|
||||
|
||||
import com.lovenav.entity.Comment;
|
||||
|
||||
public interface CommentService {
|
||||
// 点赞
|
||||
public int AddLikeCount(Comment comment);
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user