You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.3 KiB
73 lines
2.3 KiB
8 months ago
|
package com.teaching.backend.controller.umsAdmin;
|
||
|
|
||
|
import com.teaching.backend.common.CommonResult;
|
||
|
import com.teaching.backend.model.dto.umsAdmin.UmsStudentPageQueryDTO;
|
||
|
import com.teaching.backend.model.entity.umsAdmin.UmsStudentManage;
|
||
|
import com.teaching.backend.service.umsAdmin.UmsStudentManageService;
|
||
|
import io.swagger.annotations.Api;
|
||
|
import io.swagger.annotations.ApiOperation;
|
||
|
import lombok.extern.slf4j.Slf4j;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
import org.springframework.web.bind.annotation.*;
|
||
|
import java.util.Map;
|
||
|
|
||
|
@RestController
|
||
|
@Api(tags = "学生管理")
|
||
|
@RequestMapping("/api/studentManage")
|
||
|
@Slf4j
|
||
|
public class UmsStudentManageController {
|
||
|
|
||
|
@Autowired
|
||
|
private UmsStudentManageService umsStudentManageService;
|
||
|
|
||
|
/**
|
||
|
* 学生管理分页查询
|
||
|
* @param umsStudentPageQueryDTO
|
||
|
* @return
|
||
|
*/
|
||
|
@GetMapping("/page")
|
||
|
@ApiOperation("学生管理分页查询")
|
||
|
public CommonResult<Map<String, Object>> page(UmsStudentPageQueryDTO umsStudentPageQueryDTO){
|
||
|
Map<String, Object> pageResult = umsStudentManageService.pageQuery(umsStudentPageQueryDTO);
|
||
|
return CommonResult.success(pageResult);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 启用禁用学生账号
|
||
|
* @param status
|
||
|
* @param id
|
||
|
* @return
|
||
|
*/
|
||
|
@PostMapping("/status/{status}")
|
||
|
@ApiOperation("启用禁用员工账号")
|
||
|
public CommonResult startOrStop(@PathVariable String status, Long id){
|
||
|
umsStudentManageService.startOrStop(status,id);
|
||
|
return CommonResult.success("修改成功");
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 根据id查询学生信息
|
||
|
* @param id
|
||
|
* @return
|
||
|
*/
|
||
|
@GetMapping("/{id}")
|
||
|
@ApiOperation("根据id查询学生信息")
|
||
|
public CommonResult<UmsStudentManage> getById(@PathVariable Long id){
|
||
|
UmsStudentManage umsStudentManage = umsStudentManageService.getByIdStudentAndUser(id);
|
||
|
return CommonResult.success(umsStudentManage);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 编辑学生信息
|
||
|
* @param umsStudentManage
|
||
|
* @return
|
||
|
*/
|
||
|
@PutMapping
|
||
|
@ApiOperation("编辑学生信息")
|
||
|
public CommonResult update(@RequestBody UmsStudentManage umsStudentManage){
|
||
|
log.info("编辑学生信息: {}",umsStudentManage);
|
||
|
umsStudentManageService.updateStudentAndUser(umsStudentManage);
|
||
|
return CommonResult.success("修改成功");
|
||
|
}
|
||
|
}
|