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


/**
 * Repository class for Departemen
 * 
 * @author Roberto
 */
@Repository("DetailPerlakuanDao")
public interface DetailPerlakuanDao extends PagingAndSortingRepository<DetailPerlakuan, String> {

	@Query("select new map("
			+ "coalesce(p.jenisLimbahYangDikelola,null) as jenisLimbahYangDikelola,"
			+ "coalesce(p.jumlah,0.0) as jumlah,"
			+ "coalesce(p.noRec,'-') as noRec,"
			+ "coalesce(perizinan.name,'-') as perizinan,"
			+ "coalesce(perlakuan.name,'-') as perlakuan"
			+ ")"
			+ "from DetailPerlakuan p "
			+ "left join p.perizinanLimbah perizinan "
			+ "left join p.perlakuan perlakuan "
			+ "where p.neracaLimbah.noRec=:noRec ")
	List<Map<String, Object>> findNeracaById(@Param("noRec") String noRec);

}
