Browse Source

回复共呢:回顾功能开发前删除的数据,默认恢复到草稿状态

danch 1 month ago
parent
commit
3839a4ca65

+ 2 - 2
jeecg-module-kms/src/main/java/org/jeecg/modules/kms/knowledge/controller/ArticleController.java

@@ -177,9 +177,9 @@ public class ArticleController extends JeecgController<Article, IArticleService>
         List<String> idList = Arrays.asList(ids.split(","));
         this.articleService.restoreBatchByIds(idList);
         if (idList.size() == 1) {
-            return Result.OK("审核成功!");
+            return Result.OK("恢复成功!");
         } else {
-            return Result.OK("批量审核成功!");
+            return Result.OK("批量恢复成功!");
         }
     }
     /**

+ 4 - 1
jeecg-module-kms/src/main/java/org/jeecg/modules/kms/knowledge/service/impl/ArticleServiceImpl.java

@@ -156,7 +156,10 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> impl
     public void restoreBatchByIds(List<String> list) {
         list.forEach(item -> {
             Article article = this.getById(item);
-            article.setStatus(article.getPreDeletionStatus());
+            if(article.getPreDeletionStatus()!=null )
+                article.setStatus(article.getPreDeletionStatus());
+            else
+                article.setStatus(ArticleStatusEnum.DRAFT.getStatus());
             this.updateById(article);
         });
     }