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

@Repository("KomponenEvaluasiDao")
public interface KomponenEvaluasiDao extends PagingAndSortingRepository<KomponenEvaluasi, Integer> {

	@Query("select model from KomponenEvaluasi model where model.id=:id")
	public KomponenEvaluasi findByIdKomponenEvaluasi(@Param("id") Integer id);
	
	@Query("select count(*) from "
			+ " KomponenEvaluasi")
	Integer countKomponenEvaluasi();
	
	@Query("    select new Map(ke.kdKelompokEvaluasiId as kdKelompokEvaluasiId, "
			+ " ke.nilaiMin as nilaiMin,"
			+ " ke.nilaiMax as nilaiMax,"
			+ " ke.nilaiStandar as nilaiStandar,"
			//+ " ke.deskripsiKompetensi as deskripsiKompetensi,"
			+ " ke.factorRate as factorRate,"
			+ " ke.operatorFactorRate as operatorFactorRate,"
			+ " ke.departemenId as departemenId,"
			+ " ke.kdKomponenEvaluasi as kdKomponenEvaluasi,"
			+ " ke.satuanHasilId as satuanHasilId,"
			+ " ke.komponenEvaluasi as komponenEvaluasi,"
			+ " ke.noUrut as noUrut,"
			+ " ke.qKomponenEvaluasi as qKomponenEvaluasi,"
			+ " ke.statusEnabled as statusEnabled,"
			+ " ke.id as id ,"
			+ " ke.kodeExternal as kodeEksternal,"
			+ " ke.namaExternal as namaEksternal,"
			+ " ke.reportDisplay as reportDisplay,"
			+ " ke.qKomponenEvaluasi as qKomponenEvaluasi,"
			+ " ke.noUrut as noUrut) from KomponenEvaluasi ke "
			+ " order by ke.id asc")
	public List<Map<String,Object>>  findAllKomponenEvaluasi();
	 
}
