文章增加文章类型修改及文章类型删除

This commit is contained in:
fengtianyangyang
2022-04-13 11:06:51 +08:00
parent 2720f5c0bb
commit 6966376f91
3 changed files with 49 additions and 3 deletions

View File

@@ -53,7 +53,7 @@ public interface ArticleService extends IService<Article> {
Article updateArticle(Article article);
/**
* 删除文章
* 删除文章--id
*
* @param id
*/
@@ -87,4 +87,20 @@ public interface ArticleService extends IService<Article> {
*/
@CacheEvict(key = "#id")
Boolean updateArticleStatus(String id, boolean status);
/**
* 修改文章--文章类型修改
* @param article
* @return
*/
@CacheEvict(key = "#article.type")
Article updateArticleType(Article article);
/**
* 删除文章--类型
* @param type
* @param id
*/
@CacheEvict(key = "#type")
void delAllByType(String type, String id);
}

View File

@@ -91,4 +91,17 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> impl
article.setOpenStatus(status);
return this.updateById(article);
}
@Override
public Article updateArticleType(Article article) {
Article oldArticle = this.getById(article.getId());
BeanUtil.copyProperties(article, oldArticle);
this.updateById(oldArticle);
return oldArticle;
}
@Override
public void delAllByType(String type,String id) {
this.removeById(id);
}
}