package com.gkhy.labRiskManage.domain.basic.repository.jpa;
|
|
|
import com.gkhy.labRiskManage.domain.basic.entity.BasicExperimentDevice;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.stereotype.Repository;
|
|
import java.util.List;
|
|
|
/**
|
* 基础实验设备
|
*/
|
@Repository
|
public interface BasicExperimentDeviceRepository extends JpaRepository<BasicExperimentDevice, Long>, JpaSpecificationExecutor<BasicExperimentDevice> {
|
|
/**
|
* 查询设备 - by id
|
* */
|
@Query(value = "select t from BasicExperimentDevice t where t.id = :id and t.deleteStatus = 0")
|
BasicExperimentDevice getDeviceById(Long id);
|
|
/**
|
* 查询设备 - by deviceCode
|
* */
|
@Query(value = "select t from BasicExperimentDevice t where t.deviceCode = :deviceCode and t.deleteStatus = 0")
|
BasicExperimentDevice getDeviceByCode(String deviceCode);
|
|
/**
|
* 查询设备 - by deviceName
|
* */
|
@Query(value = "select t from BasicExperimentDevice t where t.deviceName = :deviceName and t.deleteStatus = 0")
|
BasicExperimentDevice getDeviceByName(String deviceName);
|
|
/**
|
* 基础仪器设备表 - 删除
|
* */
|
@Query(value = "update BasicExperimentDevice t set t.deleteStatus = 0 where t.id = :id")
|
int deleteBasicExperimentDevice(Long id);
|
|
/**
|
* 基础仪器设备表 - 设备列表 - 查询所有
|
* */
|
@Query(value = "select t from BasicExperimentDevice t where t.deleteStatus = 0")
|
List<BasicExperimentDevice> listDevice();
|
|
/**
|
* 基础仪器设备表 - 设备列表 - 查询相关
|
* */
|
@Query(value = "select t from BasicExperimentDevice t where t.createByUserId = :currentUserId and t.deleteStatus = 0")
|
List<BasicExperimentDevice> listDeviceByUserId(Long currentUserId);
|
|
/**
|
* 基础仪器设备表 - 通过id列表查询
|
* */
|
@Query(value = "select t from BasicExperimentDevice t where t.id in (?1) and t.deleteStatus = 0")
|
List<BasicExperimentDevice> batchById(List<Long> ids);
|
}
|