|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
+import org.jeecg.modules.kms.bas.entity.Category;
|
|
|
import org.jeecg.modules.kms.bas.service.ICategoryService;
|
|
|
import org.jeecg.modules.kms.knowledge.entity.Article;
|
|
|
import org.jeecg.modules.kms.knowledge.entity.ArticleCategoryR;
|
|
@@ -67,6 +68,13 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> impl
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Article addArticle(Article article) {
|
|
|
+ String categoryId = article.getCategoryId();
|
|
|
+ Category category = categoryService.getById(categoryId);
|
|
|
+ if (category.getIsPublic().equals("1")){
|
|
|
+ article.setIsPublic("1");
|
|
|
+ } else {
|
|
|
+ article.setIsPublic("0");
|
|
|
+ }
|
|
|
this.saveOrUpdate(article);
|
|
|
this.updateCategoryR(article);
|
|
|
this.saveOrUpdateTagR(article);
|
|
@@ -102,6 +110,13 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> impl
|
|
|
|
|
|
@Override
|
|
|
public void updateArticle(Article article) {
|
|
|
+ String categoryId = article.getCategoryId();
|
|
|
+ Category category = categoryService.getById(categoryId);
|
|
|
+ if (category.getIsPublic().equals("1")){
|
|
|
+ article.setIsPublic("1");
|
|
|
+ } else {
|
|
|
+ article.setIsPublic("0");
|
|
|
+ }
|
|
|
this.deleteCategoryR(article.getId());
|
|
|
this.deleteTagR(article.getId());
|
|
|
this.updateById(article);
|