xiaoyong931011
2022-06-24 8db556681e87dfc2537671de072059f5a747472b
20220606
3 files modified
40 ■■■■■ changed files
src/main/java/com/xcong/farmer/cms/modules/system/controller/AdminArticleController.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/service/IArticleService.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java 22 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/controller/AdminArticleController.java
@@ -62,6 +62,20 @@
        return iArticleService.updateStatusOff(id);
    }
    @ApiOperation(value = "设置热门文章", notes = "设置热门文章")
    @PostMapping(value = "/updateIstop")
    public Result updateIstop(@RequestBody @Valid AdminUpdateStatusOnDto adminUpdateStatusOnDto) {
        Long id = adminUpdateStatusOnDto.getId();
        return iArticleService.updateIstop(id);
    }
    @ApiOperation(value = "取消设置热门文章", notes = "取消设置热门文章")
    @PostMapping(value = "/updateIstopOff")
    public Result updateIstopOff(@RequestBody @Valid AdminUpdateStatusOnDto adminUpdateStatusOnDto) {
        Long id = adminUpdateStatusOnDto.getId();
        return iArticleService.updateIstopOff(id);
    }
    @ApiOperation(value = "删除文章", notes = "删除文章")
    @PostMapping(value = "/delObjs")
    public Result delObjs(@RequestBody @Valid AdminDeleteDto adminDeleteDto) {
src/main/java/com/xcong/farmer/cms/modules/system/service/IArticleService.java
@@ -25,4 +25,8 @@
    Result updateStatusOn(Long id);
    Result updateStatusOff(Long id);
    Result updateIstop(Long id);
    Result updateIstopOff(Long id);
}
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
@@ -200,6 +200,28 @@
    }
    @Override
    public Result updateIstop(Long id) {
        ArticleEntity articleEntity = this.baseMapper.selectById(id);
        if(ObjectUtil.isEmpty(articleEntity)){
            return Result.fail("文章不存在");
        }
        articleEntity.setIsTop(ArticleEntity.ISTOP_YES);
        this.baseMapper.updateById(articleEntity);
        return Result.ok("操作成功");
    }
    @Override
    public Result updateIstopOff(Long id) {
        ArticleEntity articleEntity = this.baseMapper.selectById(id);
        if(ObjectUtil.isEmpty(articleEntity)){
            return Result.fail("文章不存在");
        }
        articleEntity.setIsTop(ArticleEntity.ISTOP_NO);
        this.baseMapper.updateById(articleEntity);
        return Result.ok("操作成功");
    }
    @Override
    public Result updateStatusOn(Long id) {
        ArticleEntity articleEntity = this.baseMapper.selectById(id);
        if(ObjectUtil.isEmpty(articleEntity)){