package com.qmth.teachcloud.report.api;


import com.qmth.boot.api.constant.ApiConstant;
import com.qmth.teachcloud.common.util.Result;
import com.qmth.teachcloud.common.util.ResultUtil;
import com.qmth.teachcloud.report.business.bean.result.TBExamStudentResult;
import com.qmth.teachcloud.report.business.bean.result.TeacherClassRankResult;
import com.qmth.teachcloud.report.business.bean.result.TeacherMyClassRankResult;
import com.qmth.teachcloud.report.business.enums.OrderEnum;
import com.qmth.teachcloud.report.business.enums.SemesterEnum;
import com.qmth.teachcloud.report.business.service.TAExamCourseCollegeTeacherService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 参考课程学院下授课教师维度分析表 前端控制器
 * </p>
 *
 * @author wangliang
 * @since 2021-06-01
 */
@Api(tags = "教研分析教师模板Controller")
@RestController
@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/${prefix.url.reportSchool}/teacher")
public class TAExamCourseCollegeTeacherController {

    @Autowired
    private TAExamCourseCollegeTeacherService taExamCourseCollegeTeacherService;

    @ApiOperation(value = "教师各课堂成绩排名")
    @RequestMapping(value = "/list_class_rank", method = RequestMethod.POST)
    @ApiResponses({@ApiResponse(code = 200, message = "教师各课堂成绩排名", response = TeacherClassRankResult.class)})
    public Result listClassRank(
            @ApiParam(value = "学期", required = true) @RequestParam SemesterEnum semester,
            @ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
            @ApiParam(value = "课程代码", required = false) @RequestParam(required = false) String courseCode,
            @ApiParam(value = "考查学院ID", required = false) @RequestParam(required = false) Long inspectCollegeId,
            @ApiParam(value = "分页页码", required = true) @RequestParam Integer pageNumber,
            @ApiParam(value = "分页数量", required = true) @RequestParam Integer pageSize,
            @ApiParam(value = "排序列", required = false) @RequestParam(required = false) String column,
            @ApiParam(value = "排序规则", required = false) @RequestParam(required = false) OrderEnum order) {
        return ResultUtil.ok(taExamCourseCollegeTeacherService.listClassRank(semester, examId, courseCode, inspectCollegeId, pageNumber, pageSize, column, order));
    }

    @ApiOperation(value = "我的课堂考成绩排名")
    @RequestMapping(value = "/list_myclass_rank", method = RequestMethod.POST)
    @ApiResponses({@ApiResponse(code = 200, message = "我的课堂考成绩排名", response = TeacherMyClassRankResult.class)})
    public Result listMyClassRank(
            @ApiParam(value = "学期", required = true) @RequestParam SemesterEnum semester,
            @ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
            @ApiParam(value = "课程代码", required = false) @RequestParam(required = false) String courseCode,
            @ApiParam(value = "考查学院ID", required = false) @RequestParam(required = false) Long inspectCollegeId,
            @ApiParam(value = "分页页码", required = true) @RequestParam Integer pageNumber,
            @ApiParam(value = "分页数量", required = true) @RequestParam Integer pageSize,
            @ApiParam(value = "排序列", required = false) @RequestParam(required = false) String column,
            @ApiParam(value = "排序规则", required = false) @RequestParam(required = false) OrderEnum order) {
        return ResultUtil.ok(taExamCourseCollegeTeacherService.listMyClassRank(semester, examId, courseCode, inspectCollegeId, pageNumber, pageSize, column, order));
    }
}
