package cn.flightfeather.supervision.domain.ds1.repository
|
|
import cn.flightfeather.supervision.domain.ds1.entity.DeviceInfo
|
import cn.flightfeather.supervision.domain.ds1.entity.DeviceLocation
|
import cn.flightfeather.supervision.domain.ds1.mapper.DeviceInfoMapper
|
import cn.flightfeather.supervision.domain.ds1.mapper.DeviceLocationMapper
|
import org.springframework.stereotype.Repository
|
|
/**
|
*
|
* @date 2024/7/24
|
* @author feiyu02
|
*/
|
@Repository
|
class DeviceRep(
|
private val deviceInfoMapper: DeviceInfoMapper,
|
private val deviceLocationMapper: DeviceLocationMapper,
|
) {
|
/***--DeviceInfo--***/
|
fun findDevice(sceneId: String): DeviceInfo? {
|
return deviceInfoMapper.selectByPrimaryKey(sceneId)
|
}
|
|
fun findDeviceList(sceneId: String): List<DeviceInfo> {
|
return findDeviceList(DeviceInfo().apply { diSceneGuid = sceneId })
|
}
|
|
fun findDeviceList(deviceInfo: DeviceInfo): List<DeviceInfo> {
|
return deviceInfoMapper.select(deviceInfo)
|
}
|
|
fun insertDevice(deviceInfo: DeviceInfo): Int {
|
return deviceInfoMapper.insert(deviceInfo)
|
}
|
|
fun updateDevice(deviceInfo: DeviceInfo): Int {
|
return deviceInfoMapper.updateByPrimaryKey(deviceInfo)
|
}
|
|
/***--DeviceLocation--***/
|
fun findLocation(id: Int): DeviceLocation? {
|
return deviceLocationMapper.selectByPrimaryKey(id)
|
}
|
|
fun findLocations(deviceId: Int): List<DeviceLocation> {
|
return findLocations(DeviceLocation().apply { dlDeviceId = deviceId })
|
}
|
|
fun findLocations(location: DeviceLocation): List<DeviceLocation> {
|
return deviceLocationMapper.select(location)
|
}
|
|
fun insertLocation(location: DeviceLocation): Int {
|
return deviceLocationMapper.insert(location)
|
}
|
|
fun updateLocation(location: DeviceLocation): Int {
|
return deviceLocationMapper.updateByPrimaryKey(location)
|
}
|
}
|