BaseStudentInfoController.java 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package com.xjrsoft.module.student.controller;
  2. import cn.dev33.satoken.annotation.SaCheckPermission;
  3. import cn.hutool.core.bean.BeanUtil;
  4. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  5. import com.xjrsoft.common.model.result.RT;
  6. import com.xjrsoft.common.page.ConventPage;
  7. import com.xjrsoft.common.page.PageOutput;
  8. import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
  9. import com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto;
  10. import com.xjrsoft.module.student.service.impl.IBaseStudentSchoolRollService;
  11. import com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo;
  12. import com.xjrsoft.module.student.vo.BaseStudentInfoPageDataVo;
  13. import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
  14. import io.swagger.annotations.Api;
  15. import io.swagger.annotations.ApiOperation;
  16. import lombok.AllArgsConstructor;
  17. import org.springframework.web.bind.annotation.GetMapping;
  18. import org.springframework.web.bind.annotation.PutMapping;
  19. import org.springframework.web.bind.annotation.RequestBody;
  20. import org.springframework.web.bind.annotation.RequestMapping;
  21. import org.springframework.web.bind.annotation.RequestParam;
  22. import org.springframework.web.bind.annotation.RestController;
  23. import javax.validation.Valid;
  24. /**
  25. * @title: 学生职务设置
  26. * @Author dzx
  27. * @Date: 2023-11-13
  28. * @Version 1.0
  29. */
  30. @RestController
  31. @RequestMapping("/student" + "/basestudentinfo")
  32. @Api(value = "/student" + "/basestudentinfo",tags = "学生信息修改管理")
  33. @AllArgsConstructor
  34. public class BaseStudentInfoController {
  35. private final IBaseStudentSchoolRollService baseStudentSchoolRollService;
  36. @GetMapping(value = "/mobile-page")
  37. @ApiOperation(value="学生列表(分页)")
  38. @SaCheckPermission("basestudentpost:detail")
  39. public RT<PageOutput<BaseStudentInfoPageVo>> mobilePage(@Valid BaseStudentInfoPageDto dto){
  40. Page<BaseStudentInfoPageVo> mobilePage = baseStudentSchoolRollService.getMobilePage(new Page<>(dto.getLimit(), dto.getSize()), dto);
  41. PageOutput<BaseStudentInfoPageVo> pageOutput = ConventPage.getPageOutput(mobilePage, BaseStudentInfoPageVo.class);
  42. return RT.ok(pageOutput);
  43. }
  44. @GetMapping(value = "/mobile-page-statistics")
  45. @ApiOperation(value="学生列表人数统计")
  46. @SaCheckPermission("basestudentpost:detail")
  47. public RT<BaseStudentInfoPageDataVo> mobilePageStatistics(@Valid BaseStudentInfoPageDto dto){
  48. BaseStudentInfoPageDataVo result = baseStudentSchoolRollService.getMobilePageStatistics(dto);
  49. return RT.ok(result);
  50. }
  51. @PutMapping
  52. @ApiOperation(value = "修改学生职务设置")
  53. @SaCheckPermission("basestudentpost:edit")
  54. public RT<Boolean> update(@Valid @RequestBody UpdateBaseStudentInfoDto dto){
  55. return RT.ok(baseStudentSchoolRollService.updateInfo(dto));
  56. }
  57. @GetMapping(value = "/info")
  58. @ApiOperation(value="根据id查询详情信息")
  59. @SaCheckPermission("room:detail")
  60. public RT<BaseStudentInfoDetailVo> info(@RequestParam Long id){
  61. BaseStudentInfoDetailVo detailVo = baseStudentSchoolRollService.getInfoById(id);
  62. if (detailVo == null) {
  63. return RT.error("找不到此数据!");
  64. }
  65. return RT.ok(BeanUtil.toBean(detailVo, BaseStudentInfoDetailVo.class));
  66. }
  67. }