栏目状态

master
wenyu441069198 3 months ago
parent cd290a7662
commit 79ce69b993
  1. 11
      src/main/java/com/teaching/backend/controller/cms/CmsCategoryController.java
  2. 3
      src/main/java/com/teaching/backend/model/entity/cms/CmsCategory.java
  3. 2
      src/main/java/com/teaching/backend/service/cms/ICmsCategoryService.java
  4. 7
      src/main/java/com/teaching/backend/service/impl/cms/CmsCategoryServiceImpl.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<String> editStatus(CmsCategory cmsCategory){
return cmsCategoryService.editStatus(cmsCategory);
}
}

@ -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")

@ -24,4 +24,6 @@ public interface ICmsCategoryService extends IService<CmsCategory> {
BaseResponse<String> editCategory(CmsCategory cmsCategory);
BaseResponse<List<?>> queryCategory();
BaseResponse<String> editStatus(CmsCategory cmsCategory);
}

@ -74,4 +74,11 @@ public class CmsCategoryServiceImpl extends ServiceImpl<CmsCategoryMapper, CmsCa
return ResultUtils.success(categoryPid);
}
@Override
public BaseResponse<String> editStatus(CmsCategory cmsCategory) {
cmsCategory.setStatus(cmsCategory.getStatus() & 1);
updateById(cmsCategory);
return ResultUtils.success("修改成功");
}
}

Loading…
Cancel
Save