io.mosip.admin.bulkdataupload.repositories.RegistrationCenterMachineDeviceRepository Maven / Gradle / Ivy
package io.mosip.admin.bulkdataupload.repositories;
import java.time.LocalDateTime;
import java.util.List;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import io.mosip.admin.bulkdataupload.entity.RegistrationCenterMachineDevice;
import io.mosip.admin.bulkdataupload.entity.id.RegistrationCenterMachineDeviceID;
import io.mosip.kernel.core.dataaccess.spi.repository.BaseRepository;
/**
* Repository to perform CRUD operations on RegistrationCenterMachineDevice.
*
* @author Bal Vikash Sharma
* @since 1.0.0
* @see RegistrationCenterMachineDevice
* @see BaseRepository
*
*/
@Repository
public interface RegistrationCenterMachineDeviceRepository
extends BaseRepository {
@Modifying
@Transactional
@Query("UPDATE RegistrationCenterMachineDevice rcm SET rcm.isDeleted = true ,rcm.deletedDateTime = ?1 WHERE rcm.registrationCenterMachineDevicePk.regCenterId = ?2 AND rcm.registrationCenterMachineDevicePk.machineId = ?3 AND rcm.registrationCenterMachineDevicePk.deviceId = ?4")
int deleteRegCenterMachineDevice(LocalDateTime deletedDateTime, String regId, String machineId, String deviceId);
@Query("FROM RegistrationCenterMachineDevice rcm where rcm.registrationCenterMachineDevicePk.regCenterId = ?1 AND rcm.registrationCenterMachineDevicePk.machineId = ?3 AND rcm.registrationCenterMachineDevicePk.deviceId = ?2 AND (rcm.isDeleted is null or rcm.isDeleted=false) AND rcm.isActive = true")
RegistrationCenterMachineDevice findByIdAndIsDeletedFalseOrIsDeletedIsNull(String regId, String deviceId,
String machineId);
@Query("FROM RegistrationCenterMachineDevice rcm where rcm.registrationCenterMachineDevicePk.machineId = ?1 AND (rcm.isDeleted is null or rcm.isDeleted=false) and rcm.isActive = true")
List findByMachineIdAndIsDeletedFalseOrIsDeletedIsNull(String machineId);
@Query("FROM RegistrationCenterMachineDevice rcm where rcm.registrationCenterMachineDevicePk.deviceId = ?1 AND (rcm.isDeleted is null or rcm.isDeleted=false) and rcm.isActive = true")
List findByDeviceIdAndIsDeletedFalseOrIsDeletedIsNull(String deviceId);
@Query("FROM RegistrationCenterMachineDevice rcm where rcm.registrationCenterMachineDevicePk.regCenterId = ?1 AND (rcm.isDeleted is null or rcm.isDeleted=false) and rcm.isActive = true")
List findByRegCenterIdAndIsDeletedFalseOrIsDeletedIsNull(String regCenterId);
}