@@ -7,6 +7,7 @@ import org.springframework.stereotype.Repository;
|
||||
import ru.soune.nocopy.entity.file.FileEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Repository
|
||||
public interface ImageSimilarityRepository
|
||||
@@ -60,6 +61,31 @@ public interface ImageSimilarityRepository
|
||||
@Param("userId") Long userId
|
||||
);
|
||||
|
||||
@Query(value = """
|
||||
SELECT
|
||||
f.id AS id,
|
||||
f.original_file_name AS originalFileName,
|
||||
f.file_size AS fileSize,
|
||||
f.user_id AS userId,
|
||||
f.support_id AS supportId,
|
||||
f.created_at AS uploadDate,
|
||||
f.protection_status AS protectionStatus,
|
||||
f.file_extension AS extension,
|
||||
h.hash64_hi AS hash64Hi,
|
||||
h.hash64_lo AS hash64Lo
|
||||
FROM image_hashes ref
|
||||
JOIN image_hashes h
|
||||
ON ref.file_id <> h.file_id
|
||||
JOIN file_entities f
|
||||
ON f.id = h.file_id
|
||||
WHERE ref.file_id = :fileId AND f.user_id IN :userIds
|
||||
""",
|
||||
nativeQuery = true)
|
||||
List<SimilarImageProjection> findCandidatesFromUserFiles(
|
||||
@Param("fileId") String fileId,
|
||||
@Param("userId") Set<Long> userIds
|
||||
);
|
||||
|
||||
|
||||
@Query(value = """
|
||||
SELECT
|
||||
|
||||
Reference in New Issue
Block a user