package com.xhkjedu.smarking.mapper.stupaper;

import com.xhkjedu.base.TkMapper;
import com.xhkjedu.smarking.model.paper.MsPaperQtypeQuestion;
import com.xhkjedu.smarking.model.stupaper.MsPaperStudentBlock;
import com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion;
import com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestionScore;
import com.xhkjedu.smarking.vo.paper.SQScoreVo;
import com.xhkjedu.smarking.vo.stupaper.QuestionAnswerVo;
import org.apache.ibatis.annotations.Param;

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

/**
 * @Description 阅卷试卷学生试题表 Mapper 接口
 * @Author auto
 * @Date 2024-10-15
 */
public interface MsPaperStudentQuestionMapper extends TkMapper<MsPaperStudentQuestion> {

    //学生考试-单题正确答案及分值
    QuestionAnswerVo getPaperQuestionAnswer(@Param("mpsqid")Integer mpsqid);
    //学生考试-提交单题
    Integer updateStudentAnswer(@Param("q")MsPaperStudentQuestion q);
    //学生考试--提交单题组-试题组正确答案及分值
    List<QuestionAnswerVo> listPaperQuestionAnswers(@Param("mpsid")Integer mpsid);
    //学生考试-提交单题组
    Integer updateBatchStudentAnswer(@Param("list") List<MsPaperStudentQuestion> list);
    //学生考试-提交试卷-试卷中未合并图片
    List<MsPaperStudentQuestion> listStuQuestionStuAnswerPic(@Param("mpsid") Integer mpsid);
    //学生考试-提交试卷-生产学生题块-试卷中所有试题
    List<MsPaperStudentQuestion> listStuQuestionsByMpsid(@Param("mpsid") Integer mpsid);
    //学生考试-提交试卷-修改未提交试题为已批阅
    int updateStuQuestionsNoCommit(@Param("mpsid") Integer mpsid,@Param("timestamp") Integer timestamp);

    //试卷答案-客观题-批量更新学生提交指定试题是否需要重新批改
    Integer updateBatchStuQuesNeeddeal(@Param("mpid") Integer mpid,@Param("list")List<MsPaperQtypeQuestion> list);
    //试卷答案-客观题-获取试卷中指定试题作答情况
    List<MsPaperStudentQuestion> listPaperStudentQuestionsByMptqid(@Param("mpid") Integer mpid,@Param("mptqid") Integer mptqid,@Param("limitnum") Integer limitnum);
    //试卷答案-客观题-批量更新试卷中试题分值
    int updateBatchStuQuestionScore(@Param("list")List<MsPaperStudentQuestion> list);

    //批量更新批改人ID
    void batchUpdateCheckId(@Param("list") List<MsPaperStudentBlock> blocks);
    //扫描-保存识别学生答案
    Integer updateBatchStuAnswerForScan(@Param("list") List<MsPaperStudentQuestion> list);
    //扫描记录-查看原卷-客观题保存-获取学生答案
    List<MsPaperStudentQuestion> listStuQuestionsByMspidAnbBlockid(@Param("mspid") Integer mspid,@Param("mblockid") Integer mblockid);

    //更新学生单题批阅信息
    void checkByMptqidAndStudentId(@Param("list") List<MsPaperStudentQuestion> list,@Param("block") MsPaperStudentBlock block);

    //修改分数-批量修改分值
    int updateBatchStuscore(@Param("list") List<MsPaperStudentQuestionScore> list);

    //学生试卷-题型试题、作答、得分情况（题库）
    List<Map<String,Object>> listStuPaperQtypeQueAnswerForWebTk(@Param("mpsid")Integer mpsid);
    //学生试卷-题型试题、作答、得分情况（附件）
    List<Map<String,Object>> listStuPaperQtypeQueAnswerForWebFj(@Param("mpsid")Integer mpsid);

    //定时任务-获取学生答案待合并试题
    List<MsPaperStudentQuestion> listNoMergeStupic();
    //批量保存学生试题
    void saveBatchStuPaperQuestion(@Param("list") List<MsPaperStudentQuestion> list);

    //获取考试所有参考学生作答情况
    List<MsPaperStudentQuestion> listAllStuQuesByExamid(@Param("examid") Integer examid,@Param("subjectid")String subjectid);

    //获取参与统计科目单题得分情况
    List<SQScoreVo> listByMpIds(@Param("mpids") List<Integer> mpids);
}
