|
@@ -69,18 +69,21 @@ public class ZbCommentServiceImpl extends ServiceImpl<ZbCommentMapper, ZbComment
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean approval(Long commentId, ApprovalStatus status) {
|
|
|
- ZbComment comment = getById(commentId);
|
|
|
- if (comment == null) {
|
|
|
- throw new BaseException("评论信息不存在");
|
|
|
- }
|
|
|
- String commentStatusStr = comment.getStatus();
|
|
|
- ApprovalStatus approvalStatus = ApprovalStatus.valueOf(commentStatusStr);
|
|
|
- if (approvalStatus != ApprovalStatus.SUBMIT) {
|
|
|
- throw new BaseException("该评论已被审核");
|
|
|
+ public boolean approval(Long[] ids, ApprovalStatus status) {
|
|
|
+ for (Long commentId : ids) {
|
|
|
+ ZbComment comment = getById(commentId);
|
|
|
+ if (comment == null) {
|
|
|
+ throw new BaseException("评论信息不存在");
|
|
|
+ }
|
|
|
+ String commentStatusStr = comment.getStatus();
|
|
|
+ ApprovalStatus approvalStatus = ApprovalStatus.valueOf(commentStatusStr);
|
|
|
+ if (approvalStatus != ApprovalStatus.SUBMIT) {
|
|
|
+ throw new BaseException("该评论已被审核");
|
|
|
+ }
|
|
|
+ comment.setStatus(status.name());
|
|
|
+ updateById(comment);
|
|
|
}
|
|
|
- comment.setStatus(status.name());
|
|
|
- return updateById(comment);
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
@Override
|