package com.gkhy.exam.admin.web;
|
|
|
import com.gkhy.exam.common.annotation.Log;
|
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));
|
}
|
|
@Log(title = "批次与学员关系管理", businessType = BusinessType.INSERT)
|
@ApiOperation(value = "新增学员")
|
@PostMapping
|
public CommonResult add(@Validated @RequestBody ExPhaseStudent phaseStudent){
|
return CommonResult.success(phaseStudentService.addPhaseStudent(phaseStudent));
|
}
|
|
@Log(title = "批次与学员关系管理", businessType = BusinessType.UPDATE)
|
@ApiOperation(value = "批量新增学员")
|
@PostMapping("/batchAdd")
|
public CommonResult batchAdd(@Validated @RequestBody List<ExPhaseStudent> phaseStudents){
|
return CommonResult.success(phaseStudentService.batchAddPhaseStudent(phaseStudents));
|
}
|
|
@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));
|
}
|
|
@Log(title = "批次与学员关系管理", businessType = BusinessType.UPDATE)
|
@ApiOperation(value = "批量删除学员")
|
@DeleteMapping(value = { "/batchDelete" })
|
public CommonResult batchDelete( 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();
|
}
|
}
|