FileUrlMapper.xml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="cn.reghao.dfs.store.db.mapper.FileUrlMapper">
  4. <insert id="save" useGeneratedKeys="true" keyProperty="id">
  5. insert into file_url
  6. (`id`,`deleted`,`create_time`,`update_time`,`file_id`,`block_id`,`absolute_path`,`url`,`path`,`group`,`node`)
  7. values
  8. (#{id},#{deleted},#{createTime},#{updateTime},#{fileId},#{blockId},#{absolutePath},#{url},#{path},#{group},#{node})
  9. </insert>
  10. <update id="updateSetFileUrl">
  11. update file_url set update_time=now(),block_id=#{blockId},absolute_path=#{absolutePath}
  12. where file_id=#{fileId}
  13. </update>
  14. <select id="findAllVideoUrl" resultType="cn.reghao.dfs.store.model.po.FileUrl">
  15. select * from file_url
  16. where `group`=0 and node=0 and path like '%video/playback%';
  17. </select>
  18. <select id="findAllImageUrl" resultType="cn.reghao.dfs.store.model.po.FileUrl">
  19. select * from file_url
  20. where `group`=0 and node=0 and path like '%image%';
  21. </select>
  22. <select id="findByUploadId" resultType="cn.reghao.dfs.store.model.dto.FileUrlDto">
  23. select info.id,info.filename,url.path,url.url,url.absolute_path as absolutePath from file_url url
  24. inner join file_user fileUser
  25. inner join file_info info
  26. on fileUser.file_id=url.file_id and info.file_id=url.file_id and fileUser.upload_id=#{uploadId}
  27. limit 1
  28. </select>
  29. <select id="findByFileId" resultType="cn.reghao.dfs.store.model.po.FileUrl">
  30. select * from file_url where file_id=#{fileId}
  31. </select>
  32. <select id="findFileUrl" resultType="cn.reghao.dfs.store.model.po.FileUrl">
  33. select * from file_url where file_id=#{fileId} and `group`=#{group} and node=#{node}
  34. </select>
  35. </mapper>