package com.ym.mec.education.controller;

import com.ym.mec.education.base.BaseResponse;
import com.ym.mec.education.base.PageResponse;
import com.ym.mec.education.req.ClassGroupReq;
import com.ym.mec.education.req.StudentReq;
import com.ym.mec.education.service.IClassGroupStudentMapperService;
import com.ym.mec.education.service.ICourseScheduleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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;

/**
 * @program: mec
 * @description: 学员名单
 * @author: xw
 * @create: 2019-09-26 19:40
 */
@RestController
@RequestMapping("api/student")
@Api(tags = "学员名单")
@Slf4j
public class StudentController {

    @Autowired
    private IClassGroupStudentMapperService groupStudentMapperService;
    @Autowired
    private ICourseScheduleService courseScheduleService;

    @PostMapping("/list")
    @ApiOperation("学员名单列表")
    public PageResponse list(@RequestBody ClassGroupReq classGroupReq) {
        return groupStudentMapperService.getPage(classGroupReq);
    }

    @PostMapping("/listByTeacher")
    @ApiOperation("根据当前登录人查询对应学员名单列表")
    public PageResponse listByTeacher(@RequestBody StudentReq studentReq) {
        return groupStudentMapperService.getPageByTeacher(studentReq);
    }

    @PostMapping("/info")
    @ApiOperation("根据学员id查询详情")
    public BaseResponse info(@RequestBody StudentReq studentReq) {
        return groupStudentMapperService.getInfo(studentReq);
    }

    @PostMapping("/course")
    @ApiOperation("根据学员id查询进行中的课程计划和历史课程计划")
    public BaseResponse courseInfo(@RequestBody StudentReq studentReq) {
        return courseScheduleService.getCourseScheduleByStudent(studentReq);
    }

}
