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.HargaNettoProdukByKelas;
import com.jasamedika.medifirst2000.entities.HargaNettoProdukByKelasD;
import com.jasamedika.medifirst2000.entities.MapDiagnosaToProduk;

/**
 * Repository class for StokProdukGlobal
 * 
 * @author Adik
 */
@Repository("MapDiagnosisToProdukDao")
public interface MapDiagnosisToProdukDao extends PagingAndSortingRepository<MapDiagnosaToProduk, String> {
	// custom query
	
	@Query("select p from MapDiagnosaToProduk p where p.kodeDiagnosis = :kode")
	List<MapDiagnosaToProduk> findProdukByDiagnosa(@Param("kode") String kode);
	
	@Query("select p from HargaNettoProdukByKelas p where p.produk.id = :id")
	HargaNettoProdukByKelas getHarga(@Param("id") Integer id);
	@Query("select p from HargaNettoProdukByKelas p where p.produk.id = :id")
	List<HargaNettoProdukByKelas> getHargas(@Param("id") Integer id);
	
	@Query("select p from HargaNettoProdukByKelasD p where p.produk.id = :id")
	List<HargaNettoProdukByKelasD> getHargaDetail(@Param("id") Integer id);
	
	@Query("select p from HargaNettoProdukByKelas p where p.produk.id = :id and p.kelas.id =:idKelas")
	HargaNettoProdukByKelas getHarga(@Param("id") Integer id,@Param("idKelas") Integer idKelas);
	
	@Query("select p from HargaNettoProdukByKelasD p where p.produk.id = :id and p.kelas.id =:idKelas")
	List<HargaNettoProdukByKelasD> getHargaDetail(@Param("id") Integer id,@Param("idKelas") Integer idKelas);
	
}
