package com.zjty.autotest.dao;

import com.zjty.autotest.pojo.sjq.TestReport;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Map;

/**
 * 数据访问接口
 * @author Administrator
 *
 */
public interface TestReportDao extends JpaRepository<TestReport,String>, JpaSpecificationExecutor<TestReport> {
    @Query(value = "SELECT input_report FROM test_report WHERE result_id = :resultId",nativeQuery = true)
	String findByInResultId(@Param("resultId") String resultId);

    @Query(value = "select out_report from test_report where result_id =:resultId",nativeQuery = true)
    String findByOutResultId(@Param("resultId") String resultId);
    @Query(value = "select * from test_report where result_id=:resultId",nativeQuery = true)
    TestReport findByResultId(@Param("resultId") String resultId);
    @Modifying
    int deleteByResultId(@Param("resultId") String resultId);

    @Query(value = "select result_id,status from test_report ",nativeQuery = true)
    List<Map<String,Object>> findAllStatus();
}
