From c5fea961b83fefbface6c75d5383a21e773dda2b Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期六, 08 五月 2021 16:47:03 +0800
Subject: [PATCH] 修复邻里圈管理后台评论状态修改时更新邻里圈的评论数

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java
index 69dd248..4501ff9 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java
@@ -553,6 +553,17 @@
         }
         commentDO.setStatus(dto.getStatus());
         neighborCircleCommentDAO.updateById(commentDO);
+
+        //查询邻里圈更新邻里圈评论数量
+        ComActNeighborCircleDO neighborCircleDO = this.baseMapper.selectById(commentDO.getCircleId());
+        if(neighborCircleDO != null){
+            if(dto.getStatus().equals(2)){
+                neighborCircleDO.setCommentNum(neighborCircleDO.getCommentNum() - 1);
+            }else if(dto.getStatus().equals(1)){
+                neighborCircleDO.setCommentNum(neighborCircleDO.getCommentNum() + 1);
+            }
+            this.baseMapper.updateById(neighborCircleDO);
+        }
         return R.ok();
     }
 

--
Gitblit v1.7.1