49 lines
1.5 KiB
Java
49 lines
1.5 KiB
Java
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.Mesin;
|
|
|
|
@Repository("MesinDao")
|
|
public interface MesinDao extends PagingAndSortingRepository<Mesin, Integer> {
|
|
|
|
@Query("select count(m.id) from Mesin m")
|
|
Integer getCountByKodeMesin();
|
|
|
|
@Query("select NEW Map ("
|
|
+ "a.id as id, "
|
|
+ "a.typeProduk as jenisMesin) "
|
|
+ "from TypeProduk a where "
|
|
+ "upper(a.typeProduk) like '%BOILER%' or "
|
|
+ "upper(a.typeProduk) like '%GENSET%'")
|
|
List<Map<String, Object>> getJenisMesin();
|
|
|
|
@Query("select NEW Map ("
|
|
+ "b.id as idMesin, "
|
|
+ "b.namaProduk as namaMesin, "
|
|
+ "a.kapasitas as kapasitasMesin) "
|
|
+ "from Mesin a "
|
|
+ "left join a.mesin b "
|
|
+ "where b.typeProdukId=:id")
|
|
List<Map<String, Object>> getDataMesin(@Param("id") Integer id);
|
|
|
|
@Query("select new map(" +
|
|
" a.id as id, " +
|
|
" a.statusEnabled as statusEnabled, " +
|
|
" a.kodeExternal as kodeExternal, " +
|
|
" a.namaExternal as namaExternal, " +
|
|
" a.kapasitas as kapasitas, " +
|
|
" b.id as idMesin, " +
|
|
" b.namaExternal as namaMesin, " +
|
|
" c.id as idSatuan, " +
|
|
" c.namaExternal as satuan) " +
|
|
" from Mesin a left join a.mesin b left join a.satuan c" +
|
|
" where a.statusEnabled in('true')")
|
|
List<Map<String, Object>> getMesinLaundry();
|
|
|
|
}
|