<?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="top.xinsin.dao.FileDownloadMapper">
    <select id="getFileName" parameterType="top.xinsin.pojo.FileObject" resultType="java.lang.String">
        select name
        from file
        where md5 = #{md5};
    </select>
    <select id="getAllFileNames" resultType="top.xinsin.pojo.FileObject">
        select f.id, f.size, f.`name`, f.md5, f.uploadTime, u.username as uploaderName
        from file f
                 INNER JOIN `user` u on u.id = f.uploaderId
        LIMIT #{min_id} ,#{pageSize}
    </select>
    <select id="selectFileCount" resultType="java.lang.Integer">
        select count(*)
        from file;
    </select>
</mapper>