This commit is contained in:
wucongxing8150 2025-07-30 19:04:24 +08:00
parent a16995d845
commit 89dfc5575b
3 changed files with 60 additions and 0 deletions

View File

@ -227,6 +227,26 @@ public class CaseClinicalArticleService {
}
}
// 获取下级评论
LambdaQueryWrapper<UserCommentClinicalArticleModel> articleQueryWrapper = new LambdaQueryWrapper<>();
articleQueryWrapper.eq(UserCommentClinicalArticleModel::getRootId, comment.getCommentId());
List<UserCommentClinicalArticleModel> userCommentClinicalArticles = userCommentClinicalArticleDao.selectList(articleQueryWrapper);
for (UserCommentClinicalArticleModel m : userCommentClinicalArticles){
// 删除评论
int res = userCommentClinicalArticleDao.deleteById(m.getCommentId());
if (res <= 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return false;
}
// 减少文章的统计字段
boolean r = DecClinicalArticleStats(String.valueOf(comment.getArticleId()),2,1);
if (!r){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return false;
}
}
// 删除评论
int res = userCommentClinicalArticleDao.deleteById(comment.getCommentId());
if (res <= 0){

View File

@ -249,6 +249,26 @@ public class CaseClinicalVideoService {
}
}
// 获取下级评论
LambdaQueryWrapper<UserCommentClinicalVideoModel> videoQueryWrapper = new LambdaQueryWrapper<>();
videoQueryWrapper.eq(UserCommentClinicalVideoModel::getRootId, comment.getCommentId());
List<UserCommentClinicalVideoModel> userCommentClinicalVideos = userCommentClinicalVideoDao.selectList(videoQueryWrapper);
for (UserCommentClinicalVideoModel m : userCommentClinicalVideos){
// 删除评论
int res = userCommentClinicalVideoDao.deleteById(m.getCommentId());
if (res <= 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return false;
}
// 减少文章的统计字段
boolean r = DecClinicalVideoStats(String.valueOf(comment.getVideoId()),2,1);
if (!r){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return false;
}
}
// 删除评论
int res = userCommentClinicalVideoDao.deleteById(comment.getCommentId());
if (res <= 0){

View File

@ -518,6 +518,26 @@ public class CaseExchangeService {
return false;
}
// 获取下级评论
LambdaQueryWrapper<UserCommentExchangeModel> exchangeQueryWrapper = new LambdaQueryWrapper<>();
exchangeQueryWrapper.eq(UserCommentExchangeModel::getRootId, comment.getCommentId());
List<UserCommentExchangeModel> userCommentExchanges = userCommentExchangeDao.selectList(exchangeQueryWrapper);
for (UserCommentExchangeModel m : userCommentExchanges){
// 删除评论
int res = userCommentExchangeDao.deleteById(m.getCommentId());
if (res <= 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return false;
}
// 减少文章的统计字段
boolean r = DecCaseExchangeStats(String.valueOf(comment.getCommentId()),2,1);
if (!r){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return false;
}
}
// 删除评论
int res = userCommentExchangeDao.deleteById(comment.getCommentId());
if (res <= 0){