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.AsetDto; import com.jasamedika.medifirst2000.entities.Asset; @Repository("AsetDao") public interface AssetDao extends PagingAndSortingRepository { @Query("select count(p.noRec) from Asset p where month(p.tglPenerimaanAset)=:monthNow and year(p.tglPenerimaanAset)=:yearNow ") Integer getCountByMonthAndYear(@Param("monthNow") Integer monthNow, @Param("yearNow") Integer yearNow); @Query("select NEW com.jasamedika.medifirst2000.dto.AsetDto(a.noRegisterAset,a.noRegisterAset_Int,a.noPolisi,a.noRec) from Asset a where a.produkId=(Select cast(s.nilaiField as int) from SettingDataFixed s where s.namaField='KdProdukAmbulance')") List findAssetAmbulance(); @Query("select NEW com.jasamedika.medifirst2000.dto.AsetDto(a.noRegisterAset,a.noRegisterAset_Int,a.noPolisi,a.noRec) from Asset a where a.produkId=(Select cast(s.nilaiField as int) from SettingDataFixed s where s.namaField='KdProdukKendaraanDinas')") List findAssetKendaraanDinas(); }