package com.ym.mec.student.controller;

import com.ym.mec.auth.api.entity.SysUser;
import com.ym.mec.biz.dal.page.SysMusicCompareRecordQueryInfo;
import com.ym.mec.biz.service.SysMusicCompareRecordService;
import com.ym.mec.biz.service.SysUserService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.entity.HttpResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Joburgess
 * @Date 2021/8/11 0011
 */
@Api("云教练")
@RestController
@RequestMapping("cloudStudy")
public class CloudStudyController extends BaseController {

    @Autowired
    private SysUserService sysUserService;
    @Autowired
    private SysMusicCompareRecordService sysMusicCompareRecordService;

    @ApiOperation("云教练排行榜")
    @GetMapping("rankingList")
    public HttpResponseResult rankingList(SysMusicCompareRecordQueryInfo queryInfo){
        SysUser sysUser = sysUserService.getUser();
        queryInfo.setUserId(sysUser.getId());
        queryInfo.setOrganId(sysUser.getOrganId());
        return succeed(sysMusicCompareRecordService.rankingList(queryInfo));
    }

    @ApiOperation("学员训练数据统计")
    @GetMapping("studentTrainData")
    public HttpResponseResult studentTrainData(SysMusicCompareRecordQueryInfo queryInfo){
        queryInfo.setUserId(sysUserService.getUserId());
        return succeed(sysMusicCompareRecordService.studentTrainData(queryInfo));
    }

}
