package it.digione.dg1cloud.repository;
|
|
import java.util.List;
|
|
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 org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import it.digione.dg1cloud.model.RegDocument;
|
|
@Repository
|
@Transactional( propagation = Propagation.REQUIRED )
|
public interface RegDocumentRepository extends JpaRepository<RegDocument, Long> {
|
|
@Query("SELECT d FROM RegDocument d WHERE d.fileHash = :fileHash and d.fileName = :fileName and d.createdBy = :userName")
|
RegDocument findOneByHashAndName(@Param("fileHash") String fileHash, @Param("fileName") String fileName, @Param("userName") String userName);
|
|
@Query("SELECT d FROM RegDocument d WHERE CURRENT_DATE > d.dueDate")
|
List<RegDocument> findAllRegDocumentExpired();
|
|
@Query("SELECT d FROM RegDocument d WHERE d.customKey = :customKey and d.createdBy = :userName")
|
RegDocument findOneByCustomKey(@Param("customKey") String customKey, @Param("userName") String userName);
|
}
|