package com.gkhy.exam.admin.web;
|
|
|
import com.gkhy.exam.common.annotation.Log;
|
import com.gkhy.exam.common.annotation.RepeatSubmit;
|
import com.gkhy.exam.common.api.CommonResult;
|
import com.gkhy.exam.common.enums.BusinessType;
|
import com.gkhy.exam.system.domain.ExExamPaper;
|
import com.gkhy.exam.system.service.ExExamPaperService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.*;
|
|
/**
|
* <p>
|
* 考卷(组卷)表 前端控制器
|
* </p>
|
*
|
* @author kzy
|
* @since 2024-06-05 15:07:36
|
*/
|
@Api(tags = "组卷(试卷)前端控制器")
|
@RestController
|
@RequestMapping("/exam-paper")
|
public class ExExamPaperController {
|
@Autowired
|
private ExExamPaperService examPaperService;
|
|
@ApiOperation(value = "试卷列表(分页)")
|
@ApiImplicitParams({
|
@ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
|
@ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10")
|
})
|
@GetMapping("/list")
|
public CommonResult list(ExExamPaper examPaper){
|
return CommonResult.success(examPaperService.selectExamPaperList(examPaper));
|
}
|
|
@ApiOperation(value = "根据id获取考卷信息")
|
@GetMapping(value = { "/{paperId}" })
|
public CommonResult getExamPaperInfo(@PathVariable(value = "paperId", required = true) Long paperId)
|
{
|
return CommonResult.success(examPaperService.selectExamPaperById(paperId));
|
}
|
|
@RepeatSubmit
|
@Log(title = "试卷管理", businessType = BusinessType.INSERT)
|
@ApiOperation(value = "新增试卷")
|
@PostMapping
|
public CommonResult add(@Validated @RequestBody ExExamPaper examPaper){
|
return CommonResult.success(examPaperService.insertExamPaper(examPaper));
|
}
|
|
@RepeatSubmit
|
@Log(title = "试卷管理", businessType = BusinessType.UPDATE)
|
@ApiOperation(value = "编辑试卷")
|
@PutMapping
|
public CommonResult edit(@Validated @RequestBody ExExamPaper examPaper){
|
return CommonResult.success(examPaperService.updateExamPaper(examPaper));
|
}
|
|
@RepeatSubmit
|
@Log(title = "试卷管理", businessType = BusinessType.UPDATE)
|
@ApiOperation(value = "删除试卷")
|
@DeleteMapping(value = { "/{paperId}" })
|
public CommonResult delete(@PathVariable(value = "paperId", required = true) Long paperId){
|
return CommonResult.success(examPaperService.deleteExamPaperById(paperId));
|
}
|
|
@ApiOperation(value = "校验试卷名称是否唯一")
|
@PostMapping("/checkNameUnique")
|
public CommonResult checkNameUnique(@RequestBody ExExamPaper examPaper)
|
{
|
return CommonResult.success(examPaperService.checkNameUnique(examPaper));
|
}
|
|
@RepeatSubmit
|
@Log(title = "试卷管理", businessType = BusinessType.UPDATE)
|
@ApiImplicitParams({
|
@ApiImplicitParam(paramType = "body", name = "id", dataType = "long", required = false, value = "试卷id"),
|
@ApiImplicitParam(paramType = "body", name = "status", dataType = "int", required = false, value = "状态(0正常,1停用)")
|
})
|
@ApiOperation(value = "修改试卷状态")
|
@PutMapping("/changeStatus")
|
public CommonResult changeStatus(@Validated @RequestBody ExExamPaper examPaper){
|
return CommonResult.success(examPaperService.changeExamPaperStatus(examPaper.getId(),examPaper.getStatus()));
|
}
|
|
}
|