heheng
6 天以前 81791ded0d0bf0a452dcc3a96f25ea3bb12ebfcb
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
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.ExPhaseStudent;
import com.gkhy.exam.system.service.ExPhaseStudentService;
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("/phase-student")
public class ExPhaseStudentController {
    @Autowired
    private ExPhaseStudentService phaseStudentService;
 
    @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 = "pageId", dataType = "long", required = true, value = "批次id")
    })
    @GetMapping("/list")
    public CommonResult list(ExPhaseStudent phaseStudent){
        return CommonResult.success(phaseStudentService.selectPhaseStudentList(phaseStudent));
    }
 
    @RepeatSubmit
    @Log(title = "批次与学员关系管理", businessType = BusinessType.INSERT)
    @ApiOperation(value = "新增学员")
    @PostMapping
    public CommonResult add(@Validated @RequestBody ExPhaseStudent phaseStudent){
        return CommonResult.success(phaseStudentService.addPhaseStudent(phaseStudent));
    }
 
    @RepeatSubmit
    @Log(title = "批次与学员关系管理", businessType = BusinessType.UPDATE)
    @ApiOperation(value = "批量新增学员")
    @PostMapping("/batchAdd")
    public CommonResult batchAdd(@Validated @RequestBody List<ExPhaseStudent> phaseStudents){
        return CommonResult.success(phaseStudentService.batchAddPhaseStudent(phaseStudents));
    }
 
    @RepeatSubmit
    @Log(title = "批次与学员关系管理", businessType = BusinessType.UPDATE)
    @ApiOperation(value = "删除学员")
    @DeleteMapping(value = { "/{phaseStudentId}" })
    public CommonResult delete(@PathVariable(value = "phaseStudentId", required = true) Long phaseStudentId){
        return CommonResult.success(phaseStudentService.deletePhaseStudent(phaseStudentId));
    }
 
    @RepeatSubmit
    @Log(title = "批次与学员关系管理", businessType = BusinessType.DELETE)
    @ApiOperation(value = "批量删除学员")
    @DeleteMapping(value = { "/batchDelete" })
    public CommonResult batchDelete(@RequestBody List<Long> phaseStudentIds){
        phaseStudentService.batchDeletePhaseStudent(phaseStudentIds);
        return CommonResult.success();
    }
 
    @ApiOperation(value = "校验学员是否已存在")
    @PostMapping("/checkStudentUnique")
    public CommonResult checkNameUnique(@RequestBody  ExPhaseStudent phaseStudent)
    {
        phaseStudentService.checkStudentUnique(Collections.singletonList(phaseStudent));
        return CommonResult.success();
    }
}