package com.ruoyi.sim.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.ruoyi.sim.service.impl.RealExamCollectionService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.sim.domain.RealExamCollection; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 考试集合Controller * * @author tom * @date 2024-12-17 */ @RestController @RequestMapping("/sim/real-exam-collection") @Api("考试集合Controller") public class RealExamCollectionController extends BaseController { @Autowired private RealExamCollectionService realExamCollectionService; // @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:list')") @GetMapping("/list") @ApiOperation("[老师]查询考试集合列表") public TableDataInfo list(RealExamCollection realExamCollection) { startPage(); List list = realExamCollectionService.selectRealExamCollectionList(realExamCollection); return getDataTable(list); } /** * 导出考试集合列表 */ @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:export')") @Log(title = "考试集合", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, RealExamCollection realExamCollection) { List list = realExamCollectionService.selectRealExamCollectionList(realExamCollection); ExcelUtil util = new ExcelUtil(RealExamCollection.class); util.exportExcel(response, list, "考试集合数据"); } /** * 获取考试集合详细信息 */ // @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:query')") @GetMapping(value = "/{examCollectionId}") @ApiOperation("[老师]获取考试集合详细信息") public AjaxResult getInfo(@PathVariable("examCollectionId") Long examCollectionId) { return success(realExamCollectionService.selectRealExamCollectionByExamCollectionId(examCollectionId)); } /** * 新增考试集合 */ @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:add')") @Log(title = "考试集合", businessType = BusinessType.INSERT) @PostMapping @ApiOperation("[老师]新增考试集合") public AjaxResult add(@RequestBody RealExamCollection realExamCollection) { return toAjax(realExamCollectionService.insertRealExamCollection(realExamCollection)); } /** * 修改考试集合 */ @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:edit')") @Log(title = "考试集合", businessType = BusinessType.UPDATE) @PutMapping @ApiOperation("[老师]修改考试集合") public AjaxResult edit(@RequestBody RealExamCollection realExamCollection) { return toAjax(realExamCollectionService.updateRealExamCollection(realExamCollection)); } /** * 删除考试集合 */ @PreAuthorize("@ss.hasPermi('sim:real-exam-collection:remove')") @Log(title = "考试集合", businessType = BusinessType.DELETE) @DeleteMapping("/{examCollectionIds}") @ApiOperation("[老师]删除考试集合") public AjaxResult remove(@PathVariable Long[] examCollectionIds) { return toAjax(realExamCollectionService.deleteRealExamCollectionByExamCollectionIds(examCollectionIds)); } }