评论,回复,删评
This commit is contained in:
parent
1201edf7d5
commit
2d15b6b773
@ -9,6 +9,10 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class Comment implements Serializable {
|
||||
public Comment(){
|
||||
this.likeCount = Long.valueOf(0);
|
||||
this.commentStatus = 1;
|
||||
}
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ public class CommentServiceImpl implements CommentService {
|
||||
int result = commentDao.insert(comment);
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
if(result > 0){
|
||||
hashMap.put("msg", "评论成功");
|
||||
return JSON.toJSONString(hashMap);
|
||||
return JSON.toJSONString(comment);
|
||||
}
|
||||
else{
|
||||
hashMap.put("msg", "评论失败");
|
||||
@ -64,15 +63,9 @@ public class CommentServiceImpl implements CommentService {
|
||||
@Override
|
||||
public String AddLikeCount(int id){
|
||||
Comment comment = commentDao.selectByPrimaryKey(id);
|
||||
if(comment.getLikeCount() == 0){
|
||||
|
||||
}
|
||||
comment.setLikeCount(comment.getLikeCount()+1);
|
||||
int result = commentDao.updateByPrimaryKey(comment);
|
||||
if(result>0){
|
||||
return JSONObject.toJSONString(comment.getLikeCount());
|
||||
}else{
|
||||
return JSONObject.toJSONString("点赞失败");
|
||||
}
|
||||
HashMap<String, Long> hashMap = new HashMap<>();
|
||||
hashMap.put("点赞成功:",comment.getLikeCount());
|
||||
return JSON.toJSONString(hashMap);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user