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.ExStudent;
|
import com.gkhy.exam.system.service.ExStudentService;
|
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.security.access.prepost.PreAuthorize;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.*;
|
|
/**
|
* <p>
|
* 学员表 前端控制器
|
* </p>
|
*
|
* @author kzy
|
* @since 2024-06-06 13:53:17
|
*/
|
@Api(tags = "学员前端控制器")
|
@RestController
|
@RequestMapping("/student")
|
public class ExStudentController {
|
@Autowired
|
private ExStudentService studentService;
|
|
|
@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(ExStudent student){
|
return CommonResult.success(studentService.selectStudentList(student));
|
}
|
|
@ApiOperation(value = "根据id获取学员信息")
|
@GetMapping(value = { "/{studentId}" })
|
public CommonResult getStudentInfo(@PathVariable(value = "studentId", required = true) Long studentId)
|
{
|
return CommonResult.success(studentService.selectStudentById(studentId));
|
}
|
|
@Log(title = "学员管理", businessType = BusinessType.INSERT)
|
@ApiOperation(value = "新增学员")
|
@PostMapping
|
public CommonResult add(@Validated @RequestBody ExStudent student){
|
return CommonResult.success(studentService.insertStudent(student));
|
}
|
|
@Log(title = "学员管理", businessType = BusinessType.UPDATE)
|
@ApiOperation(value = "编辑学员")
|
@PutMapping
|
public CommonResult edit(@Validated @RequestBody ExStudent student){
|
return CommonResult.success(studentService.updateStudent(student));
|
}
|
|
@Log(title = "学员管理", businessType = BusinessType.UPDATE)
|
@ApiOperation(value = "删除学员")
|
@DeleteMapping(value = { "/{studentId}" })
|
public CommonResult delete(@PathVariable(value = "studentId", required = true) Long studentId){
|
return CommonResult.success(studentService.deleteStudentById(studentId));
|
}
|
|
@Log(title = "学员管理", businessType = BusinessType.UPDATE)
|
@ApiOperation(value = "重置密码")
|
@PutMapping(value = "/resetPwd")
|
public CommonResult restPwd(@RequestBody ExStudent student){
|
studentService.resetUserPwd(student);
|
return CommonResult.success();
|
}
|
|
}
|