|
|
|
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("/objective_contents")
|
|
|
|
@Api(tags = "目标内容接口")
|
|
|
|
public class ObjectiveContentsController {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
IObjectiveContentsService objectiveContentsService;
|
|
|
|
|
|
|
|
@ApiOperation("添加目标内容")
|
|
|
|
@ValidateParams({"objectiveId"})
|
|
|
|
@PostMapping("/addcontent")
|
|
|
|
public BaseResponse<String> saveContent(@RequestBody ObjectiveContents objectiveContents){
|
|
|
|
objectiveContentsService.save(objectiveContents);
|
|
|
|
return ResultUtils.success("添加成功");
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation("删除目标内容")
|
|
|
|
@ValidateParams({"id"})
|
|
|
|
@DeleteMapping("/{id}")
|
|
|
|
public BaseResponse<String> deleteContent(@PathVariable String id){
|
|
|
|
// objectiveContentsService.removeById(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);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|