From 79ce69b993a8a9eee741970f4ff229eb7f19c449 Mon Sep 17 00:00:00 2001 From: wenyu441069198 <14186472+wenyu441069198@user.noreply.gitee.com> Date: Wed, 14 Aug 2024 11:44:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/controller/cms/CmsCategoryController.java | 11 +++++++++++ .../backend/model/entity/cms/CmsCategory.java | 3 +++ .../backend/service/cms/ICmsCategoryService.java | 2 ++ .../service/impl/cms/CmsCategoryServiceImpl.java | 7 +++++++ 4 files changed, 23 insertions(+) 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("修改成功"); + } + }