package com.zhongzheng.controller.grade; import java.util.List; import java.util.Arrays; import com.zhongzheng.common.utils.ServletUtils; import com.zhongzheng.modules.grade.bo.*; import com.zhongzheng.modules.grade.service.IClassGradeInterfaceService; import com.zhongzheng.modules.grade.service.IClassGradeSysService; import com.zhongzheng.modules.grade.service.IClassGradeUserService; import com.zhongzheng.modules.grade.vo.*; import lombok.RequiredArgsConstructor; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.zhongzheng.common.annotation.Log; import com.zhongzheng.common.core.controller.BaseController; import com.zhongzheng.common.core.domain.AjaxResult; import com.zhongzheng.common.enums.BusinessType; import com.zhongzheng.modules.grade.service.IClassGradeService; import com.zhongzheng.common.utils.poi.ExcelUtil; import com.zhongzheng.common.core.page.TableDataInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; /** * 班级Controller * * @author ruoyi * @date 2021-11-10 */ @Api(value = "班级控制器", tags = {"班级管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/grade/grade") public class ClassGradeController extends BaseController { private final IClassGradeService iClassGradeService; private final IClassGradeInterfaceService iClassGradeInterfaceService; private final IClassGradeSysService iClassGradeSysService; private final IClassGradeUserService iClassGradeUserService; /** * 查询班级列表 */ @ApiOperation("查询班级列表") @PreAuthorize("@ss.hasPermi('grade:grade:list')") @GetMapping("/list") public TableDataInfo list(ClassGradeQueryBo bo) { startPage(); List list = iClassGradeService.queryList(bo); return getDataTable(list); } /** * 查询班级列表 */ @ApiOperation("查询班级学员列表") @PreAuthorize("@ss.hasPermi('grade:grade:list')") @GetMapping("/listGrade") public TableDataInfo listGrade(ClassGradeQueryBo bo) { startPage(); List list = iClassGradeService.listGrade(bo); return getDataTable(list); } /** * 查询学员记录列表 */ @ApiOperation("查询学员记录列表") @PreAuthorize("@ss.hasPermi('grade:user:list')") @GetMapping("/listUser") public TableDataInfo list(ClassGradeUserQueryBo bo) { startPage(); List list = iClassGradeUserService.queryList(bo); return getDataTable(list); } /** * 查询班主任记录列表 */ @ApiOperation("查询班主任记录列表") @PreAuthorize("@ss.hasPermi('grade:sys:list')") @GetMapping("/listSys") public TableDataInfo list(ClassGradeSysQueryBo bo) { startPage(); List list = iClassGradeSysService.queryList(bo); return getDataTable(list); } /** * 查询班级列表 */ @ApiOperation("是否出现官方接口选择") @PreAuthorize("@ss.hasPermi('grade:grade:select')") @GetMapping("/select") public AjaxResult select(ClassGradeAddBo bo) { boolean tenantId = ServletUtils.getRequest().getHeader("TenantId").equals("867735392558919680"); return AjaxResult.success(tenantId ? 1 : 0); } /** * 查询官方接口 */ @ApiOperation("查询官方接口") @PreAuthorize("@ss.hasPermi('grade:grade:list')") @GetMapping("/listInterfaceVo") public TableDataInfo list(ClassGradeInterfaceQueryBo bo) { startPage(); List list = iClassGradeInterfaceService.queryList(bo); return getDataTable(list); } /* *//** * 导出班级列表 *//* @ApiOperation("导出班级列表") @PreAuthorize("@ss.hasPermi('modules.grade:grade:export')") @Log(title = "班级", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(ClassGradeQueryBo bo) { List list = iClassGradeService.queryList(bo); ExcelUtil util = new ExcelUtil(ClassGradeVo.class); return util.exportExcel(list, "班级"); }*/ /** * 获取班级详细信息 */ @ApiOperation("获取班级详细信息") @PreAuthorize("@ss.hasPermi('grade:grade:query')") @GetMapping("/{classId}") public AjaxResult getInfo(@PathVariable("classId") Long classId) { return AjaxResult.success(iClassGradeService.queryById(classId)); } /** * 新增班级 */ @ApiOperation("新增班级") @PreAuthorize("@ss.hasPermi('grade:grade:add')") @Log(title = "班级", businessType = BusinessType.INSERT) @PostMapping() public AjaxResult add(@RequestBody ClassGradeAddBo bo) { return toAjax(iClassGradeService.insertByAddBo(bo) ? 1 : 0); } /** * 修改班级 */ @ApiOperation("修改班级") @PreAuthorize("@ss.hasPermi('grade:grade:edit')") @Log(title = "班级", businessType = BusinessType.UPDATE) @PostMapping("/edit") public AjaxResult edit(@RequestBody ClassGradeEditBo bo) { return toAjax(iClassGradeService.updateByEditBo(bo) ? 1 : 0); } /* *//** * 删除班级 *//* @ApiOperation("删除班级") @PreAuthorize("@ss.hasPermi('modules.grade:grade:remove')") @Log(title = "班级" , businessType = BusinessType.DELETE) @DeleteMapping("/{classIds}") public AjaxResult remove(@PathVariable Long[] classIds) { return toAjax(iClassGradeService.deleteWithValidByIds(Arrays.asList(classIds), true) ? 1 : 0); }*/ }