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

@Repository("RangeDao")
public interface RangeDao extends PagingAndSortingRepository<Range, Integer>{
	
	@Query("select NEW Map(r.id as id,r.namaRange as namaRange) from Range r ")
	public List<Map<String,Object>> findAllRange();
	
	@Query("select new Map(model.id as id, model.namaRange as namaRange, model.jenisRangeId as jenisRangeId) from Range model where model.id = :rangeId and model.statusEnabled is true")
	public Map<String,Object> getRangeById(@Param("rangeId") Integer rangeId);
	
}
