kongzy
2023-09-22 3124f3a5b7f45d043b228829b6b3a2e541b31574
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
package com.nms.swspkmas_standalone.controller;
 
 
import com.nms.swspkmas_standalone.entity.Examinee;
import com.nms.swspkmas_standalone.entity.vo.ExamineeVO;
import com.nms.swspkmas_standalone.entity.vo.UploadObjectVO;
import com.nms.swspkmas_standalone.response.CommonPage;
import com.nms.swspkmas_standalone.response.CommonResult;
import com.nms.swspkmas_standalone.service.ExamineeService;
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.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import javax.validation.Valid;
 
/**
 * <p>
 * 考生表 前端控制器
 * </p>
 *
 * @author kzy
 * @since 2023-09-19 17:45:28
 */
@Api(tags = "考生前端控制器")
@RestController
@RequestMapping("/api/examinee")
public class ExamineeController {
    @Autowired
    private ExamineeService examineeService;
 
    @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 = "name", dataType = "string", required = false, value = "考生姓名")
    })
    @GetMapping("/examineeList")
    public CommonResult<CommonPage<Examinee>> examineeList(@RequestParam(required = false,defaultValue = "1") Integer pageNum, @RequestParam(required = false,defaultValue = "10") Integer pageSize, @RequestParam(required = false)  String name){
        return CommonResult.success(examineeService.examineeList(pageNum,pageSize,name));
    }
 
 
    @ApiOperation(value = "根据身份证号获取考生信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "idNumber", dataType = "string", required = true, value = "身份证号")
    })
    @GetMapping("/getExaminee")
    public CommonResult<Examinee> getExaminee(@RequestParam(required = true)  String idNumber){
        return CommonResult.success(examineeService.getByIdNumber(idNumber));
    }
 
    @ApiOperation(value = "新增考生")
    @PostMapping("/addExaminee")
    public CommonResult addExaminee(@RequestBody @Valid ExamineeVO examineeVO){
        examineeService.addExaminee(examineeVO);
        return CommonResult.success();
    }
 
    @ApiOperation(value = "更新考生")
    @PutMapping("/updateExaminee/{examineeId}")
    public CommonResult updateExaminee(@PathVariable(value = "examineeId")Long examineeId,@RequestBody ExamineeVO examineeVO){
        examineeService.updateExaminee(examineeId,examineeVO);
        return CommonResult.success();
    }
 
    @ApiOperation(value = "删除考生")
    @DeleteMapping("/deleteExaminee/{examineeId}")
    public CommonResult deleteExaminee(@PathVariable(value = "examineeId")Long examineeId){
        examineeService.deleteExaminee(examineeId);
        return CommonResult.success();
    }
 
 
 
 
    @ApiOperation(value = "上传头像")
    @PostMapping("/uploadIcon")
    public CommonResult<UploadObjectVO> uploadIcon(MultipartFile file){
        return CommonResult.success(examineeService.uploadIcon(file));
    }
 
}