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.
127 lines
6.1 KiB
127 lines
6.1 KiB
package cn.iocoder.yudao.module.zhuguang.controller.admin.basic_info;
|
|
|
|
import cn.iocoder.yudao.module.zhuguang.dal.dataobject.dormitory_check_in.DormRuleRecordsDO;
|
|
import cn.iocoder.yudao.module.zhuguang.dal.dataobject.late_signing.NightRuleRecordDO;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import jakarta.annotation.Resource;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
import jakarta.validation.*;
|
|
import jakarta.servlet.http.*;
|
|
import java.util.*;
|
|
import java.io.IOException;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
|
|
|
import cn.iocoder.yudao.module.zhuguang.controller.admin.basic_info.vo.*;
|
|
import cn.iocoder.yudao.module.zhuguang.dal.dataobject.basic_info.FixedClassTableDO;
|
|
import cn.iocoder.yudao.module.zhuguang.dal.dataobject.basic_info.StudentDO;
|
|
import cn.iocoder.yudao.module.zhuguang.service.basic_info.FixedClassTableService;
|
|
|
|
@Tag(name = "管理后台 - 固定班级")
|
|
@RestController
|
|
@RequestMapping("/zhuguang/fixed-class-table")
|
|
@Validated
|
|
public class FixedClassTableController {
|
|
|
|
@Resource
|
|
private FixedClassTableService fixedClassTableService;
|
|
|
|
@PostMapping("/create")
|
|
@Operation(summary = "创建固定班级")
|
|
@PreAuthorize("@ss.hasPermission('zhuguang:fixed-class-table:create')")
|
|
public CommonResult<Long> createFixedClassTable(@Valid @RequestBody FixedClassTableSaveReqVO createReqVO) {
|
|
return success(fixedClassTableService.createFixedClassTable(createReqVO));
|
|
}
|
|
|
|
@PutMapping("/update")
|
|
@Operation(summary = "更新固定班级")
|
|
@PreAuthorize("@ss.hasPermission('zhuguang:fixed-class-table:update')")
|
|
public CommonResult<Boolean> updateFixedClassTable(@Valid @RequestBody FixedClassTableSaveReqVO updateReqVO) {
|
|
fixedClassTableService.updateFixedClassTable(updateReqVO);
|
|
return success(true);
|
|
}
|
|
|
|
@DeleteMapping("/delete")
|
|
@Operation(summary = "删除固定班级")
|
|
@Parameter(name = "id", description = "编号", required = true)
|
|
@PreAuthorize("@ss.hasPermission('zhuguang:fixed-class-table:delete')")
|
|
public CommonResult<Boolean> deleteFixedClassTable(@RequestParam("id") Long id) {
|
|
fixedClassTableService.deleteFixedClassTable(id);
|
|
return success(true);
|
|
}
|
|
|
|
@GetMapping("/get")
|
|
@Operation(summary = "获得固定班级")
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
@PreAuthorize("@ss.hasPermission('zhuguang:fixed-class-table:query')")
|
|
public CommonResult<FixedClassTableRespVO> getFixedClassTable(@RequestParam("id") Long id) {
|
|
FixedClassTableDO fixedClassTable = fixedClassTableService.getFixedClassTable(id);
|
|
return success(BeanUtils.toBean(fixedClassTable, FixedClassTableRespVO.class));
|
|
}
|
|
|
|
@GetMapping("/page")
|
|
@Operation(summary = "获得固定班级分页")
|
|
@PreAuthorize("@ss.hasPermission('zhuguang:fixed-class-table:query')")
|
|
public CommonResult<PageResult<FixedClassTableRespVO>> getFixedClassTablePage(@Valid FixedClassTablePageReqVO pageReqVO) {
|
|
PageResult<FixedClassTableDO> pageResult = fixedClassTableService.getFixedClassTablePage(pageReqVO);
|
|
return success(BeanUtils.toBean(pageResult, FixedClassTableRespVO.class));
|
|
}
|
|
|
|
@GetMapping("/export-excel")
|
|
@Operation(summary = "导出固定班级 Excel")
|
|
@PreAuthorize("@ss.hasPermission('zhuguang:fixed-class-table:export')")
|
|
@ApiAccessLog(operateType = EXPORT)
|
|
public void exportFixedClassTableExcel(@Valid FixedClassTablePageReqVO pageReqVO,
|
|
HttpServletResponse response) throws IOException {
|
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
List<FixedClassTableDO> list = fixedClassTableService.getFixedClassTablePage(pageReqVO).getList();
|
|
// 导出 Excel
|
|
ExcelUtils.write(response, "固定班级.xls", "数据", FixedClassTableRespVO.class,
|
|
BeanUtils.toBean(list, FixedClassTableRespVO.class));
|
|
}
|
|
|
|
// ==================== 子表(宿舍规则记录) ====================
|
|
|
|
@GetMapping("/dorm-rule-records/list-by-class-id")
|
|
@Operation(summary = "获得宿舍规则记录列表")
|
|
@Parameter(name = "classId", description = "班级id")
|
|
@PreAuthorize("@ss.hasPermission('zhuguang:fixed-class-table:query')")
|
|
public CommonResult<List<DormRuleRecordsDO>> getDormRuleRecordsListByClassId(@RequestParam("classId") Long classId) {
|
|
return success(fixedClassTableService.getDormRuleRecordsListByClassId(classId));
|
|
}
|
|
|
|
// ==================== 子表(晚自习规则记录) ====================
|
|
|
|
@GetMapping("/night-rule-record/list-by-class-id")
|
|
@Operation(summary = "获得晚自习规则记录列表")
|
|
@Parameter(name = "classId", description = "班级的id")
|
|
@PreAuthorize("@ss.hasPermission('zhuguang:fixed-class-table:query')")
|
|
public CommonResult<List<NightRuleRecordDO>> getNightRuleRecordListByClassId(@RequestParam("classId") Long classId) {
|
|
return success(fixedClassTableService.getNightRuleRecordListByClassId(classId));
|
|
}
|
|
|
|
// ==================== 子表(学生信息) ====================
|
|
|
|
@GetMapping("/student/list-by-class-id")
|
|
@Operation(summary = "获得学生信息列表")
|
|
@Parameter(name = "classId", description = "班级ID")
|
|
@PreAuthorize("@ss.hasPermission('zhuguang:fixed-class-table:query')")
|
|
public CommonResult<List<StudentDO>> getStudentListByClassId(@RequestParam("classId") Long classId) {
|
|
return success(fixedClassTableService.getStudentListByClassId(classId));
|
|
}
|
|
|
|
} |