RealExamCollectionController.java 3.8 KB

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