package com.xhkjedu.sstudy.mapper.question;

import com.xhkjedu.sstudy.base.TkMapper;
import com.xhkjedu.sstudy.model.question.TQuestion;
import com.xhkjedu.sstudy.vo.question.QuestionVo;
import com.xhkjedu.sstudy.vo.question.SelectQuestionVo;
import org.apache.ibatis.annotations.Param;

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

public interface QuestionMapper extends TkMapper<TQuestion> {
    /**
     * 批量更新试题信息
     * @Param [oldQuestion]
     * @Author ywx
     * @Date 2020/6/6 16:59
     * @return java.lang.Integer
     **/
    Integer updateBatch(List<TQuestion> oldQuestion);

    /**
     * 修改试题状态
     * @Param [qstate, delQuestionId]
     * @Author ywx
     * @Date 2020/6/8 15:48
     * @return void
     **/
    Integer updateQuestionState(@Param("qstate") int qstate, @Param("delQuestionId") String delQuestionId);

    /**
     * 试题知识点列表
     * @Param [qs]
     * @Author ywx
     * @Date 2020/6/8 16:37
     * @return java.util.List<com.xhkjedu.vo.question.QuestionVo>
     **/
    List<QuestionVo> listQuestions(@Param("questions") List<QuestionVo> questions);

    /**
     * 列表
     * @Param [question]
     * @Author ywx
     * @Date 2020/6/9 8:48
     * @return java.util.List<com.xhkjedu.model.question.TQuestion>
     **/
    List<TQuestion> findAll(@Param("question") TQuestion question);

    /**
     * 更新单个试题状态
     * @Param [questionid, qstate]
     * @Author ywx
     * @Date 2020/6/9 9:31
     * @return java.lang.Integer
     **/
    Integer updateState(@Param("questionid") String questionid, @Param("qstate") Integer qstate);

    /**
     * 详情
     * @Param [questionid]
     * @Author ywx
     * @Date 2020/6/9 10:11
     * @return com.xhkjedu.model.question.TQuestion
     **/
    QuestionVo findById(@Param("questionid") String questionid);
    //复合题子题
    List<Map> listSonQuestionsForDetail(@Param("questionid") String questionid);

    /**
     * 章节、知识点选题
     * @Param [question]
     * @Author ywx
     * @Date 2020/6/9 15:00
     * @return java.util.List<com.xhkjedu.vo.question.SelectQuestionVo>
     **/
    List<Map> listForSelect(@Param("question") TQuestion question);


    /**
     * 更新组题次数
     * @Param [questionid]
     * @Author ywx
     * @Date 2020/6/9 15:29
     * @return java.lang.Integer
     **/
    Integer updateCount(@Param("questionid") String questionid);

    /**
     * @Description 批量保存试题
     * @Param [list]
     * @Return void
     * @Author wn
     * @Date 2022/7/25 16:55
     **/
    void saveBathQuestion(@Param("list") List<TQuestion> list);

    //获取科目下听力题数量
    Integer getQuestionHasHearNum(@Param("subjectid")String subjectid);
}
