<?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.sstudy.mapper.paper.PaperFileMapper">

    <!-- 根据作业id删除作业附件 -->
    <delete id="deleteByPaperid">
        DELETE FROM t_paper_file WHERE paperid=#{paperid}
    </delete>

    <!-- 根据作业id获取作业附件 -->
    <select id="listObjsByPaperid" resultType="com.xhkjedu.sstudy.model.paper.TPaperFile">
        SELECT pfid,paperid,filepath,fileclass,fileorder,createtime
        FROM t_paper_file WHERE paperid=#{paperid} ORDER BY fileorder asc
    </select>
    <!--获取作业文件夹-->
    <select id="listFolder" resultType="java.lang.String">
        SELECT SUBSTRING_INDEX(sourcepath,'/',5) FROM t_paper_file WHERE paperid=#{paperid} GROUP BY fileclass
    </select>
</mapper>
