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

@Repository("PegawaiStrukturGajiByMaKaPeDao")
public interface PegawaiStrukturGajiByMaKaPeDao extends PagingAndSortingRepository<PegawaiStrukturGajiByMaKaPe, Integer> {
	@Query("select new Map ( "
			+"model.id as id, "
			+"model.kdProfile as kdProfile, " 
			+"detailkategoripegawai.id as detailKategoriPegawaiId, "
			+"detailkategoripegawai.detailKategoryPegawai as namaDetailKategoriPegawai, "
			+"rangemasakerja.id as rangeMasaKerjaId, "
			+"rangemasakerja.namaRange as namaRangeMasaKerja, "
			+"pendidikan.id as pendidikanId, "
			+"pendidikan.namaPendidikan as namaPendidikan, "
			+"komponenharga.id as komponenHargaId, "
			+"komponenharga.komponenHarga as namaKomponenHarga, "
			+"model.hargaSatuan as hargaSatuan, "
			+"model.factorRate as factorRate, "
			+"model.operatorFactorRate as operatorFactorRate, "
			+"model.statusEnabled as statusEnabled "
			+") from PegawaiStrukturGajiByMaKaPe model "
			+"left join model.detailKategoriPegawai detailkategoripegawai "
			+"left join model.rangeMasaKerja rangemasakerja "
			+"left join model.pendidikan pendidikan "
			+"left join model.komponenHarga komponenharga "
			+ "where model.id =:idPegawaiStrukturGajiByMaKaPe")
	Map<String,Object> get(@Param("idPegawaiStrukturGajiByMaKaPe") Integer idPegawaiStrukturGajiByMaKaPe);
	
	@Query("select new Map ( "
			+"model.id as id, "
			+"model.kdProfile as kdProfile, " 
			+"detailkategoripegawai.id as detailKategoriPegawaiId, "
			+"detailkategoripegawai.detailKategoryPegawai as namaDetailKategoriPegawai, "
			+"rangemasakerja.id as rangeMasaKerjaId, "
			+"rangemasakerja.namaRange as namaRangeMasaKerja, "
			+"rangemasakerja.rangeMax as rangeMax, "
			+"rangemasakerja.rangeMin as rangeMin, "
			+"pendidikan.id as pendidikanId, "
			+"pendidikan.namaPendidikan as namaPendidikan, "
			+"komponenharga.id as komponenHargaId, "
			+"komponenharga.komponenHarga as namaKomponenHarga, "
			+"model.hargaSatuan as hargaSatuan, "
			+"model.factorRate as factorRate, "
			+"model.operatorFactorRate as operatorFactorRate, "
			+"model.statusEnabled as statusEnabled "
			+") from PegawaiStrukturGajiByMaKaPe model "
			+"left join model.detailKategoriPegawai detailkategoripegawai "
			+"left join model.rangeMasaKerja rangemasakerja "
			+"left join model.pendidikan pendidikan "
			+"left join model.komponenHarga komponenharga ")
	List<Map<String,Object>> getAll();	

}
