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.JenisBahan; @Repository("JenisBahanDao") public interface JenisBahanDao extends PagingAndSortingRepository{ @Query("select count(a.id) from JenisBahan a") public Integer getCount(); @Query("select new map(a.id as id, " + " a.namaExternal as namaExternal, " + " a.jenisBahan as jenisBahan, " + " a.kdJenisBahan as kdJenisBahan, " + " a.kodeExternal as kodeExternal) " + " from JenisBahan a where a.statusEnabled in('true')") public List> getAll(); @Query("select new map(a.id as id, " + " a.namaExternal as namaExternal, " + " a.jenisBahan as jenisBahan, " + " a.kdJenisBahan as kdJenisBahan, " + " a.kodeExternal as kodeExternal) " + " from JenisBahan a where a.id=:id and a.statusEnabled in('true')") public Map getJenisBahanById(@Param("id")Integer id); }