package com.jasamedika.medifirst2000.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.jasamedika.medifirst2000.entities.MapParameterToLaporanUjiHasil;

@Repository("MapParameterToLaporanUjiHasilDao")
public interface MapParameterToLaporanUjiHasilDao extends PagingAndSortingRepository<MapParameterToLaporanUjiHasil, String> {
	
	@Query("select new map("
			+ " coalesce(bakuMutu.bakuMutu,0.0) as bakuMutu,"
			+ " coalesce(parameter.nama,'-') as parameter,"
			+ " coalesce(satuanStandar.satuanStandar,'-') as satuanStandar,"
			+ " coalesce(p.hasilUji,'-') as hasilUji,"
			+ " coalesce(p.noRec,'-') as noRec"
			+ " ) from MapParameterToLaporanUjiHasil p" 
			+ " left join p.bakuMutu bakuMutu"
			+ " left join p.parameter parameter"
			+ " left join p.satuanStandar satuanStandar where p.laporanUjiHasil.noRec=:noRec")
	public List<MapParameterToLaporanUjiHasil> findByParent(@Param("noRec") String noRec);

}
