增加店铺入驻文章类型。添加修改文章状态方法
This commit is contained in:
parent
a1924b609c
commit
90d03a05a2
@ -24,6 +24,10 @@ public enum ArticleEnum {
|
||||
* 证照信息
|
||||
*/
|
||||
LICENSE_INFORMATION,
|
||||
/**
|
||||
* 店铺入驻
|
||||
*/
|
||||
STORE_REGISTER,
|
||||
/**
|
||||
* 其他文章
|
||||
*/
|
||||
|
@ -69,4 +69,12 @@ public interface ArticleService extends IService<Article> {
|
||||
*/
|
||||
@Cacheable(key = "#type")
|
||||
Article customGetByType(String type);
|
||||
|
||||
/**
|
||||
* 修改文章状态
|
||||
* @param id 文章ID
|
||||
* @param status 显示状态
|
||||
*/
|
||||
@CacheEvict(key = "#id")
|
||||
Boolean updateArticleStatus(String id,boolean status);
|
||||
}
|
@ -3,6 +3,7 @@ package cn.lili.modules.page.serviceimpl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.SwitchEnum;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.BeanUtil;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
@ -82,4 +83,11 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> impl
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateArticleStatus(String id, boolean status) {
|
||||
Article article=this.getById(id);
|
||||
article.setOpenStatus(status? SwitchEnum.OPEN.name():SwitchEnum.CLOSE.name());
|
||||
return this.updateById(article);
|
||||
}
|
||||
}
|
@ -13,7 +13,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -46,8 +45,8 @@ public class ArticleManagerController {
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "categoryId", value = "文章分类ID", dataType = "String", paramType = "query"),
|
||||
@ApiImplicitParam(name = "title", value = "标题", dataType = "String", paramType = "query")
|
||||
@ApiImplicitParam(name = "categoryId", value = "文章分类ID", paramType = "query"),
|
||||
@ApiImplicitParam(name = "title", value = "标题", paramType = "query")
|
||||
})
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<ArticleVO>> getByPage(ArticleSearchParams articleSearchParams) {
|
||||
@ -63,13 +62,27 @@ public class ArticleManagerController {
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改文章")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "String", paramType = "path")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, paramType = "path")
|
||||
@PutMapping("update/{id}")
|
||||
public ResultMessage<Article> update(@Valid Article article, @PathVariable("id") String id) {
|
||||
article.setId(id);
|
||||
return ResultUtil.data(articleService.updateArticle(article));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改文章状态")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, paramType = "path"),
|
||||
@ApiImplicitParam(name = "status", value = "操作状态", required = true, paramType = "query")
|
||||
})
|
||||
@PutMapping("update/status/{id}")
|
||||
public ResultMessage<Article> updateStatus(@PathVariable("id") String id,boolean status) {
|
||||
if(articleService.updateArticleStatus(id,status)){
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping(value = "/delByIds/{id}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user