ThesisController.java 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package com.example.controller.teacher;
  2. import com.example.dto.AwardsDTO;
  3. import com.example.dto.ThesisDTO;
  4. import com.example.result.Result;
  5. import com.example.service.ThesisService;
  6. import com.example.vo.AwardsVO;
  7. import com.example.vo.ThesisVO;
  8. import io.swagger.annotations.Api;
  9. import io.swagger.annotations.ApiOperation;
  10. import lombok.extern.slf4j.Slf4j;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.web.bind.annotation.*;
  13. @RestController
  14. @Slf4j
  15. @Api(tags = "老师获奖相关接口")
  16. @RequestMapping("/teacher/thesis")
  17. public class ThesisController {
  18. @Autowired
  19. private ThesisService thesisService;
  20. @PostMapping
  21. @ApiOperation(value = "老师论文上传")
  22. public Result uploadThesis(@RequestBody ThesisDTO thesisDTO) {
  23. log.info("论文上传,{}", thesisDTO);
  24. thesisService.uploadThesis(thesisDTO);
  25. return Result.success();
  26. }
  27. @PutMapping("/{id}")
  28. @ApiOperation(value = "修改指定奖项")
  29. public Result updateAwards(@RequestBody ThesisDTO thesisDTO, @PathVariable Long id) {
  30. log.info("修改指定奖项:{}", id);
  31. thesisService.updateThesis(thesisDTO, id);
  32. return Result.success();
  33. }
  34. @GetMapping("/{id}")
  35. @ApiOperation(value = "获取指定奖项详细信息")
  36. public Result<ThesisVO> getById(@PathVariable Long id) {
  37. log.info("获取指定奖项详细信息:{}", id);
  38. ThesisVO thesisVO = thesisService.getById(id);
  39. return Result.success(thesisVO);
  40. }
  41. @DeleteMapping("/{id}")
  42. @ApiOperation(value = "删除指定奖项")
  43. public Result deleteById(@PathVariable Long id){
  44. log.info("删除指定奖项:{}",id);
  45. thesisService.deleteById(id);
  46. return Result.success();
  47. }
  48. }