package com.jasamedika.medifirst2000.dao;

import com.jasamedika.medifirst2000.entities.LogbookDokter;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.sql.Date;
import java.util.List;

public interface LogbookDokterDao extends JpaRepository<LogbookDokter, String> {

	@Modifying
	@Query(value = "delete from remun.t_logbook_dokter " + "where logbook_remun_id in (select no_rec "
			+ "from remun.t_logbook_remun where pegawai_id in (:idPegawai) "
			+ "and bulan between :tglAwal and :tglAkhir)", nativeQuery = true)
	void deleteByKelompokKerjaAndPeriod(@Param("idPegawai") List<Integer> idPegawai, @Param("tglAwal") Date tglAwal,
			@Param("tglAkhir") Date tglAkhir);
}
