CourseTableController.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. package com.ruoyi.web.controller.course;
  2. import java.util.List;
  3. import javax.servlet.http.HttpServletResponse;
  4. import org.springframework.security.access.prepost.PreAuthorize;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.web.bind.annotation.GetMapping;
  7. import org.springframework.web.bind.annotation.PostMapping;
  8. import org.springframework.web.bind.annotation.PutMapping;
  9. import org.springframework.web.bind.annotation.DeleteMapping;
  10. import org.springframework.web.bind.annotation.PathVariable;
  11. import org.springframework.web.bind.annotation.RequestBody;
  12. import org.springframework.web.bind.annotation.RequestMapping;
  13. import org.springframework.web.bind.annotation.RestController;
  14. import com.ruoyi.common.annotation.Log;
  15. import com.ruoyi.common.core.controller.BaseController;
  16. import com.ruoyi.common.core.domain.AjaxResult;
  17. import com.ruoyi.common.enums.BusinessType;
  18. import com.ruoyi.system.domain.CourseTable;
  19. import com.ruoyi.system.service.ICourseTableService;
  20. import com.ruoyi.common.utils.poi.ExcelUtil;
  21. import com.ruoyi.common.core.page.TableDataInfo;
  22. /**
  23. * 课程Controller
  24. *
  25. * @author ruoyi
  26. * @date 2023-05-24
  27. */
  28. @RestController
  29. @RequestMapping("/course/table")
  30. public class CourseTableController extends BaseController
  31. {
  32. @Autowired
  33. private ICourseTableService courseTableService;
  34. /**
  35. * 查询课程列表
  36. */
  37. @GetMapping("/list")
  38. public TableDataInfo list(CourseTable courseTable)
  39. {
  40. startPage();
  41. List<CourseTable> list = courseTableService.selectCourseTableList(courseTable);
  42. return getDataTable(list);
  43. }
  44. /**
  45. * 导出课程列表
  46. */
  47. @PreAuthorize("@ss.hasPermi('course:table:export')")
  48. @Log(title = "课程", businessType = BusinessType.EXPORT)
  49. @PostMapping("/export")
  50. public void export(HttpServletResponse response, CourseTable courseTable)
  51. {
  52. List<CourseTable> list = courseTableService.selectCourseTableList(courseTable);
  53. ExcelUtil<CourseTable> util = new ExcelUtil<CourseTable>(CourseTable.class);
  54. util.exportExcel(response, list, "课程数据");
  55. }
  56. /**
  57. * 获取课程详细信息
  58. */
  59. @GetMapping(value = "/{id}")
  60. public AjaxResult getInfo(@PathVariable("id") Long id)
  61. {
  62. return success(courseTableService.selectCourseTableById(id));
  63. }
  64. /**
  65. * 新增课程
  66. */
  67. @PreAuthorize("@ss.hasPermi('course:table:add')")
  68. @Log(title = "课程", businessType = BusinessType.INSERT)
  69. @PostMapping
  70. public AjaxResult add(@RequestBody CourseTable courseTable)
  71. {
  72. return toAjax(courseTableService.insertCourseTable(courseTable));
  73. }
  74. /**
  75. * 修改课程
  76. */
  77. @PreAuthorize("@ss.hasPermi('course:table:edit')")
  78. @Log(title = "课程", businessType = BusinessType.UPDATE)
  79. @PostMapping("/put")
  80. public AjaxResult edit(@RequestBody CourseTable courseTable)
  81. {
  82. return toAjax(courseTableService.updateCourseTable(courseTable));
  83. }
  84. /**
  85. * 删除课程
  86. */
  87. @PreAuthorize("@ss.hasPermi('course:table:remove')")
  88. @Log(title = "课程", businessType = BusinessType.DELETE)
  89. @GetMapping("/delete/{ids}")
  90. public AjaxResult remove(@PathVariable Long[] ids)
  91. {
  92. return toAjax(courseTableService.deleteCourseTableByIds(ids));
  93. }
  94. @GetMapping(value = "/now")
  95. public AjaxResult now(Long schoolId, Long classId)
  96. {
  97. return courseTableService.now(schoolId,classId);
  98. }
  99. }