RealExamCollectionController.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. package com.ruoyi.sim.controller;
  2. import java.util.List;
  3. import javax.servlet.http.HttpServletResponse;
  4. import com.ruoyi.sim.service.impl.RealExamCollectionService;
  5. import io.swagger.annotations.Api;
  6. import io.swagger.annotations.ApiOperation;
  7. import org.springframework.security.access.prepost.PreAuthorize;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.web.bind.annotation.GetMapping;
  10. import org.springframework.web.bind.annotation.PostMapping;
  11. import org.springframework.web.bind.annotation.PutMapping;
  12. import org.springframework.web.bind.annotation.DeleteMapping;
  13. import org.springframework.web.bind.annotation.PathVariable;
  14. import org.springframework.web.bind.annotation.RequestBody;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.RestController;
  17. import com.ruoyi.common.annotation.Log;
  18. import com.ruoyi.common.core.controller.BaseController;
  19. import com.ruoyi.common.core.domain.AjaxResult;
  20. import com.ruoyi.common.enums.BusinessType;
  21. import com.ruoyi.sim.domain.RealExamCollection;
  22. import com.ruoyi.common.utils.poi.ExcelUtil;
  23. import com.ruoyi.common.core.page.TableDataInfo;
  24. /**
  25. * 考试集合Controller
  26. *
  27. * @author tom
  28. * @date 2024-12-17
  29. */
  30. @RestController
  31. @RequestMapping("/sim/real-exam-collection")
  32. @Api("考试集合Controller")
  33. public class RealExamCollectionController extends BaseController {
  34. @Autowired
  35. private RealExamCollectionService realExamCollectionService;
  36. // @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:list')")
  37. @GetMapping("/list")
  38. @ApiOperation("[老师]查询考试集合列表")
  39. public TableDataInfo list(RealExamCollection realExamCollection) {
  40. startPage();
  41. List<RealExamCollection> list = realExamCollectionService.selectRealExamCollectionList(realExamCollection);
  42. return getDataTable(list);
  43. }
  44. /**
  45. * 导出考试集合列表
  46. */
  47. @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:export')")
  48. @Log(title = "考试集合", businessType = BusinessType.EXPORT)
  49. @PostMapping("/export")
  50. public void export(HttpServletResponse response, RealExamCollection realExamCollection) {
  51. List<RealExamCollection> list = realExamCollectionService.selectRealExamCollectionList(realExamCollection);
  52. ExcelUtil<RealExamCollection> util = new ExcelUtil<RealExamCollection>(RealExamCollection.class);
  53. util.exportExcel(response, list, "考试集合数据");
  54. }
  55. /**
  56. * 获取考试集合详细信息
  57. */
  58. // @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:query')")
  59. @GetMapping(value = "/{examCollectionId}")
  60. @ApiOperation("[老师]获取考试集合详细信息")
  61. public AjaxResult getInfo(@PathVariable("examCollectionId") Long examCollectionId) {
  62. return success(realExamCollectionService.selectRealExamCollectionByExamCollectionId(examCollectionId));
  63. }
  64. /**
  65. * 新增考试集合
  66. */
  67. @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:add')")
  68. @Log(title = "考试集合", businessType = BusinessType.INSERT)
  69. @PostMapping
  70. @ApiOperation("[老师]新增考试集合")
  71. public AjaxResult add(@RequestBody RealExamCollection realExamCollection) {
  72. return toAjax(realExamCollectionService.insertRealExamCollection(realExamCollection));
  73. }
  74. /**
  75. * 修改考试集合
  76. */
  77. @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:edit')")
  78. @Log(title = "考试集合", businessType = BusinessType.UPDATE)
  79. @PutMapping
  80. @ApiOperation("[老师]修改考试集合")
  81. public AjaxResult edit(@RequestBody RealExamCollection realExamCollection) {
  82. return toAjax(realExamCollectionService.updateRealExamCollection(realExamCollection));
  83. }
  84. /**
  85. * 删除考试集合
  86. */
  87. @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:remove')")
  88. @Log(title = "考试集合", businessType = BusinessType.DELETE)
  89. @DeleteMapping("/{examCollectionIds}")
  90. @ApiOperation("[老师]删除考试集合")
  91. public AjaxResult remove(@PathVariable Long[] examCollectionIds) {
  92. return toAjax(realExamCollectionService.deleteRealExamCollectionByExamCollectionIds(examCollectionIds));
  93. }
  94. }