diff --git a/src/main/java/com/teaching/backend/controller/cms/CmsCategoryController.java b/src/main/java/com/teaching/backend/controller/cms/CmsCategoryController.java index d87ddb6..b35cad2 100644 --- a/src/main/java/com/teaching/backend/controller/cms/CmsCategoryController.java +++ b/src/main/java/com/teaching/backend/controller/cms/CmsCategoryController.java @@ -3,6 +3,7 @@ package com.teaching.backend.controller.cms; import com.teaching.backend.common.BaseResponse; import com.teaching.backend.model.entity.cms.CmsCategory; +import com.teaching.backend.model.entity.cms.CmsEssay; import com.teaching.backend.service.impl.cms.CmsCategoryServiceImpl; import io.swagger.annotations.Api; import org.springframework.web.bind.annotation.*; @@ -62,4 +63,14 @@ public class CmsCategoryController { } + /** + * 修改显示状态 + * @param cmsCategory + * @return + */ + @PutMapping("/edit/status") + public BaseResponse editStatus(CmsCategory cmsCategory){ + return cmsCategoryService.editStatus(cmsCategory); + } + } diff --git a/src/main/java/com/teaching/backend/model/entity/cms/CmsCategory.java b/src/main/java/com/teaching/backend/model/entity/cms/CmsCategory.java index 1005dba..39eace1 100644 --- a/src/main/java/com/teaching/backend/model/entity/cms/CmsCategory.java +++ b/src/main/java/com/teaching/backend/model/entity/cms/CmsCategory.java @@ -47,6 +47,9 @@ public class CmsCategory implements Serializable { @ApiModelProperty(value = "排序") private Integer sort; + @ApiModelProperty(value = "是否显示") + private Integer status; + @ApiModelProperty(value = "创建时间") @TableField(fill = FieldFill.INSERT) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") diff --git a/src/main/java/com/teaching/backend/service/cms/ICmsCategoryService.java b/src/main/java/com/teaching/backend/service/cms/ICmsCategoryService.java index ebc31c8..f121f1f 100644 --- a/src/main/java/com/teaching/backend/service/cms/ICmsCategoryService.java +++ b/src/main/java/com/teaching/backend/service/cms/ICmsCategoryService.java @@ -24,4 +24,6 @@ public interface ICmsCategoryService extends IService { BaseResponse editCategory(CmsCategory cmsCategory); BaseResponse> queryCategory(); + + BaseResponse editStatus(CmsCategory cmsCategory); } diff --git a/src/main/java/com/teaching/backend/service/impl/cms/CmsCategoryServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/cms/CmsCategoryServiceImpl.java index 8caac74..25bda38 100644 --- a/src/main/java/com/teaching/backend/service/impl/cms/CmsCategoryServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/cms/CmsCategoryServiceImpl.java @@ -74,4 +74,11 @@ public class CmsCategoryServiceImpl extends ServiceImpl editStatus(CmsCategory cmsCategory) { + cmsCategory.setStatus(cmsCategory.getStatus() & 1); + updateById(cmsCategory); + return ResultUtils.success("修改成功"); + } + }