Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop

This commit is contained in:
Chopper
2022-04-13 11:49:32 +08:00
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);
}
}