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