|
|
|
@ -112,15 +112,15 @@ public class CommonServiceImpl implements CommonService {
|
|
|
|
|
@Override
|
|
|
|
|
public Comment saveOrUpdateComment(Comment comment) {
|
|
|
|
|
|
|
|
|
|
List<Comment> comments = commentRepository.findById(comment.getId(),comment.getSchool());
|
|
|
|
|
List<Comment> comments = commentRepository.findById(comment.getId(),comment.getSchool(),comment.getActivityType());
|
|
|
|
|
Comment existingComment = comments.stream().findFirst().orElse(null);
|
|
|
|
|
if (existingComment != null) {
|
|
|
|
|
// 如果评论对象存在,则进行更新操作
|
|
|
|
|
// 这里你可以根据需要更新评论对象的属性
|
|
|
|
|
existingComment.setContent(comment.getContent());
|
|
|
|
|
existingComment.setContentInfo(comment.getContentInfo());
|
|
|
|
|
existingComment.setUpdateTime(Instant.now().toEpochMilli());
|
|
|
|
|
|
|
|
|
|
commentRepository.deleteById(existingComment.getId(),new PartitionKey(existingComment.getSchool()));
|
|
|
|
|
//commentRepository.deleteById(existingComment.getId(),new PartitionKey(existingComment.getSchool()));
|
|
|
|
|
// 最后保存更新后的评论对象
|
|
|
|
|
return commentRepository.save(existingComment);
|
|
|
|
|
} else {
|
|
|
|
@ -141,6 +141,6 @@ public class CommonServiceImpl implements CommonService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Comment> getCommentById(Comment comment) {
|
|
|
|
|
return commentRepository.findById(comment.getId(),comment.getSchool());
|
|
|
|
|
return commentRepository.findById(comment.getId(),comment.getSchool(),comment.getActivityType());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|