| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.article.domain.pojo.ArticleComments; |
| | | import com.ruoyi.article.dto.ArticleCommentsDTO; |
| | | import com.ruoyi.article.mapper.ArticleCommentsMapper; |
| | | import com.ruoyi.article.service.IArticleCommentsService; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class ArticleCommentsServiceImpl extends |
| | | ServiceImpl<ArticleCommentsMapper, ArticleComments> implements IArticleCommentsService { |
| | | @Resource |
| | | private IArticleCommentsService articleCommentsService; |
| | | |
| | | @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); |
| | | } |
| | | articleCommentsService.saveOrUpdate(articleComments); |
| | | } |
| | | |
| | | @Override |
| | | public void delMemberArticleComments(ArticleCommentsDTO articleCommentsDTO) { |
| | | articleCommentsService.removeById(articleCommentsDTO.getId()); |
| | | } |
| | | } |