Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop
This commit is contained in:
commit
761982474c
@ -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);
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -60,7 +60,7 @@ public class ArticleManagerController {
|
||||
return ResultUtil.data(article);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改文章")
|
||||
@ApiOperation(value = "修改文章--文章id")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, paramType = "path")
|
||||
@PutMapping(value = "update/{id}", consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<Article> update(@RequestBody Article article, @PathVariable("id") String id) {
|
||||
@ -68,6 +68,23 @@ public class ArticleManagerController {
|
||||
return ResultUtil.data(articleService.updateArticle(article));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改文章--文章类型")
|
||||
@ApiImplicitParam(name = "type", value = "文章类型", required = true, paramType = "path")
|
||||
@PutMapping(value = "updateArticle/{type}", consumes = "application/json", produces = "application/json")
|
||||
public ResultMessage<Article> updateArticle(@RequestBody Article article, @PathVariable("type") String type,String id) {
|
||||
article.setId(id);
|
||||
article.setType(type);
|
||||
return ResultUtil.data(articleService.updateArticleType(article));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "文章删除-文章类型")
|
||||
@ApiImplicitParam(name = "type", value = "文章类型", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping(value = "/delByIds/{type}")
|
||||
public ResultMessage<Object> delAllByType(@PathVariable String type,String id) {
|
||||
articleService.delAllByType(type,id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改文章状态")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, paramType = "path"),
|
||||
@ -80,7 +97,7 @@ public class ArticleManagerController {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@ApiOperation(value = "批量删除--id")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping(value = "/delByIds/{id}")
|
||||
public ResultMessage<Object> delAllByIds(@PathVariable String id) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user