package com.jasamedika.medifirst2000.dao;

import java.util.List;
import java.util.Map;

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

import com.jasamedika.medifirst2000.entities.MapPegawaiLaboratRadiologi;

/**
 * Repository class for MapPegawaiLaboratRadiologiDao
 * 
 * @author Generator
 */
@Repository("MapPegawaiLaboratRadiologiDao")
public interface MapPegawaiLaboratRadiologiDao extends CrudRepository<MapPegawaiLaboratRadiologi, Integer> {

	@Query("select new map(m.id as id, pegawai.id as pgwID, pegawai.nama as namaPegawai )"
			+ " from MapPegawaiLaboratRadiologi m " + " left join m.pegawai pegawai "
			+ " where m.statusEnabled = true ")
	List<Map<String, Object>> findAllData();

	@Query("select m from MapPegawaiLaboratRadiologi m where m.statusEnabled = true ")
	List<MapPegawaiLaboratRadiologi> findAllDataObject();
	
	@Query("select m.pegawaiId from MapPegawaiLaboratRadiologi m where m.statusEnabled = true ")
	List<Integer> findPegawaiLaboranRadiolog();

	@Modifying
	@Query("update MapPegawaiLaboratRadiologi m set m.statusEnabled = false ")
	void updateStatusEnabled();
}
