package com.jasamedika.medifirst2000.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.jasamedika.medifirst2000.entities.MapPegawaiJabatanToUnitKerjaHistori;

@Repository("mapPegawaiJabatanToUnitKerjaHistoriDao")
public interface MapPegawaiJabatanToUnitKerjaHistoriDao extends CrudRepository<MapPegawaiJabatanToUnitKerjaHistori, String> {
	
	@Query("select mappHist.pegawaiId from MapPegawaiJabatanToUnitKerjaHistori mappHist "
			+ "where mappHist.jabatanId = :jabatanId and mappHist.unitKerjaPegawaiId = :unitId and mappHist.subUnitKerjaPegawaiId = :subId order by mappHist.tglInput desc")
	List<Integer> getHistoriAtasan(@Param("jabatanId") Integer jabatanId, @Param("unitId") Integer unitId, @Param("subId") Integer subId);
	
	@Query("select mappHist.pegawaiId from MapPegawaiJabatanToUnitKerjaHistori mappHist where mappHist.atasanLangsungId = :atasanId order by mappHist.tglInput desc")
	List<Integer> getHistoriBawahanAtasan(@Param("atasanId") Integer atasanId);
	
	@Query("select mappHist.pegawaiId from MapPegawaiJabatanToUnitKerjaHistori mappHist where mappHist.pejabatPenilaiId = :penilaiId order by mappHist.tglInput desc")
	List<Integer> getHistoriBawahanPenilai(@Param("penilaiId") Integer penilaiId);
	
}
