package com.jasamedika.medifirst2000.dao;

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

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.SanitasiKesehatanLingkungan;

@Repository("sanitasiKesehatanLingkungan")
public interface SanitasiKesehatanLingkunganDao extends PagingAndSortingRepository<SanitasiKesehatanLingkungan, String>{

	@Query("select NEW Map ("
			+ "a.id as id, "
			+ "a.namaRuangan as namaRuangan) "
			+ "from Ruangan a")
	List<Map<String, Object>> getNamaRuangan();
	
	@Query("select NEW Map ("
			+ "a.id as id, "
			+ "a.namaLengkap as namaPetugas) "
			+ "from Pegawai a "
			+ "where a.ruanganId=:ruanganId")
	List<Map<String, Object>> getPjRuangan
			(@Param("ruanganId") Integer ruanganId);
	
	@Query("select NEW Map ("
			+ "a.id as id, "
			+ "a.parameterCheckSanitasiId as checkSanitasiId, "
			+ "a.name as sanitasiDetail) "
			+ "from ParameterCheckSanitasiDetail a ")
	List<Map<String, Object>> getParameterSanitasi();
}
