From 54dce1d981e13cd177bd3e0bb1f335f31fd3429b Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 07 Jul 2022 15:05:18 +0800
Subject: [PATCH] 20220606
---
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java | 31 +++++++++++++++++++++++--------
1 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
index 601c2bc..6a2ce1d 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
@@ -1,5 +1,6 @@
package com.xcong.farmer.cms.modules.system.service.Impl;
+import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
@@ -59,6 +60,20 @@
if(StrUtil.isNotEmpty(title)){
articleEntity.setTitle(title);
}
+ Integer contentType = adminArticleDto.getContentType() == null ? 0 : adminArticleDto.getContentType();
+ if(contentType != 0){
+ QueryWrapper<ColumnEntity> objectQueryWrapper = new QueryWrapper<>();
+ objectQueryWrapper.eq("content_type",contentType);
+ List<ColumnEntity> columnEntities = columnMapper.selectList(objectQueryWrapper);
+ if(CollUtil.isNotEmpty(columnEntities)){
+ List<Long> columIds = new ArrayList<>();
+ for(ColumnEntity columnEntity : columnEntities){
+ Long id = columnEntity.getId();
+ columIds.add(id);
+ }
+ articleEntity.setColumnIds(columIds);
+ }
+ }
if(UserEntity.USER_BELONG_TOP != companyId){
articleEntity.setCompanyId(companyId);
}
@@ -105,6 +120,10 @@
articleEntity.setArticleDetails(articleDetails);
String uploadFile = adminAddArticleDto.getUploadFile();
articleEntity.setUploadFile(uploadFile);
+
+ articleEntity.setArticleUrl(adminAddArticleDto.getArticleUrl());
+ articleEntity.setType(adminAddArticleDto.getType());
+ articleEntity.setContentType(adminAddArticleDto.getContentType());
this.baseMapper.insert(articleEntity);
return Result.ok("添加成功");
}
@@ -173,6 +192,10 @@
articleEntity.setArticleDetails(articleDetails);
String uploadFile = adminUpdateArticleDto.getUploadFile();
articleEntity.setUploadFile(uploadFile);
+
+ articleEntity.setArticleUrl(adminUpdateArticleDto.getArticleUrl());
+ articleEntity.setType(adminUpdateArticleDto.getType());
+ articleEntity.setContentType(adminUpdateArticleDto.getContentType());
this.baseMapper.updateById(articleEntity);
return Result.ok("更新成功");
}
@@ -235,13 +258,5 @@
articleEntity.setReleaseStatus(ArticleEntity.RELEASE_STATUS_YES);
this.baseMapper.updateById(articleEntity);
return Result.ok("操作成功");
- }
-
- @Override
- public void releaseArticle(Long id) {
- ArticleEntity article = this.baseMapper.selectById(id);
-
- ColumnEntity column = columnMapper.selectById(article.getColumnId());
- cmsCoreService.articleProcess(article.getId(), column.getArticleTemplate());
}
}
--
Gitblit v1.9.1