package com.yonge.cooleshow.biz.dal.dao;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.yonge.cooleshow.biz.dal.entity.SysMusicCompareWeekData;
import com.yonge.cooleshow.biz.dal.queryInfo.SysMusicCompareRecordQueryInfo;
import com.yonge.cooleshow.biz.dal.wrapper.StatGroupWrapper;
import com.yonge.cooleshow.biz.dal.wrapper.TeacherIndexWrapper;
import com.yonge.cooleshow.biz.dal.wrapper.music.MusicCompareWrapper;
import org.apache.ibatis.annotations.Param;

import com.yonge.cooleshow.biz.dal.dto.StudentTrainChartDto;
import com.yonge.cooleshow.biz.dal.dto.StudentTrainOverviewDto;
import com.yonge.cooleshow.biz.dal.entity.SysMusicCompareRecord;
import com.yonge.cooleshow.biz.dal.enums.HeardLevelEnum;
import com.yonge.toolset.mybatis.dal.BaseDAO;

public interface SysMusicCompareRecordDao extends BaseDAO<Long, SysMusicCompareRecord> {

	//获取用户最后一次评测数据
	SysMusicCompareRecord getUserLastEvaluationData(@Param("userId") Long userId);

	//获取用户训练总览
	StudentTrainOverviewDto getUserTrainOverView(@Param("userId") Long userId, @Param("clientId") String clientId);

	//获取用户训练图表数据
	List<StudentTrainChartDto> getUserTrainChartData(@Param("userId") Long userId, @Param(
			"startTime") String startTime, @Param("endTime") String endTime, @Param("clientId") String clientId);

	int countMusicGroupStudentTrainData(Map<String, Object> params);


	//统计分部小酷Ai新增人数
	int getOrganNewCloudStudyNum(@Param("organId") Integer organId);

	int getOrgansTotalNewCloudStudyNum(@Param("organIds") List<Integer> organIds);

	List<Map<Integer, Integer>> getOrgansNewCloudStudyNum(@Param("organIds") List<Integer> organIds);

	//获取用户本周最高分对应曲目编号
	Integer getUserWeekMaxMusicScoreId(@Param("userId") Long userId, @Param("monday") String monday, @Param("heardLevel") HeardLevelEnum heardLevel);

	//曲目练习记录统计
	List<StatGroupWrapper> selectMusicCompareRecordStatInfo(@Param("record") MusicCompareWrapper.RecordQueryInfo queryInfo);

	//小程序学员训练统计列表
    int countWeChatStudentTrainData(Map<String, Object> params);

	//小程序学员训练统计列表
	List<SysMusicCompareRecordQueryInfo.WechatCompareRecordPageDto> queryWeChatStudentTrainData(Map<String, Object> params);

	//小程序学员训练统计
	SysMusicCompareRecordQueryInfo.WechatCompareRecordSumDto wechatCompareRecordSum(@Param("queryInfo") SysMusicCompareRecordQueryInfo.WechatCompareRecordQueryInfo queryInfo);

	//小程序学员评测列表
    List<SysMusicCompareRecordQueryInfo.StudentMusicCompareRecord> queryStudentTrain(Map<String, Object> params);

	//小程序学员评测列表
	int countStudentTrain(Map<String, Object> params);

	SysMusicCompareRecordQueryInfo.StudentMusicCompareRecordStat studentMusicCompareRecordStat(@Param("query") SysMusicCompareRecordQueryInfo.StudentMusicCompareRecordQuery query);

	//学生端训练统计
	SysMusicCompareRecordQueryInfo.StudentMusicCompareRecordDto studentTrainStat(@Param("query") SysMusicCompareRecordQueryInfo.StudentMusicCompareRecordQuery query);

	//统计用户指定周训练数据
	SysMusicCompareWeekData getUserWeekCompareData(@Param("userId") Long userId,
												   @Param("monday") String monday);

    List<SysMusicCompareRecord> selectByIds(@Param("musicPracticeRecordIds") List<Long> musicPracticeRecordIds);

    Long countStudentPracticeTime(@Param("userId") Long userId, @Param("monday") String monday, @Param("sunday") String sunday);

    TeacherIndexWrapper.PracticeSummaryDto getStudentTrainOverView(@Param("studentIds") List<Long> studentIds,
																   @Param("param") TeacherIndexWrapper.SummarySearch summarySearch);

	List<TeacherIndexWrapper.PracticeTimeDto> getStudentTrainTime(@Param("studentIds") List<Long> studentIds,
																  @Param("param") TeacherIndexWrapper.SummarySearch summarySearch,
																  @Param("groupBy") String groupBy);

    List<TeacherIndexWrapper.PracticeTimeDto> getStudentTrainCount(@Param("studentIds") List<Long> studentIds,
																   @Param("param") TeacherIndexWrapper.SummarySearch summarySearch,
																   @Param("groupBy") String groupBy);

	List<TeacherIndexWrapper.StudentPracticeSummaryDto> getStudentTrainOverViewList(@Param("studentIds") List<Long> studentIds,
																					@Param("param") TeacherIndexWrapper.StudentSearch studentSearch);
}
