@@ -0,0 +1,24 @@
|
||||
package ru.soune.nocopy.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import ru.soune.nocopy.entity.violation.ViolationNotion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface ViolationNotionRepository extends JpaRepository<ViolationNotion, Long> {
|
||||
|
||||
@Query("SELECT vn FROM ViolationNotion vn " +
|
||||
"JOIN FETCH vn.user " +
|
||||
"WHERE vn.file.id = :fileId " +
|
||||
"ORDER BY vn.createdAt DESC")
|
||||
List<ViolationNotion> findByFileId(@Param("fileId") String fileId);
|
||||
|
||||
@Query("SELECT COUNT(vn) FROM ViolationNotion vn WHERE vn.file.id = :fileId")
|
||||
long countByFileId(@Param("fileId") String fileId);
|
||||
|
||||
void deleteByFileId(String fileId);
|
||||
}
|
||||
Reference in New Issue
Block a user