<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhkjedu.sexam.mapper.paper.EPaperFileMapper">

    <!--获取文件附件-->
    <select id="listPaperFiles" resultType="java.util.Map">
        select * from e_paper_file where epid=#{epid}
    </select>
    <!--获取题干文件-->
    <select id="listPaperStemFile" resultType="java.util.Map">
        select * from e_paper_file where epid=#{epid} and fileclass=1
    </select>
    <!--删除-->
    <delete id="deleteByEpid">
        delete from e_paper_file where epid=#{epid}
    </delete>
    <!--删除答案附件-->
    <delete id="delAnswerFile">
        delete from e_paper_file where epid=#{epid} and fileclass=2
    </delete>

    <!--获取文件信息-->
    <select id="listPaperFilesByEpsid" resultType="java.util.Map">
        select f.* from e_paper_file f
        left join e_paper_student ps on f.epid=ps.epid
        where ps.epsid=#{epsid} group by f.epfid order by fileorder
    </select>

    <!--获取题干原文件-->
    <select id="listPaperSourceFilesByEpsid" resultType="java.util.Map">
        select f.sourcepath from e_paper_file f
        left join e_paper_student ps on f.epid=ps.epid
        where ps.epsid=#{epsid} and f.fileclass=1 group by f.sourcepath order by fileorder
    </select>

    <!--更改试卷原文件-->
    <update id="updateSourcepathByEpid">
        update e_paper_file set sourcepath=#{sourcepath} where epid=#{epid}
    </update>

</mapper>
