package com.jasamedika.medifirst2000.dao;

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

@Repository("ApresiasiAtasLayananDao")
public interface ApresiasiAtasLayananDao extends PagingAndSortingRepository<ApresiasiAtasLayanan, Integer> {
	
	@Query("select count(p.gambarMukaKepuasan.id) from ApresiasiAtasLayanan p where p.gambarMukaKepuasan.id=1 and p.tanggal between date(:from) and date(:to) ")
	public Integer getPuas(@Param("from") String from, @Param("to") String to);
	
	@Query("select count(p.gambarMukaKepuasan.id) from ApresiasiAtasLayanan p where p.gambarMukaKepuasan.id=2 and p.tanggal between date(:from) and date(:to) ")
	public Integer getKurangPuas(@Param("from") String from, @Param("to") String to);
	
	@Query("select count(p.gambarMukaKepuasan.id) from ApresiasiAtasLayanan p where p.gambarMukaKepuasan.id=3 and p.tanggal between date(:from) and date(:to) ")
	public Integer getTidakPuas(@Param("from") String from, @Param("to") String to);
}
