“djh”
5 天以前 7acaebcb01438578ded72491f39105db893982ef
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package com.gkhy.exam.admin.controller.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.ExPaperStudent;
import com.gkhy.exam.system.domain.vo.BatchPaperStudentVO;
import com.gkhy.exam.system.domain.vo.ExPaperStudentVO;
import com.gkhy.exam.system.service.ExPaperStudentService;
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.*;
 
import java.util.Collections;
import java.util.List;
 
/**
 * <p>
 * 学员与考试关系表 前端控制器
 * </p>
 *
 * @author kzy
 * @since 2024-06-06 13:53:17
 */
@Api(tags = "学员与考试关系前端控制器")
@RestController
@RequestMapping("/paper-student")
public class ExPaperStudentController {
    @Autowired
    private ExPaperStudentService paperStudentService;
 
    @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"),
            @ApiImplicitParam(paramType = "query", name = "paperId", dataType = "long", required = true, value = "考卷id")
    })
    @GetMapping("/list")
    public CommonResult list(ExPaperStudent paperStudent){
        return CommonResult.success(paperStudentService.selectPaperStudentList(paperStudent));
    }
 
    @ApiOperation(value = "根据id查询学员试卷信息")
    @GetMapping(value = { "/getPaperStudentById" })
    public CommonResult getPaperStudentById(@RequestParam(value = "paperStudentId", required = true) Long paperStudentId)
    {
        return CommonResult.success(paperStudentService.selectPaperStudentById(paperStudentId));
    }
 
    @RepeatSubmit
    @Log(title = "试卷与学员关系管理", businessType = BusinessType.INSERT)
    @ApiOperation(value = "新增学员")
    @PostMapping
    public CommonResult add(@Validated @RequestBody ExPaperStudent paperStudent){
        return CommonResult.success(paperStudentService.addPaperStudent(paperStudent));
    }
 
    @RepeatSubmit
    @Log(title = "试卷与学员关系管理", businessType = BusinessType.INSERT)
    @ApiOperation(value = "批量新增学员")
    @PostMapping("/batchAdd")
    public CommonResult batchAdd(@Validated @RequestBody BatchPaperStudentVO batchPaperStudent){
        return CommonResult.success(paperStudentService.batchAddPaperStudent(batchPaperStudent));
    }
 
    @RepeatSubmit
    @Log(title = "试卷与学员关系管理", businessType = BusinessType.DELETE)
    @ApiOperation(value = "删除学员")
    @DeleteMapping(value = { "/{phaseStudentId}" })
    public CommonResult delete(@PathVariable(value = "phaseStudentId", required = true) Long paperStudentId){
        return CommonResult.success(paperStudentService.deletePaperStudent(paperStudentId));
    }
 
    @RepeatSubmit
    @Log(title = "试卷与学员关系管理", businessType = BusinessType.DELETE)
    @ApiOperation(value = "批量删除学员")
    @DeleteMapping(value = { "/batchDelete" })
    public CommonResult batchDelete(@RequestBody List<Long> paperStudentIds){
        paperStudentService.batchDeletePaperStudent(paperStudentIds);
        return CommonResult.success();
    }
 
    @ApiOperation(value = "校验学员是否已存在")
    @PostMapping("/checkStudentUnique")
    public CommonResult checkNameUnique(@RequestBody  ExPaperStudent paperStudent)
    {
        paperStudentService.checkStudentUnique(Collections.singletonList(paperStudent));
        return CommonResult.success();
    }
 
 
    @ApiOperation(value = "提交批改试卷")
    @PostMapping("/doReview")
    public CommonResult doReview(@RequestBody ExPaperStudentVO paperStudentVO)
    {
        paperStudentService.doReview(paperStudentVO);
        return CommonResult.success();
    }
}