<?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="vip.xiaonuo.disk.mapper.FileStasticMapper">
   <select id="queryList" resultType="map">
       SELECT
           b.file_type_id fileTypeId,
           count(a.user_file_id) userFileId,
           sum(f.file_size) fileSizeNum
       FROM
           userfile a
               LEFT JOIN fileclassification b ON
               a.extend_name = b.file_extend_name
               LEFT JOIN FILE f ON
               a.file_id = f.file_id
       WHERE
           a.user_id = #{userId}
         AND a.is_dir = 0
         AND f.FILE_STATUS = 1
       GROUP BY
           b.file_type_id
   </select>
</mapper>
