ClassGroupStudentController.java 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package com.ym.mec.web.controller;
  2. import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
  3. import com.ym.mec.biz.dal.enums.GroupType;
  4. import com.ym.mec.biz.service.ClassGroupStudentMapperService;
  5. import com.ym.mec.common.controller.BaseController;
  6. import com.ym.mec.common.entity.HttpResponseResult;
  7. import io.swagger.annotations.Api;
  8. import io.swagger.annotations.ApiImplicitParam;
  9. import io.swagger.annotations.ApiImplicitParams;
  10. import io.swagger.annotations.ApiOperation;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.security.access.prepost.PreAuthorize;
  13. import org.springframework.web.bind.annotation.PostMapping;
  14. import org.springframework.web.bind.annotation.RequestMapping;
  15. import org.springframework.web.bind.annotation.RestController;
  16. @RequestMapping("classGroupStudent")
  17. @Api(tags = "班级学生服务")
  18. @RestController
  19. public class ClassGroupStudentController extends BaseController {
  20. @Autowired
  21. private ClassGroupStudentMapperService classGroupStudentMapperService;
  22. @ApiOperation(value = "删除班级学生")
  23. @PostMapping("/del")
  24. @PreAuthorize("@pcs.hasPermissions('classGroupStudent/del')")
  25. @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户id", required = true, dataType = "int"),
  26. @ApiImplicitParam(name = "classGroupId", value = "班级id", required = true, dataType = "int")})
  27. public HttpResponseResult del(Integer userId, Integer classGroupId) throws Exception {
  28. return succeed(classGroupStudentMapperService.delClassGroupStudent(userId, classGroupId));
  29. }
  30. @ApiOperation(value = "查询班级所有学生")
  31. @PostMapping("/findAllStudent")
  32. @PreAuthorize("@pcs.hasPermissions('classGroupStudent/findAllStudent')")
  33. @ApiImplicitParams({@ApiImplicitParam(name = "classGroupId", value = "班级id", required = true, dataType = "int")})
  34. public HttpResponseResult findAllStudent(Integer classGroupId) throws Exception {
  35. return succeed(classGroupStudentMapperService.findClassStudentList(classGroupId, ClassGroupStudentStatusEnum.NORMAL));
  36. }
  37. @ApiOperation(value = "调整班级(小班课)")
  38. @PostMapping("/adjustClassGroup")
  39. @PreAuthorize("@pcs.hasPermissions('classGroupStudent/adjustClassGroup')")
  40. @ApiImplicitParams({
  41. @ApiImplicitParam(name = "userId", value = "学生userId", required = true, dataType = "int"),
  42. @ApiImplicitParam(name = "oldClassGroupId", value = "原班级id", required = true, dataType = "int"),
  43. @ApiImplicitParam(name = "classGroupId", value = "新班级id", required = true, dataType = "int")
  44. })
  45. public HttpResponseResult adjustClassGroup(Integer userId, Integer oldClassGroupId, Integer classGroupId) throws Exception {
  46. return succeed(classGroupStudentMapperService.adjustClassGroup(userId, oldClassGroupId, classGroupId));
  47. }
  48. @ApiOperation(value = "添加学生(小班课,单技班通用)")
  49. @PostMapping("/addStudents")
  50. @PreAuthorize("@pcs.hasPermissions('classGroupStudent/addStudents')")
  51. @ApiImplicitParams({
  52. @ApiImplicitParam(name = "classGroupId", value = "小课班班级id", required = true, dataType = "int"),
  53. @ApiImplicitParam(name = "userIdsStr", value = "学生UserId,逗号分隔", required = true, dataType = "String")
  54. })
  55. public HttpResponseResult addStudents(Integer classGroupId, String userIdsStr) throws Exception {
  56. return succeed(classGroupStudentMapperService.addStudents(classGroupId, userIdsStr, GroupType.MUSIC));
  57. }
  58. }