package com.jasamedika.medifirst2000.dao;

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.StrukturNoCM;

@Repository("StrukturNoCMDao")
public interface StrukturNoCMDao extends PagingAndSortingRepository<StrukturNoCM, Integer> {
	@Query("select new Map(model.id as id,"
			+"model.noUrutAwalMember as noUrutAwalMember,"
			+"model.noUrutAkhirMember as noUrutAkhirMember,"
			+"model.automaticNoCMMember as automaticNoCMMember,"
			+"model.formatNoCMMember as formatNoCMMember,"
			+"model.noUrutAwalNonMember as noUrutAwalNonMember,"
			+"model.noUrutAkhirNonMember as noUrutAkhirNonMember,"
			+"model.formatNoCMNonMember as formatNoCMNonMember, "
			+"model.automaticNoCMNonMember as automaticNoCMNonMember "
			+") from StrukturNoCM model "
			+"left join model.departemen departemen " 
			+"where departemen.id=:departemenId")
	Map<String,Object> getStrukturNoCmByDepartement(@Param("departemenId") Integer departemenId);

}
