文章上传发布时间

master
wenyu441069198 3 months ago
parent b5355b4ca6
commit 5d59b9bec1
  1. 4
      src/main/java/com/teaching/backend/controller/cms/CmsEssayController.java
  2. 2
      src/main/java/com/teaching/backend/service/impl/cms/CmsEssayServiceImpl.java

@ -33,7 +33,7 @@ public class CmsEssayController {
* @return * @return
*/ */
@PostMapping("/add") @PostMapping("/add")
public BaseResponse<String> addEssay(@RequestBody CmsEssay cmsEssay){ public BaseResponse<String> addEssay(CmsEssay cmsEssay){
return cmsEssayService.addEssay(cmsEssay); return cmsEssayService.addEssay(cmsEssay);
} }
@ -74,7 +74,7 @@ public class CmsEssayController {
* @return * @return
*/ */
@PutMapping("/edit/status") @PutMapping("/edit/status")
public BaseResponse<String> editStatus(CmsEssay cmsEssay){ public BaseResponse<String> editStatus(@RequestBody CmsEssay cmsEssay){
return cmsEssayService.editStatus(cmsEssay); return cmsEssayService.editStatus(cmsEssay);
} }
} }

@ -9,6 +9,7 @@ import com.teaching.backend.model.entity.cms.CmsEssay;
import com.teaching.backend.service.cms.ICmsEssayService; import com.teaching.backend.service.cms.ICmsEssayService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.List; import java.util.List;
/** /**
@ -24,6 +25,7 @@ public class CmsEssayServiceImpl extends ServiceImpl<CmsEssayMapper, CmsEssay> i
@Override @Override
public BaseResponse<String> addEssay(CmsEssay cmsEssay) { public BaseResponse<String> addEssay(CmsEssay cmsEssay) {
cmsEssay.setPublishTime(LocalDate.now());
save(cmsEssay); save(cmsEssay);
return ResultUtils.success("添加成功"); return ResultUtils.success("添加成功");
} }

Loading…
Cancel
Save