package com.jasamedika.medifirst2000.dao;

import java.util.List;

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.dto.DaftarPenerimaanLinenDto;
import com.jasamedika.medifirst2000.entities.MappingPenerimaanLinen;

@Repository("DaftarPenerimaanLinenDao")
public interface DaftarPenerimaanLinenDao extends PagingAndSortingRepository<MappingPenerimaanLinen, String> {

	@Query("select NEW com.jasamedika.medifirst2000.dto.DaftarPenerimaanLinenDto(mpl.tgl,r.namaRuangan,mpl.berat,ss.satuanStandar,mpl.noRec) from MappingPenerimaanLinen mpl, Ruangan r, SatuanStandar ss where r.id=mpl.ruanganId and ss.id=mpl.satuanId and date(mpl.tgl) between date(:tglAwal) and date(:tglAkhir)")
	List<DaftarPenerimaanLinenDto> findDaftarPenerimaanLinenByTgl(@Param("tglAwal") String tglAwal,
			@Param("tglAkhir") String tglAkhir);

}
