package com.ruoyi.ie.mapper;

import com.ruoyi.ie.domain.Questions;
import org.apache.ibatis.annotations.Param;

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

/**
 * 试题Mapper接口
 *
 * @author mingxue
 * @date 2021-06-19
 */
public interface QuestionsMapper
{

    public List<Questions> selectSimilarQuestions(Map cond);

    public List<Questions> selectQuestionsByPaperId(Map map);
    public List<Questions> selectQuestionsByAiPaperId(Map map);
    public List<Questions> selectQuestionsByHomeworkPaperId(Map map);
    public List<Questions> selectQuestionsByZtPaperId(Map map);
    public List<Questions> selectQuestionsByMxjbPaperId(Map map);

    /**
     * 查询试题
     *
     * @param id 试题ID
     * @return 试题
     */
    public Questions selectQuestionsById(Long id);

    public List<Questions> selectQuestionsByPids(Integer[] id);
    /**
     * 查询试题列表
     *
     * @param questions 试题
     * @return 试题集合
     */
    public List<Questions> selectQuestionsList(Questions questions);
    public List<Questions> selectQuestionsFilter(Questions questions);
    public Integer selectQuestionsByMapCount(Map cond);
    public List<Questions> selectQuestionsByMap(Map cond);
    public Integer selectTestQuestionsByMapCount(Map cond);
    public List<Questions> selectTestQuestionsByMap(Map cond);
    public List<Questions> selectQuestionsForAiSubject(Map cond);

    public long selectTotalBySubjectId(@Param("subjectId")Integer subjectId);
    public long selectTotalOfCompleted(@Param("subjectId")Integer subjectId, @Param("userId")Long userId);
    public long selectTotalOfLatestRight(@Param("subjectId")Integer subjectId, @Param("userId")Long userId);
    public List<Questions> selectLatestRates(@Param("subjectId")Integer subjectId, @Param("userId")Long userId);

    /**
     * 新增试题
     *
     * @param questions 试题
     * @return 结果
     */
    public int insertQuestions(Questions questions);

    /**
     * 修改试题
     *
     * @param questions 试题
     * @return 结果
     */
    public int updateQuestions(Questions questions);

    /**
     * 删除试题
     *
     * @param id 试题ID
     * @return 结果
     */
    public int deleteQuestionsById(Long id);

    /**
     * 批量删除试题
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteQuestionsByIds(Long[] ids);

    /**
     * 批量更新qtpye
     * @param ids
     * @return
     */
    public int updateBatchQtpyeByIds(@Param("ids")Long[] ids,@Param("qtpye")String qtpye);

    int getQuestionsCountByChapterIds(@Param("chapterIds")List<Long> chapterIds);

    List<Questions> getPaperByChapterId(@Param("number")Integer number, @Param("qtype")String qtype,
                                                      @Param("chapterId")Long chapterId, @Param("difficulty")Integer difficulty);

//    List<QuestionsQueryResultDto> getPaperByChapterId2(@Param("basicId")Integer basicId,@Param("qtype")String qtype, @Param("number")Integer number, @Param("difficulty")Integer difficulty);

    List<Questions> getPaperByKnowledgeLevelId(@Param("number")Integer number, @Param("qtype")String qtype,
                                                             @Param("ids")Long[] ids, @Param("difficulty")Integer difficulty);

    List<Questions> getPaperQuestionList(Questions body);

    List<Questions> getPaperQuestionListByPaperId(Long paperId);

    public List<Questions> listQuestionsByPaperId(@Param("paperId") Long paperId);

    List<Questions> getPaperQuestionListByKnowledge(Questions body);

    List<Questions> getQuestionListByIds(String[] ids);

    List<Questions> selectIdsByIdGreaterThan(Long id);
    List<Questions> selectIdsByIdGreaterThan2(Long id);

    List<Questions> getPaperQuestionListBySubject(Questions body);

    public List<Questions> selectByChapterTreeOldids(Questions query);

    public List<Questions> selectByKnowledgeTreeOldids(Questions query);

    public List<Questions> selectByChapterTreeChineseAndEnglish(Questions query);

    public List<Questions> getQuestionsByChapterForParactice(Questions questions);


    public List<Questions> getQuestionsByKnowledgeForParactice(Questions questions);

    public List<Questions> selectCollectedList(Questions questions);

    public List<Questions> selectWrongQuestions(Questions questions);

    public List<Questions> selectCollectInfo(Map<String, Object> map);

    public List<Questions> selectByKnowledgeIds(Questions questions);

    public List<Questions> selectByIds(Map<String, Object> map);

    public List<Questions> getQuestionsByChapterForParacticeChineseAndEnglish(Questions query);
}
