mirror of https://github.com/halo-dev/halo
Remove deprecated method(remove) in CommentService
parent
2446b21650
commit
84740fdfea
|
@ -19,15 +19,6 @@ import java.util.Optional;
|
|||
*/
|
||||
public interface CommentService extends CrudService<Comment, Long> {
|
||||
|
||||
/**
|
||||
* 删除评论
|
||||
*
|
||||
* @param commentId commentId
|
||||
* @return Optional
|
||||
*/
|
||||
@Deprecated
|
||||
Optional<Comment> remove(Long commentId);
|
||||
|
||||
/**
|
||||
* 查询所有的评论,用于后台管理
|
||||
*
|
||||
|
|
|
@ -48,20 +48,6 @@ public class CommentServiceImpl extends AbstractCrudService<Comment, Long> imple
|
|||
return super.create(comment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除评论
|
||||
*
|
||||
* @param commentId commentId
|
||||
* @return Optional
|
||||
*/
|
||||
@Override
|
||||
@CacheEvict(value = {COMMENTS_CACHE_NAME, POSTS_CACHE_NAME}, allEntries = true, beforeInvocation = true)
|
||||
public Optional<Comment> remove(Long commentId) {
|
||||
final Optional<Comment> comment = this.fetchById(commentId);
|
||||
commentRepository.delete(comment.orElse(null));
|
||||
return comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有的评论,用于后台管理
|
||||
*
|
||||
|
|
|
@ -128,7 +128,7 @@ public class CommentController extends BaseController {
|
|||
@RequestParam("status") Integer status,
|
||||
@PageableDefault Pageable pageable) {
|
||||
try {
|
||||
commentService.remove(commentId);
|
||||
commentService.removeById(commentId);
|
||||
} catch (Exception e) {
|
||||
log.error("Delete comment failed: {}", e.getMessage());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue