io.mosip.kernel.masterdata.repository.DeviceSpecificationRepository Maven / Gradle / Ivy
package io.mosip.kernel.masterdata.repository;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import io.mosip.kernel.core.dataaccess.spi.repository.BaseRepository;
import io.mosip.kernel.masterdata.entity.DeviceSpecification;
/**
*
* Repository function to fetching and save device specification details
*
* @author Uday Kumar
* @author Megha Tanga
* @since 1.0.0
*
*/
@Repository
public interface DeviceSpecificationRepository extends BaseRepository {
/**
* This method trigger query to fetch the Device Specification detail for the
* given language code.
*
* @param langCode languageCode provided by user
*
* @return List Device specific Details fetched from database
*/
@Query("FROM DeviceSpecification d where d.langCode = ?1 and (d.isDeleted is null or d.isDeleted = false) and d.isActive = true")
List findByLangCodeAndIsDeletedFalseOrIsDeletedIsNull(String langCode);
/**
* This method trigger query to fetch the Device Specification detail for the
* given language code and device Type Code.
*
* @param langCode LanguageCode provided by user
* @param deviceTypeCode Device Type Code provided by user
* @return List Device specific Details fetched from database
*/
@Query("FROM DeviceSpecification d where d.langCode = ?1 and d.deviceTypeCode = ?2 and (d.isDeleted is null or d.isDeleted = false) and d.isActive = true")
List findByLangCodeAndDeviceTypeCodeAndIsDeletedFalseOrIsDeletedIsNull(String langCode,
String deviceTypeCode);
/**
* This method trigger query to fetch the Device Specification detail for the
* given device specification id.
*
* @param id id provided by user
*
* @return List Device specific Details fetched from database
*/
@Query("FROM DeviceSpecification d where d.id = ?1 and (d.isDeleted is null or d.isDeleted = false) and d.isActive = true")
List findByIdAndIsDeletedFalseorIsDeletedIsNull(String id);
/**
* This method trigger query to fetch the Device Specification detail for the
* given device specification id.
*
* @param id id provided by user
*
* @param langCode langCode provided by user
*
* @return List Device specific Details fetched from database
*/
@Query("FROM DeviceSpecification d where d.id = ?1 and d.langCode =?2 and (d.isDeleted is null or d.isDeleted = false)")
DeviceSpecification findByIdAndLangCodeAndIsDeletedFalseorIsDeletedIsNull(String id, String langCode);
@Query("FROM DeviceSpecification d where (d.isDeleted is null or d.isDeleted = false) and d.isActive = true")
List findAllDeviceSpecByIsActiveAndIsDeletedIsNullOrFalse();
@Query("FROM DeviceSpecification WHERE id =?1 AND langCode=?2 ")
DeviceSpecification findDeviceSpecificationByIDAndLangCode(String uniqueId, String primaryLang);
}