package com.ssj.dao.kmt.kmt.dao;


import com.ssj.bean.kmt.kmt.domain.KmtQuestion;
import com.ssj.bean.kmt.kmt.dto.CourseHandoutTemplate;
import com.ssj.bean.kmt.kmt.dto.LessonGroupDTO;
import com.ssj.service.kmt.dto.KmtSysUserDTO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

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

public interface KmtQueryDao {
	
	List<Map<String, Object>> findStudentByList(String teacherId, String name, String grade);

	/**
	 * kmt学员管理
	 * @param teacherId
	 * @param name
	 * @param grade
	 * @return
	 */
	List<Map<String, Object>> findSimpleStudentByList(String teacherId, String name, String grade);
	
	List<Map<String, Object>> findLibVipByList(String name);
	
	List<Map<String, Object>> findHowByCourseNameByName(String libId, String courseName, String grade, String semester, String type, String name);

	List<Map<String, Object>> findQuestionByList(String[] howId, String optionType, Integer type, Integer easyily, Integer medium, Integer hard, List<String> notQuIds);
	
	List<Map<String, Object>> findQuestionEasyByList(String[] howId, String[] kbId, String optionType, Integer type, Integer easy, Integer size, List<String> notQuIds);
	
	List<Map<String, Object>> findPlanSpeedByList(String studentId, String type);
	
	List<Map<String,Object>> findCourseByList(String teacherId);
	
	List<Map<String,Object>> findCourseKnowDetailByList(String courseKnowId, Integer type);
	
	List<Map<String,Object>> findCourseQuestionDetailByList(String courseKnowId);
	
	List<Map<String,Object>> findKnowDetailByIdList(String[] howId);
	
	List<Map<String,Object>> findImgByQuList(String faceId);
	
	List<Map<String, Object>> findExamineByQuList(String grade, String courseName,
                                                  String type, Integer page, Integer pageSize, Integer state, String username, String howId, String kdId, String quids, String source);
	
	Map<String, Object> loginImport(String loginName, String password);
	
	void insertLogin(String loginName, String password, String name, String auth, String type);
	
	List<Map<String, Object>> findUserByNameList(String name);
	
	List<Map<String, Object>> findQuestionByList(String courseName, Integer page, Integer pageSize);
	
	
	List<Map<String, Object>> findKbByHowDetailsIdList(String howDetailsId);
	
	List<Map<String, Object>> findKBByList(String libId, String courseName, String grade, String semester, String type);
	
	
	List<Map<String, Object>> findHowByCourseNameByHowName(String libId, String courseName, String grade, String semester, String type, String name);



	List<Map<String, Object>> findKBByList(String[] howId, String grade, String semester, String type);
	List<Map<String, Object>> previousLesson(String courseHowId);
	
	List<Map<String, Object>> findQuestionByRandList(String[] howId, String[] kbId, String optionType, Integer type, Integer notType, Integer num, List<String> notQuIds);

	List<Map<String, Object>> findKBByKbIdList(String[] kbId, String hname);
	
	List<Map<String, Object>> findQuestionByChineseList(String[] howId, String[] kbId,
                                                        String optionType, Integer type, Integer easyily, Integer medium, Integer hard, List<String> notQuIds);
	
	List<Map<String, Object>> findQuestionReview(Integer num, String studentId, String courseName);
	
	List<Map<String, Object>> findKBByModularNameList(String[] kbId, String modularName);
	
	Integer queryNotExamineCount(Integer state);
	
	Integer queryQuTmpCount();
	
	List<Map<String,Object>> queryCountList();
	
	Map<String, Object> findExamineByQuId(String id, Integer type);

	List<Map<String,Object>> findKmtTeacherByPage();

	/**
	 * 查询在线老师
	 * @param params
	 * @param pageable
	 * @return
	 */
	Page<Map<String, Object>> findKmtTeacherByPage(Map<String, Object> params, Pageable pageable);
	
	Map<String,Object> findKmtTeacherByUserId(String userId);
	
	Map<String,Object> findKmtTeacherByUserIdAndCourse(String userId);

	/**
	 * 用科目随机查询一个在线老师
	 * @param courseName
	 * @return
	 */
	Map<String,Object> findOnLineTeacherByRand(String courseName);

	/**
	 * 根据年级和科目随机查询出一个在线老师
	 * @param courseName 科目
	 * @param grade 年级
	 * @return
	 */
	Map<String,Object> findOnLineTeacherByCourseNameAndGradeRand(String courseName, String grade);

	List<Map<String, Object>> findTimeAndWeekByVipId(String vipId);

