diff options
Diffstat (limited to 'SDNCReports/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/PreTestConfigRepository.java')
-rw-r--r-- | SDNCReports/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/PreTestConfigRepository.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/SDNCReports/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/PreTestConfigRepository.java b/SDNCReports/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/PreTestConfigRepository.java new file mode 100644 index 0000000..07472d9 --- /dev/null +++ b/SDNCReports/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/PreTestConfigRepository.java @@ -0,0 +1,34 @@ + +package com.onap.sdnc.reports.repository; + +import java.util.Date; +import java.util.List; + +import javax.transaction.Transactional; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import com.onap.sdnc.reports.model.PreTestConfig; + +@Repository +public interface PreTestConfigRepository extends JpaRepository<PreTestConfig, Long> { + + @Query(value= " from PreTestConfig where timestamp >= :startDate and timestamp <= :endDate" ) + List<PreTestConfig> findPreTestConfigByTimeStamp(@Param("startDate") Date startDate, @Param("endDate")Date endDate); + + + @Query(value= " from PreTestConfig where timestamp >= :startDate and timestamp <= :endDate and testName = :testName" ) + List<PreTestConfig> findReportByTestName(@Param("startDate") Date startDate, @Param("endDate")Date endDate, @Param("testName")String testName); + + @Query(value= " from PreTestConfig where timestamp >= :startDate and timestamp <= :endDate and device.deviceName = :deviceName" ) + List<PreTestConfig> findReportByDeviceName(@Param("startDate") Date startDate, @Param("endDate")Date endDate, @Param("deviceName")String deviceName); + + @Modifying + @Query(value = "insert into PreTestConfig (testName,result,execuationDetails,timestamp,deviceId) VALUES (:testName,:result,:execuationDetails,:timestamp,:deviceId)", nativeQuery = true) + @Transactional + void logPreTestReport(@Param("testName") String testName,@Param("result") String result, @Param("execuationDetails") String execuationDetails,@Param("timestamp") String timestamp,@Param("deviceId") long deviceId); +} |