package com.ym.mec.web.controller.system;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.ym.mec.biz.dal.page.StudentManageAttendanceQueryInfo;
import com.ym.mec.biz.dal.page.StudentManageCourseQueryInfo;
import com.ym.mec.biz.dal.page.StudentManageQueryInfo;
import com.ym.mec.biz.service.StudentManageService;
import com.ym.mec.common.controller.BaseController;

/**
 * @Author Joburgess
 * @Date 2019/9/19
 */
@Api(tags = "学生管理")
@RequestMapping("studentManage")
@RestController
public class StudentManageController extends BaseController {

    @Autowired
    private StudentManageService studentManageService;

    @ApiOperation(value = "获取学生列表")
    @GetMapping("/queryStudentList")
    public Object queryStudentList(StudentManageQueryInfo queryInfo){
        return succeed(studentManageService.findStudentsByOrganId(queryInfo));
    }

    @ApiOperation(value = "根据学生ID获取学生基本报名信息")
    @GetMapping("/findStudentBaseInfo")
    public Object findStudentBaseInfo(@ApiParam(value = "学生编号", required = true) @RequestParam Long userID){
        return succeed(studentManageService.findStudentManageBaseInfo(userID));
    }

    @ApiOperation(value = "根据学生ID获取其所在的乐团")
    @GetMapping("/findStudentMusicGroups/{userID}")
    public Object findStudentMusicGroups(@ApiParam(value = "学生编号", required = true) @PathVariable("userID") Long userID){
        return succeed(studentManageService.findStudentMusicGroupsByUserId(userID));
    }

    @ApiOperation(value = "根据乐团获取排课列表")
    @GetMapping("/findStudentCourses")
    public Object findStudentCourses(StudentManageCourseQueryInfo queryInfo){
        return succeed(studentManageService.findStudentCourseList(queryInfo));
    }

    @ApiOperation(value = "获取学生签到列表")
    @GetMapping("/findStudentAttendances")
    public Object findStudentAttendances(StudentManageAttendanceQueryInfo queryInfo){
        return succeed(studentManageService.findStudentAttendances(queryInfo));
    }

    @ApiOperation(value = "获取学生vip课")
    @GetMapping("/findStudentVipGroups")
    public Object findStudentVipGroups(Long userId){
        return succeed(studentManageService.findStudentVipGroups(userId));
    }

    @ApiOperation(value = "获取用户默认账户基本信息")
    @GetMapping("/getUserCashAccountBaseInfo/{userID}")
    public Object getUserCashAccountBaseInfo(@PathVariable("userID") Long userID){
        return succeed(studentManageService.getStudentAccountBaseInfo(userID));
    }

}
