package com.xhkjedu.sstudy.mapper.question;

import com.xhkjedu.base.TkMapper;
import com.xhkjedu.sstudy.model.question.TQuestion;
import com.xhkjedu.sstudy.vo.question.QuestionVo;
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 [question]
     * @Author ywx
     * @Date 2020/6/9 8:48
     * @return java.util.List<com.xhkjedu.model.question.TQuestion>
     **/
    List<Map<String, Object>> 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);
    //复合题子题分享集团校用
    List<TQuestion> listSonQuestionsForShare(@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<String, Object>> 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);

    //子题集合
    List<Map<String, String>> listSonQuestionForSelect(@Param("questionids") String questionids);

    //获取试题详情及关联章节、知识点、伙伴校
    TQuestion getQuestionAndDirectorPointById(String questionid);

    //获取分享的伙伴校
    List<Map<String, Object>> listSharePartnerSchool(@Param("questionid") String questionid);

    //更新分享过伙伴校试题的时间
    void batchUpdateTime(@Param("list") List<Integer> schoolIds, @Param("shareqid") String shareqid
            ,@Param("timestamp") int timestamp);

    //试题是否分享过
    List<Map<String, String>> listShareNumByIds(@Param("shareqids") String shareqids);
}