	List<Map<String, Object>> getTeachCount(String[] teacherIds, int planStatus);

	List<Map<String, Object>> getTeachStudentCount(String[] teacherIds);
	
	List<Map<String, Object>> findFeedbackRatioMap(String courseKnowId);
	
	Integer findHowDetailsIdByAllCount(String zuoybKnowHowDetailId, String vipId, String courseKnowId);
	
	Integer findHowDetailsIdByWrongCount(String zuoybKnowHowDetailId, String vipId, String courseId);
	
	List<Map<String, Object>> findFeedbackWrongRatioMap(String courseId);
	List<Map<String,Object>> findCourseKnowIdMap(String courseKnowId);
	Integer countFeedBackNum();
	
	Map<String,Object> findKmtTeacherByUserIdAndOne(String userId);
	
	
	//整体的
	Map<String,List<Map<String, Object>>> findAllModularLatListMap(String vipId);
	//错的
	Map<String,List<Map<String, Object>>> findWrongModularLatListMap(String vipId);
	
	//技能整体的
	Map<String,List<Map<String, Object>>> findAllSkillLatListMap(String vipId);
	//技能错的
	Map<String,List<Map<String, Object>>> findWrongSkillLatListMap(String vipId);

	/**
	 * 查询所有有评价的老师的评价，算平均
	 * @return
	 */
	List<Map<String, Object>> findAllTeacherPraise();
	
	Integer queryKdQuCount(String kdId);
	
	Integer queryHowDetailsQuCount(String howDetailsId);
	
	List<Map<String, Object>> findFeedbackRatioVipMap();
	
	
	List<Map<String, Object>> findHowByHowName(String courseName, String grade, String semester, String howName);


	/**
	 * 查询一对一知识维度数据，维度+维度数量
	 * @param vipId
	 * @param subject
	 * @param beginTime
	 * @param endTime
	 * @return
	 */
	List<Map<String, Object>> get121KnowModuleData(String vipId, String subject, String beginTime, String endTime);

	/**
	 * 查询一对一知识维度错误的数量，维度+ 维度错误数量
	 * @param vipId
	 * @param subject
	 * @param beginTime
	 * @param endTime
	 * @return
	 */
	List<Map<String, Object>> get121WrongKnowModuleData(String vipId, String subject, String beginTime, String endTime);


	/**
	 * 查询一对一技能维度数据，所有出现过的技能，不去重，用于计算数量
	 * @param vipId
	 * @param subject
	 * @param beginTime
	 * @param endTime
	 * @return
	 */
	List<Map<String, Object>> get121SkillData(String vipId, String subject, String beginTime, String endTime);

	/**
	 * 查询一对一技能维度错误数据，所有出现过的技能，不去重，用于计算数量
	 * @param vipId
	 * @param subject
	 * @param beginTime
	 * @param endTime
	 * @return
	 */
	List<Map<String, Object>> get121SkillWrongData(String vipId, String subject, String beginTime, String endTime);
	List<Map<String, Object>> findWrongQuestionByCourseKnowId(String courseKnowId);
	Integer countAddUserNum(String addUserId, Integer state);
	Integer countAddUserBySettlementNum(String addUserId, Integer settlement);
	
	//查询数学科目的 单元，知识点，考点，的排序，只有题目关联了多个考点才会查询出来。
	List<Map<String, Object>> findMathByNum();
	
	

	List<Map<String, Object>> findLoadAllQuestionBySorl(String id, Integer page, Integer pageSize);
	
	//统计AI成的题目
	Integer countAICount();
	
	List<Map<String,Object>> findAIExport(Integer state);
	
	
	List<Map<String,Object>> findParentQuestionByHowId(String howDetailsId, String howDetailsKdId);
	
	
	public Integer countQuestionByParentId(String parentId);
	
	public void insertKmtQuestion(KmtQuestion kmtQuestion);
	
	List<CourseHandoutTemplate> findCourseHandoutTemplateList(String teacherId, String courseName, String courseHandoutTemplateName);
	
	public List<String> findKmtAiRecordByFileName();

	List<LessonGroupDTO> findLessonGroupList(String teacherId, String courseTime);

	List<Map<String, Object>> findLessonGroupStudentList(String groupCourseId, String timeStr);
	
	public List<Map<String, Object>> finishHandout(String lessonGroupId);
	
	/**
	 * 根据类型查询kmt管理员
	 * @param type SYS 审核员， QPM 题目加工员
	 */
	List<KmtSysUserDTO> getDistributeCondition(String type);

	Page<Map<String, Object>> findTbLibTeacherByPage(Map<String, Object> params, Pageable pageable);
}

