From 855921d253a4854d4fb78b83bfcf7c6e93b3f68d Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期三, 29 五月 2024 19:43:50 +0800
Subject: [PATCH] 1.提交【管理后台】团购、拍卖商品立即结束退款处理 2.提交【管理后台】拍卖场管理部分接口
---
ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/impl/ArticleCommentsServiceImpl.java | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 50 insertions(+), 1 deletions(-)
diff --git a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/impl/ArticleCommentsServiceImpl.java b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/impl/ArticleCommentsServiceImpl.java
index d23e6fa..3e82b6e 100644
--- a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/impl/ArticleCommentsServiceImpl.java
+++ b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/impl/ArticleCommentsServiceImpl.java
@@ -1,10 +1,16 @@
package com.ruoyi.article.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.article.domain.pojo.ArticleComments;
+import com.ruoyi.article.domain.Article;
+import com.ruoyi.article.domain.ArticleComments;
+import com.ruoyi.article.dto.ArticleCommentsDTO;
import com.ruoyi.article.mapper.ArticleCommentsMapper;
import com.ruoyi.article.service.IArticleCommentsService;
+import com.ruoyi.article.service.IArticleService;
+import com.ruoyi.common.core.exception.ServiceException;
import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
/**
* <p>
@@ -17,5 +23,48 @@
@Service
public class ArticleCommentsServiceImpl extends
ServiceImpl<ArticleCommentsMapper, ArticleComments> implements IArticleCommentsService {
+ @Resource
+ private IArticleCommentsService articleCommentsService;
+ @Resource
+ private IArticleService articleService;
+
+ @Override
+ public void saveMemberArticleComments(ArticleCommentsDTO articleCommentsDTO) {
+ ArticleComments articleComments=new ArticleComments();
+ if (articleCommentsDTO.getId()!=null){
+ articleComments= articleCommentsService.getById(articleCommentsDTO.getId());
+ }
+ if (articleCommentsDTO.getMemberId()==null){
+ throw new ServiceException("用户id错误");
+ }
+ if (articleCommentsDTO.getType()==1){
+ articleComments.setMemberId(articleCommentsDTO.getMemberId());
+ articleComments.setArticleId(articleCommentsDTO.getArticleId());
+ articleComments.setContent(articleCommentsDTO.getContent());
+ articleComments.setType(1);
+ }else{
+ articleComments.setMemberId(articleCommentsDTO.getMemberId());
+ articleComments.setArticleId(articleCommentsDTO.getArticleId());
+ articleComments.setReplyId(articleCommentsDTO.getReplyId());
+ articleComments.setContent(articleCommentsDTO.getContent());
+ articleComments.setBmemberId(articleCommentsDTO.getBmemberId());
+ articleComments.setType(2);
+ }
+ Article byId = articleService.getById(articleCommentsDTO.getArticleId());
+ byId.setCommentCount(byId.getCommentCount()+1);
+ articleService.saveOrUpdate(byId);
+ articleCommentsService.saveOrUpdate(articleComments);
+ }
+
+ @Override
+ public void delMemberArticleComments(ArticleCommentsDTO articleCommentsDTO) {
+ ArticleComments byId1 = articleCommentsService.getById(articleCommentsDTO.getId());
+
+ Article byId = articleService.getById(byId1.getArticleId());
+ byId.setCommentCount(byId.getCommentCount()-1);
+ articleService.saveOrUpdate(byId);
+
+ articleCommentsService.removeById(articleCommentsDTO.getId());
+ }
}
--
Gitblit v1.7.1