ExamSongController.java 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package com.keao.edu.user.controller;
  2. import com.keao.edu.common.controller.BaseController;
  3. import com.keao.edu.common.entity.HttpResponseResult;
  4. import com.keao.edu.common.page.PageInfo;
  5. import com.keao.edu.common.tenant.TenantContextHolder;
  6. import com.keao.edu.user.entity.ExamSong;
  7. import com.keao.edu.user.page.ExamSongQueryInfo;
  8. import com.keao.edu.user.service.ExamSongService;
  9. import io.swagger.annotations.Api;
  10. import io.swagger.annotations.ApiImplicitParam;
  11. import io.swagger.annotations.ApiOperation;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.*;
  14. import java.util.Date;
  15. import java.util.List;
  16. /**
  17. * @Author Joburgess
  18. * @Date 2020.06.16
  19. */
  20. @RestController
  21. @RequestMapping("examSong")
  22. @Api(tags = "曲库服务")
  23. public class ExamSongController extends BaseController {
  24. @Autowired
  25. private ExamSongService examSongService;
  26. @ApiOperation("分页查询")
  27. @GetMapping(value = "/list")
  28. public HttpResponseResult<PageInfo<ExamSong>> getList(ExamSongQueryInfo queryInfo) {
  29. return succeed(examSongService.queryPage(queryInfo));
  30. }
  31. @ApiOperation("学生端分页查询考级曲库")
  32. @GetMapping(value = "/queryPage")
  33. public HttpResponseResult<PageInfo<ExamSong>> queryPage(ExamSongQueryInfo queryInfo) {
  34. return succeed(examSongService.querySongPage(queryInfo));
  35. }
  36. @ApiOperation("查询曲库详情")
  37. @ApiImplicitParam(name = "id", value = "机构ID", required = true, dataType = "Integer", paramType = "path")
  38. @GetMapping(value = "/query")
  39. public HttpResponseResult<ExamSong> query(Integer id) {
  40. return succeed(examSongService.get(id));
  41. }
  42. @ApiOperation("新增曲库")
  43. @PostMapping(value = "/add")
  44. public HttpResponseResult add(@RequestBody ExamSong examSong) {
  45. examSong.setTenantId(TenantContextHolder.getTenantId());
  46. examSongService.insert(examSong);
  47. return succeed();
  48. }
  49. @ApiOperation("更新曲库")
  50. @PostMapping(value = "/update")
  51. public HttpResponseResult update(@RequestBody ExamSong examSong) {
  52. examSong.setUpdateTime(new Date());
  53. examSongService.update(examSong);
  54. return succeed();
  55. }
  56. @ApiOperation("删除曲库")
  57. @PostMapping(value = "/del")
  58. public HttpResponseResult add(Integer id) {
  59. return succeed(examSongService.delete(id));
  60. }
  61. @ApiOperation("根据专业获取曲目")
  62. @GetMapping(value = "/getWithSubject")
  63. public HttpResponseResult<List<ExamSong>> getWithSubject(Integer subjectId){
  64. return succeed(examSongService.getWithSubject(subjectId));
  65. }
  66. }