MusicTheoryController.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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.page.QueryInfo;
  6. import com.keao.edu.common.tenant.TenantContextHolder;
  7. import com.keao.edu.user.entity.MusicTheory;
  8. import com.keao.edu.user.service.MusicTheoryService;
  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. /**
  15. * @Author wangyp
  16. * @Date 2020/6/27 9:17
  17. * @Description TODO
  18. */
  19. @RestController
  20. @RequestMapping("musicTheory")
  21. @Api(tags = "乐理信息")
  22. public class MusicTheoryController extends BaseController {
  23. @Autowired
  24. private MusicTheoryService musicTheoryService;
  25. @ApiOperation("分页查询")
  26. @GetMapping(value = "/list")
  27. public HttpResponseResult<PageInfo<MusicTheory>> getList(QueryInfo queryInfo) {
  28. return succeed(musicTheoryService.queryPage(queryInfo));
  29. }
  30. @ApiOperation("查询乐理详情")
  31. @ApiImplicitParam(name = "id", value = "机构ID", required = true, dataType = "Integer", paramType = "path")
  32. @GetMapping(value = "/query")
  33. public HttpResponseResult<MusicTheory> query(Integer id) {
  34. return succeed(musicTheoryService.get(id));
  35. }
  36. @ApiOperation("新增乐理")
  37. @PostMapping(value = "/add")
  38. public HttpResponseResult add(MusicTheory musicTheory) {
  39. musicTheory.setTenantId(TenantContextHolder.getTenantId());
  40. musicTheoryService.addMusicTheory(musicTheory);
  41. return succeed();
  42. }
  43. @ApiOperation("更新乐理")
  44. @PostMapping(value = "/update")
  45. public HttpResponseResult update(MusicTheory musicTheory) {
  46. musicTheoryService.update(musicTheory);
  47. return succeed();
  48. }
  49. @ApiOperation("删除乐理")
  50. @PostMapping(value = "/del/{id}")
  51. public HttpResponseResult add(@PathVariable("id") Integer id) {
  52. return succeed(musicTheoryService.delete(id));
  53. }
  54. }