ClassGradeController.java 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. package com.zhongzheng.controller.grade;
  2. import java.util.List;
  3. import java.util.Arrays;
  4. import com.zhongzheng.common.utils.ServletUtils;
  5. import com.zhongzheng.modules.grade.bo.*;
  6. import com.zhongzheng.modules.grade.service.IClassGradeInterfaceService;
  7. import com.zhongzheng.modules.grade.service.IClassGradeSysService;
  8. import com.zhongzheng.modules.grade.service.IClassGradeUserService;
  9. import com.zhongzheng.modules.grade.vo.*;
  10. import lombok.RequiredArgsConstructor;
  11. import org.springframework.security.access.prepost.PreAuthorize;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.GetMapping;
  14. import org.springframework.web.bind.annotation.PostMapping;
  15. import org.springframework.web.bind.annotation.PutMapping;
  16. import org.springframework.web.bind.annotation.DeleteMapping;
  17. import org.springframework.web.bind.annotation.PathVariable;
  18. import org.springframework.web.bind.annotation.RequestBody;
  19. import org.springframework.web.bind.annotation.RequestMapping;
  20. import org.springframework.web.bind.annotation.RestController;
  21. import com.zhongzheng.common.annotation.Log;
  22. import com.zhongzheng.common.core.controller.BaseController;
  23. import com.zhongzheng.common.core.domain.AjaxResult;
  24. import com.zhongzheng.common.enums.BusinessType;
  25. import com.zhongzheng.modules.grade.service.IClassGradeService;
  26. import com.zhongzheng.common.utils.poi.ExcelUtil;
  27. import com.zhongzheng.common.core.page.TableDataInfo;
  28. import io.swagger.annotations.Api;
  29. import io.swagger.annotations.ApiOperation;
  30. /**
  31. * 班级Controller
  32. *
  33. * @author ruoyi
  34. * @date 2021-11-10
  35. */
  36. @Api(value = "班级控制器", tags = {"班级管理"})
  37. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  38. @RestController
  39. @RequestMapping("/grade/grade")
  40. public class ClassGradeController extends BaseController {
  41. private final IClassGradeService iClassGradeService;
  42. private final IClassGradeInterfaceService iClassGradeInterfaceService;
  43. private final IClassGradeSysService iClassGradeSysService;
  44. private final IClassGradeUserService iClassGradeUserService;
  45. /**
  46. * 查询班级列表
  47. */
  48. @ApiOperation("查询班级列表")
  49. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  50. @GetMapping("/list")
  51. public TableDataInfo<ClassGradeVo> list(ClassGradeQueryBo bo) {
  52. startPage();
  53. List<ClassGradeVo> list = iClassGradeService.queryList(bo);
  54. return getDataTable(list);
  55. }
  56. /**
  57. * 查询班级列表
  58. */
  59. @ApiOperation("查询班级学员列表")
  60. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  61. @GetMapping("/listGrade")
  62. public TableDataInfo<ClassGradeStudentVo> listGrade(ClassGradeQueryBo bo) {
  63. startPage();
  64. List<ClassGradeStudentVo> list = iClassGradeService.listGrade(bo);
  65. return getDataTable(list);
  66. }
  67. /**
  68. * 查询学员记录列表
  69. */
  70. @ApiOperation("查询学员记录列表")
  71. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  72. @GetMapping("/listUser")
  73. public TableDataInfo<ClassGradeUserVo> list(ClassGradeUserQueryBo bo) {
  74. startPage();
  75. List<ClassGradeUserVo> list = iClassGradeUserService.queryList(bo);
  76. return getDataTable(list);
  77. }
  78. /**
  79. * 查询班主任记录列表
  80. */
  81. @ApiOperation("查询班主任记录列表")
  82. @PreAuthorize("@ss.hasPermi('grade:sys:list')")
  83. @GetMapping("/listSys")
  84. public TableDataInfo<ClassGradeSysVo> list(ClassGradeSysQueryBo bo) {
  85. startPage();
  86. List<ClassGradeSysVo> list = iClassGradeSysService.queryList(bo);
  87. return getDataTable(list);
  88. }
  89. /**
  90. * 查询班级列表
  91. */
  92. @ApiOperation("是否出现官方接口选择")
  93. @PreAuthorize("@ss.hasPermi('grade:grade:select')")
  94. @GetMapping("/select")
  95. public AjaxResult<Integer> select(ClassGradeAddBo bo) {
  96. boolean tenantId = ServletUtils.getRequest().getHeader("TenantId").equals("867735392558919680");
  97. return AjaxResult.success(tenantId ? 1 : 0);
  98. }
  99. /**
  100. * 查询官方接口
  101. */
  102. @ApiOperation("查询官方接口")
  103. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  104. @GetMapping("/listInterfaceVo")
  105. public TableDataInfo<ClassGradeInterfaceVo> list(ClassGradeInterfaceQueryBo bo) {
  106. startPage();
  107. List<ClassGradeInterfaceVo> list = iClassGradeInterfaceService.queryList(bo);
  108. return getDataTable(list);
  109. }
  110. /* *//**
  111. * 导出班级列表
  112. *//*
  113. @ApiOperation("导出班级列表")
  114. @PreAuthorize("@ss.hasPermi('modules.grade:grade:export')")
  115. @Log(title = "班级", businessType = BusinessType.EXPORT)
  116. @GetMapping("/export")
  117. public AjaxResult<ClassGradeVo> export(ClassGradeQueryBo bo) {
  118. List<ClassGradeVo> list = iClassGradeService.queryList(bo);
  119. ExcelUtil<ClassGradeVo> util = new ExcelUtil<ClassGradeVo>(ClassGradeVo.class);
  120. return util.exportExcel(list, "班级");
  121. }*/
  122. /**
  123. * 获取班级详细信息
  124. */
  125. @ApiOperation("获取班级详细信息")
  126. @PreAuthorize("@ss.hasPermi('grade:grade:query')")
  127. @GetMapping("/{classId}")
  128. public AjaxResult<ClassGradeVo> getInfo(@PathVariable("classId") Long classId) {
  129. return AjaxResult.success(iClassGradeService.queryById(classId));
  130. }
  131. /**
  132. * 新增班级
  133. */
  134. @ApiOperation("新增班级")
  135. @PreAuthorize("@ss.hasPermi('grade:grade:add')")
  136. @Log(title = "班级", businessType = BusinessType.INSERT)
  137. @PostMapping()
  138. public AjaxResult<Void> add(@RequestBody ClassGradeAddBo bo) {
  139. return toAjax(iClassGradeService.insertByAddBo(bo) ? 1 : 0);
  140. }
  141. /**
  142. * 修改班级
  143. */
  144. @ApiOperation("修改班级")
  145. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  146. @Log(title = "班级", businessType = BusinessType.UPDATE)
  147. @PostMapping("/edit")
  148. public AjaxResult<Void> edit(@RequestBody ClassGradeEditBo bo) {
  149. return toAjax(iClassGradeService.updateByEditBo(bo) ? 1 : 0);
  150. }
  151. /* *//**
  152. * 删除班级
  153. *//*
  154. @ApiOperation("删除班级")
  155. @PreAuthorize("@ss.hasPermi('modules.grade:grade:remove')")
  156. @Log(title = "班级" , businessType = BusinessType.DELETE)
  157. @DeleteMapping("/{classIds}")
  158. public AjaxResult<Void> remove(@PathVariable Long[] classIds) {
  159. return toAjax(iClassGradeService.deleteWithValidByIds(Arrays.asList(classIds), true) ? 1 : 0);
  160. }*/
  161. }