dev add method link
Test Workflow / test (push) Has been cancelled

This commit is contained in:
2026-05-05 14:43:28 +07:00
parent cdc45e400d
commit d98a5ce692
3 changed files with 65 additions and 3 deletions
@@ -28,6 +28,16 @@ public interface DockViewRepository extends JpaRepository<DockView, Long> {
@Query("SELECT dv FROM DockView dv WHERE dv.fileId IN :fileIds")
Page<DockView> findAllByFileIds(@Param("fileIds") List<String> fileIds, Pageable pageable);
@Query("SELECT " +
"COUNT(dv) as totalViews, " +
"COUNT(DISTINCT dv.viewerIp) as uniqueIps, " +
"COUNT(DISTINCT dv.viewerId) as uniqueUsers, " +
"MAX(dv.createdAt) as lastViewDate, " +
"MIN(dv.createdAt) as firstViewDate " +
"FROM DockView dv " +
"WHERE dv.fileId IN :fileIds")
Optional<Object[]> findTotalViewsStatsByFileIds(@Param("fileIds") List<String> fileIds);
Page<DockView> findAllByViewerIdOrderByCreatedAtDesc(Long viewerId, Pageable pageable);
long countByFileId(String fileId);