io.mosip.admin.bulkdataupload.repositories.RegistrationCenterMachineRepository Maven / Gradle / Ivy
package io.mosip.admin.bulkdataupload.repositories;
import java.util.List;
import java.util.Optional;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import io.mosip.admin.bulkdataupload.entity.RegistrationCenterMachine;
import io.mosip.admin.bulkdataupload.entity.id.RegistrationCenterMachineID;
import io.mosip.kernel.core.dataaccess.spi.repository.BaseRepository;
/**
* Repository to perform CRUD operations on RegistrationCenterMachine.
*
* @author Bal Vikash Sharma
* @since 1.0.0
* @see RegistrationCenterMachine
* @see BaseRepository
*
*/
@Repository
public interface RegistrationCenterMachineRepository
extends BaseRepository {
@Query("FROM RegistrationCenterMachine WHERE registrationCenterMachinePk =?1 and (isDeleted is null or isDeleted =false) and isActive = true")
Optional findAllNondeletedMappings(
RegistrationCenterMachineID registrationCenterMachinePk);
@Query("FROM RegistrationCenterMachine rm where rm.registrationCenterMachinePk.machineId = ?1 AND (rm.isDeleted is null or rm.isDeleted=false) ")
List findByMachineIdAndIsDeletedFalseOrIsDeletedIsNull(String machineId);
@Query("FROM RegistrationCenterMachine rm where rm.registrationCenterMachinePk.regCenterId = ?1 AND (rm.isDeleted is null or rm.isDeleted=false) and rm.isActive = true")
List findByRegCenterIdAndIsDeletedFalseOrIsDeletedIsNull(String regCenterId);
@Query(value = "SELECT rcm.regcntr_id, mm.id, mm.name, mm.mac_address, mm.serial_num, mm.ip_address, mm.mspec_id, mm.lang_code, mm.is_active,mm.validity_end_dtimes, mm.cr_by, mm.cr_dtimes, mm.upd_by, mm.upd_dtimes FROM master.machine_master mm inner join master.reg_center_machine rcm on mm.id = rcm.machine_id where (rcm.is_deleted is null or rcm.is_deleted=false) and (mm.is_deleted is null or mm.is_deleted=false) and rcm.regcntr_id=?1", nativeQuery = true)
List