<?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.ResourceUserFileMapper">

    <select id="selectUserFileByLikeRightFilePath" resultType="vip.xiaonuo.disk.domain.ResourceUserFile">
        select * from RESOURCE_USERFILE
        where (FILE_PATH = #{filePath} or FILE_PATH like concat(#{filePath},'/%')) and USER_ID = #{userId} and DELETE_FLAG = 0
    </select>


    <select id="selectStorageSizeByUserId" resultType="java.lang.Long" parameterType="java.lang.String">
        SELECT SUM(FILE_SIZE) FROM RESOURCE_USERFILE
                                       LEFT JOIN RESOURCE_FILE ON RESOURCE_FILE.FILE_ID = RESOURCE_USERFILE.FILE_ID
        WHERE RESOURCE_USERFILE.USER_ID = #{userId}
    </select>


</mapper>
