Blame view

SubjectSemesterController.java 3.14 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
package com.meishu.controller;


import com.meishu.common.ResponseData;
import com.meishu.common.ResponseVO;
import com.meishu.dto.semester.GetSemesterScoreDTO;
import com.meishu.dto.semester.GetStudentDetailDTO;
import com.meishu.dto.semester.GetStudentRecordDTO;
import com.meishu.service.SubjectSemesterService;
import com.meishu.util.excel.ExcelUtil;
import com.meishu.vo.semester.GetSemesterScoreVO;
import com.meishu.vo.semester.GetStudentRecordVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Tuyp
 * @since 2021-08-11
 */
@RestController
@Api(tags = "学期表")
@RequestMapping("/semester")
public class SubjectSemesterController {

    @Autowired
    private SubjectSemesterService subjectSemesterService;

    @PostMapping("getAllStudyingSemester")
    @ApiOperation("获取所有在读班级")
    public ResponseVO getAllStudyingSemester(){
        return ResponseData.generateCreatedResponse(0,subjectSemesterService.getAllStudyingSemester());
    }

    @PostMapping("getAllPastSemester")
    @ApiOperation("获取所有归档班级")
    public ResponseVO getAllPastSemester(){
        return ResponseData.generateCreatedResponse(0,subjectSemesterService.getAllPastSemester());
    }


    @PostMapping("getSemesterScore")
    @ApiOperation("查看某个学期下的成绩  {pageSize  pageNum  grade  classes  session userName semester 上/下 subject 语文/数学....")
    public ResponseVO getSemesterScore(@RequestBody GetSemesterScoreDTO getSemesterScoreDTO){
        return ResponseData.generateCreatedResponse(0,subjectSemesterService.getSemesterScore(getSemesterScoreDTO));
    }

    @PostMapping("exportScore")
    @ApiOperation("导出筛选后的数据  { grade  classes  session  userName semester 上/下 subject 语文/数学....}")
    public void exportScore(@RequestBody GetSemesterScoreDTO getSemesterScoreDTO){
        List<GetSemesterScoreVO> getSemesterScoreVOS =  subjectSemesterService.exportScore(getSemesterScoreDTO);
        ExcelUtil.writeExcel(getSemesterScoreVOS,GetSemesterScoreVO.class);
    }

    @PostMapping("getStudentDetail")
    @ApiOperation("获取学生分数详情  {pageSize  pageNum  id 学科+学期id  userId 学生id}")
    public ResponseVO getStudentDetail(@RequestBody GetStudentDetailDTO getStudentDetailDTO){
        return ResponseData.generateCreatedResponse(0,subjectSemesterService.getStudentDetail(getStudentDetailDTO));
    }

    @PostMapping("getStudentRecord")
    @ApiOperation("获取学生扣分记录  {startDate endDate}")
    public void getStudentRecord(@RequestBody GetStudentRecordDTO getStudentRecordDTO){
        List<GetStudentRecordVO> getStudentRecordVOS = subjectSemesterService.getStudentRecord(getStudentRecordDTO);
        ExcelUtil.writeExcel(getStudentRecordVOS,GetStudentRecordVO.class);
    }

}