fef03417a1f77e9d34629f579d82a68ca45c7e77..8db556681e87dfc2537671de072059f5a747472b
2022-06-24 xiaoyong931011
20220606
8db556 diff | tree
2022-06-24 xiaoyong931011
20220606
b22427 diff | tree
9 files modified
68 ■■■■■ 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/dto/AdminAddArticleDto.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdateArticleDto.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java 10 ●●●●● 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 26 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminSeeArticleInfoVo.java 3 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/ArticleMapper.xml 2 ●●● patch | view | raw | blame | history
src/main/resources/mapper/MenuMapper.xml 3 ●●●● 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/dto/AdminAddArticleDto.java
@@ -48,6 +48,9 @@
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date releaseTime;
    @ApiModelProperty(value = "设置成热门文章 0:否 1:是")
    private Integer isTop;
    @ApiModelProperty(value = "是否立即发布 0:否 1:是")
    private Integer releaseStatus;
src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdateArticleDto.java
@@ -50,6 +50,9 @@
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date releaseTime;
    @ApiModelProperty(value = "设置成热门文章 0:否 1:是")
    private Integer isTop;
    @ApiModelProperty(value = "是否立即发布 0:否 1:是")
    private Integer releaseStatus;
src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java
@@ -30,6 +30,14 @@
     */
    public static final Integer DELETE_STATUS_YES = 0;
    /**
     * 设置成热门文章 0:否
     */
    public static final Integer ISTOP_NO = 0;
    /**
     * 设置成热门文章 1:是
     */
    public static final Integer ISTOP_YES = 1;
    /**
     * 访问量
     */
    public static final Integer VISITS_DEFAULT = 0;
@@ -55,6 +63,8 @@
    //发布时间
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date releaseTime;
    //设置成热门文章 0:否 1:是
    private Integer isTop;
    //是否立即发布 0:否 1:是
    private Integer releaseStatus;
    //文章详情
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
@@ -92,6 +92,8 @@
            articleEntity.setAtlas(atlas);
        Date releaseTime = adminAddArticleDto.getReleaseTime();
            articleEntity.setReleaseTime(releaseTime);
        Integer isTop = adminAddArticleDto.getIsTop();
        articleEntity.setIsTop(isTop);
        Integer releaseStatus = adminAddArticleDto.getReleaseStatus();
        articleEntity.setReleaseStatus(releaseStatus);
        String articleDetails = adminAddArticleDto.getArticleDetails();
@@ -132,6 +134,8 @@
        if(ObjectUtil.isEmpty(articleEntity)){
            return Result.fail("文章不存在");
        }
        Integer isTop = adminUpdateArticleDto.getIsTop();
        articleEntity.setIsTop(isTop);
        Integer releaseStatus = adminUpdateArticleDto.getReleaseStatus();
        articleEntity.setReleaseStatus(releaseStatus);
        String title = adminUpdateArticleDto.getTitle();
@@ -196,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)){
src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminSeeArticleInfoVo.java
@@ -43,6 +43,9 @@
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date releaseTime;
    @ApiModelProperty(value = "设置成热门文章 0:否 1:是")
    private Integer isTop;
    @ApiModelProperty(value = "是否立即发布 0:否 1:是")
    private Integer releaseStatus;
src/main/resources/mapper/ArticleMapper.xml
@@ -23,7 +23,7 @@
                </if>
            </if>
        </where>
        order by a.create_time desc
        order by a.is_top desc,a.create_time desc
    </select>
    <select id="selectAdminArticleByid" resultType="com.xcong.farmer.cms.modules.system.vo.AdminSeeArticleInfoVo">
src/main/resources/mapper/MenuMapper.xml
@@ -35,6 +35,7 @@
                    and a.parent_id = #{parentId}
                </if>
        </where>
        order by a.order_num ASC,a.order_num ASC
    </select>
    <select id="selectMenuEntityByIdAndParentId" resultType="com.xcong.farmer.cms.modules.system.entity.MenuEntity">
@@ -59,7 +60,7 @@
        <foreach collection = "list" item = "item"  separator=","  open = "(" close = ")" >
            #{item}
        </foreach >
        order by a.order_num ASC
        order by a.order_num ASC,a.order_num ASC
    </select>
</mapper>