You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.5 KiB
71 lines
1.5 KiB
10 months ago
|
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.CmsEssayServiceImpl;
|
||
|
import io.swagger.annotations.Api;
|
||
|
import org.springframework.web.bind.annotation.*;
|
||
|
|
||
|
import javax.annotation.Resource;
|
||
|
import java.util.List;
|
||
|
|
||
|
/**
|
||
|
* <p>
|
||
|
* 前端控制器
|
||
|
* </p>
|
||
|
*
|
||
|
* @author author
|
||
|
* @since 2024-08-13
|
||
|
*/
|
||
|
@Api(tags = "文章管理")
|
||
|
@RestController
|
||
|
@RequestMapping("/api/cms-essay")
|
||
|
public class CmsEssayController {
|
||
|
|
||
|
@Resource
|
||
|
private CmsEssayServiceImpl cmsEssayService;
|
||
|
|
||
|
/**
|
||
|
* 添加文章
|
||
|
* @param cmsEssay
|
||
|
* @return
|
||
|
*/
|
||
|
@PostMapping("/add")
|
||
|
public BaseResponse<String> addEssay(CmsEssay cmsEssay){
|
||
|
return cmsEssayService.addEssay(cmsEssay);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 删除文章
|
||
|
* @param ids
|
||
|
* @return
|
||
|
*/
|
||
|
@DeleteMapping("/delete")
|
||
|
public BaseResponse<String> deleteEssay(@RequestParam List<Integer> ids){
|
||
|
return cmsEssayService.deleteEssay(ids);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 编辑文章
|
||
|
* @param cmsEssay
|
||
|
* @return
|
||
|
*/
|
||
|
@PutMapping("/edit")
|
||
|
public BaseResponse<String> editEssay(CmsEssay cmsEssay){
|
||
|
return cmsEssayService.editEssay(cmsEssay);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 查询文章
|
||
|
* @param category_id
|
||
|
* @return
|
||
|
*/
|
||
|
@GetMapping("/query")
|
||
|
public BaseResponse<List<?>> queryEssay(Integer category_id){
|
||
|
return cmsEssayService.queryEssay(category_id);
|
||
|
}
|
||
|
|
||
|
}
|