2021-01-07 11:34:56 +07:00

55 lines
1.8 KiB
Java

package com.jasamedika.medifirst2000.dao;
import java.util.List;
import java.util.Map;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
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.HVA;
@Repository("HVADao")
public interface HVADao extends PagingAndSortingRepository<HVA, String>,JpaSpecificationExecutor{
@Query("select NEW Map ("
+ "a.noRec as noRec, "
+ "a.periodeTahun as periodeTahun) "
+ "from HVA a "
+ "where a.periodeTahun=:periodeTahun and "
+ "a.jenisHVAId=:jenisHVA")
Map<String, Object> getHVA(
@Param("periodeTahun") Long periodeTahun,
@Param("jenisHVA") Integer jenisHVA);
@Query("select NEW Map ("
+ "b.id as id, "
+ "b.nama as nama) "
+ "from HVA a "
+ "left join a.jenisHVA b "
+ "where a.periodeTahun=:periodeTahun and "
+ "b.id=:jenisHVA")
Map<String, Object> getJenisHVA(
@Param("periodeTahun") Long periodeTahun,
@Param("jenisHVA") Integer jenisHVA);
@Query("select NEW Map ("
+ "c.event as event, "
+ "c.probability as probability, "
+ "c.humanImpact as humanImpact, "
+ "c.propertyImpact as propertyImpact, "
+ "c.businessImpact as businessImpact, "
+ "c.preparedness as preparedness, "
+ "c.internalResponse as internalResponse, "
+ "c.externalResponse as externalResponse) "
+ "from HVA a "
+ "left join a.jenisHVA b "
+ "left join a.detailHVA c "
+ "where a.periodeTahun=:periodeTahun and "
+ "b.id=:jenisHVA")
List<Map<String, Object>> getDetailHVA(
@Param("periodeTahun") Long periodeTahun,
@Param("jenisHVA") Integer jenisHVA);
}