1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- package com.ruoyi.sim.controller;
- import java.util.List;
- import javax.servlet.http.HttpServletResponse;
- import com.ruoyi.sim.service.impl.RealExamService;
- 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.RealExam;
- import com.ruoyi.common.utils.poi.ExcelUtil;
- import com.ruoyi.common.core.page.TableDataInfo;
- /**
- * 考试Controller
- *
- * @author tom
- * @date 2024-12-15
- */
- @RestController
- @RequestMapping("/sim/real-exam")
- public class RealExamController extends BaseController {
- @Autowired
- private RealExamService realExamService;
- /**
- * 查询考试列表
- */
- @PreAuthorize("@ss.hasPermi('sim:real-exam:list')")
- @GetMapping("/list")
- public TableDataInfo list(RealExam realExam) {
- startPage();
- List<RealExam> list = realExamService.selectRealExamList(realExam);
- return getDataTable(list);
- }
- /**
- * 导出考试列表
- */
- @PreAuthorize("@ss.hasPermi('sim:real-exam:export')")
- @Log(title = "考试", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, RealExam realExam) {
- List<RealExam> list = realExamService.selectRealExamList(realExam);
- ExcelUtil<RealExam> util = new ExcelUtil<RealExam>(RealExam.class);
- util.exportExcel(response, list, "考试数据");
- }
- /**
- * 获取考试详细信息
- */
- @PreAuthorize("@ss.hasPermi('sim:real-exam:query')")
- @GetMapping(value = "/{examId}")
- public AjaxResult getInfo(@PathVariable("examId") Long examId) {
- return success(realExamService.selectRealExamByExamId(examId));
- }
- /**
- * 新增考试
- */
- @PreAuthorize("@ss.hasPermi('sim:real-exam:add')")
- @Log(title = "考试", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody RealExam realExam) {
- return toAjax(realExamService.insertRealExam(realExam));
- }
- /**
- * 修改考试
- */
- @PreAuthorize("@ss.hasPermi('sim:real-exam:edit')")
- @Log(title = "考试", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody RealExam realExam) {
- return toAjax(realExamService.updateRealExam(realExam));
- }
- /**
- * 删除考试
- */
- @PreAuthorize("@ss.hasPermi('sim:real-exam:remove')")
- @Log(title = "考试", businessType = BusinessType.DELETE)
- @DeleteMapping("/{examIds}")
- public AjaxResult remove(@PathVariable Long[] examIds) {
- return toAjax(realExamService.deleteRealExamByExamIds(examIds));
- }
- }
|