This commit is contained in:
@@ -13,7 +13,8 @@ public interface ImageSimilarityRepository
|
||||
extends JpaRepository<FileEntity, String> {
|
||||
|
||||
@Query(value = """
|
||||
SELECT
|
||||
|
||||
SELECT
|
||||
f.id AS similarFileId,
|
||||
f.original_file_name AS originalFileName,
|
||||
f.file_size AS fileSize,
|
||||
@@ -30,6 +31,24 @@ public interface ImageSimilarityRepository
|
||||
List<SimilarImageProjection> findCandidates(
|
||||
@Param("fileId") String fileId
|
||||
);
|
||||
|
||||
@Query(value = """
|
||||
SELECT
|
||||
h.hash64_hi AS hash64Hi,
|
||||
h.hash64_lo AS hash64Lo,
|
||||
h.file_id AS fileId,
|
||||
f.user_id AS userId,
|
||||
f.original_file_name AS originalFileName,
|
||||
f.file_size AS fileSize,
|
||||
f.stored_file_name AS similarFileId
|
||||
FROM image_hashes h
|
||||
JOIN file_entities f ON f.id = h.file_id
|
||||
WHERE h.hash64_hi = :hash64Hi
|
||||
AND h.hash64_lo = :hash64Lo
|
||||
""",
|
||||
nativeQuery = true)
|
||||
List<SimilarImageProjection> findExactDuplicates(
|
||||
@Param("hash64Hi") Integer hash64_hi,
|
||||
@Param("hash64Lo") Integer hash64_lo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
package ru.soune.nocopy.repository;
|
||||
|
||||
public interface SimilarImageProjection {
|
||||
|
||||
String getSimilarFileId();
|
||||
|
||||
String getOriginalFileName();
|
||||
|
||||
Long getFileSize();
|
||||
|
||||
Integer getHash64Hi();
|
||||
|
||||
Integer getHash64Lo();
|
||||
String getFileId();
|
||||
Long getUserId();
|
||||
String getOriginalFileName();
|
||||
Long getFileSize();
|
||||
}
|
||||
Reference in New Issue
Block a user