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

@Repository("PegawaiStrukturGajiByJaPeDao")
public interface PegawaiStrukturGajiByJaPeDao extends PagingAndSortingRepository<PegawaiStrukturGajiByJaPe, Integer> {
	@Query("select new Map (model.id as id, "
			+"model.kdProfile as kdProfile, "
			+"model.hargaSatuan as hargaSatuan, "
			+"model.factorRate as factorRate, "
			+"model.operatorFactorRate as operatorFactorRate, "
			+"model.statusEnabled as statusEnabled, "
			+"jabatan.id as jabatanId, "
			+"jabatan.namaJabatan as namaJabatan, "
			+"pendidikan.id as pendidikanId, "
			+"pendidikan.namaPendidikan as namaPendidikan, "
			+"komponenharga.id as komponenHargaId, "
			+"komponenharga.komponenHarga as namaKomponenHarga ) "
			+"from PegawaiStrukturGajiByJaPe model "
			+"left join model.jabatan jabatan "
			+"left join model.pendidikan pendidikan "
			+"left join model.komponenHarga komponenharga "
			+ "where model.id =:idPegawaiStrukturGajiByJaPe")
	Map<String,Object> get(@Param("idPegawaiStrukturGajiByJaPe") Integer idPegawaiStrukturGajiByJaPe);
	
	@Query("select new Map (model.id as id, "
				+"model.kdProfile as kdProfile, "
				+"model.hargaSatuan as hargaSatuan, "
				+"model.factorRate as factorRate, "
				+"model.operatorFactorRate as operatorFactorRate, "
				+"model.statusEnabled as statusEnabled, "
				+"jabatan.id as jabatanId, "
				+"jabatan.namaJabatan as namaJabatan, "
				+"pendidikan.id as pendidikanId, "
				+"pendidikan.namaPendidikan as namaPendidikan, "
				+"komponenharga.id as komponenHargaId, "
				+"komponenharga.komponenHarga as namaKomponenHarga ) "
				+"from PegawaiStrukturGajiByJaPe model "
				+"left join model.jabatan jabatan "
				+"left join model.pendidikan pendidikan "
				+"left join model.komponenHarga komponenharga")
	List<Map<String,Object>> getAll();	

}
