图谱-后端
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.
 
 

62 lines
2.0 KiB

package com.teaching.backend.controller.courses;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.filter.ValidateParams;
import com.teaching.backend.model.entity.courses.ObjectiveContents;
import com.teaching.backend.service.courses.IObjectiveContentsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* 前端控制器
* </p>
*
* @author zjh
* @since 2024-06-05
*/
@RestController
@RequestMapping("/api/objective_contents")
@Api(tags = "目标内容接口")
public class ObjectiveContentsController {
@Autowired
IObjectiveContentsService objectiveContentsService;
@ApiOperation("添加目标内容")
@ValidateParams({"objectiveId"})
@PostMapping("/addcontent")
public BaseResponse<String> saveContent(@RequestBody ObjectiveContents objectiveContents){
String data = objectiveContentsService.saveWithCheck(objectiveContents);
return ResultUtils.success(data);
}
@ApiOperation("删除目标内容")
@ValidateParams({"id"})
@DeleteMapping("/{id}")
public BaseResponse<String> deleteContent(@PathVariable String id){
String data = objectiveContentsService.deleteById(id);
return ResultUtils.success(data);
}
@ApiOperation("修改目标内容")
@ValidateParams({"id","objectiveId"})
@PutMapping("/update")
public BaseResponse<String> updateContent(@RequestBody ObjectiveContents objectiveContents){
objectiveContentsService.updateById(objectiveContents);
return ResultUtils.success("修改成功");
}
@ApiOperation("根据id查询目标内容")
@ValidateParams({"id"})
@GetMapping("/{id}")
public BaseResponse<ObjectiveContents> updateContent(@PathVariable String id){
ObjectiveContents objectiveContent = objectiveContentsService.getById(id);
return ResultUtils.success(objectiveContent);
}
}