|
|
#region << 版 本 注 释 >>
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
* 版权所有 (c) 2025 WenJY 保留所有权利。
|
|
|
* CLR版本:4.0.30319.42000
|
|
|
* 机器名称:Mr.Wen's MacBook Pro
|
|
|
* 命名空间:Sln.Imm.Daemon.Repository.service.Impl
|
|
|
* 唯一标识:4D067141-7FEC-4ED6-A69C-F285D68FFDEF
|
|
|
*
|
|
|
* 创建者:WenJY
|
|
|
* 电子邮箱:
|
|
|
* 创建时间:2025-09-05 11:27:26
|
|
|
* 版本:V1.0.0
|
|
|
* 描述:
|
|
|
*
|
|
|
*--------------------------------------------------------------------
|
|
|
* 修改人:
|
|
|
* 时间:
|
|
|
* 修改说明:
|
|
|
*
|
|
|
* 版本:V1.0.0
|
|
|
*--------------------------------------------------------------------*/
|
|
|
|
|
|
#endregion << 版 本 注 释 >>
|
|
|
|
|
|
using Sln.Imm.Daemon.Model.dao;
|
|
|
using Sln.Imm.Daemon.Repository.service.@base;
|
|
|
using SqlSugar;
|
|
|
|
|
|
namespace Sln.Imm.Daemon.Repository.service.Impl;
|
|
|
|
|
|
public class BaseDeviceParamServiceImpl : BaseServiceImpl<BaseDeviceParam>,IBaseDeviceParamService {
|
|
|
|
|
|
public BaseDeviceParamServiceImpl(Repository<BaseDeviceParam> rep) : base(rep)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 查出所有报警参数(三色灯相关)
|
|
|
/// </summary>
|
|
|
/// <param name="device">设备信息,为 null 或 deviceCode 为空时返回空列表</param>
|
|
|
/// <returns>报警参数列表,无匹配或异常时返回空列表,保证调用方不因空指针中断</returns>
|
|
|
public List<BaseDeviceParam> GetDeviceAlarmParams(BaseDeviceInfo device)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
if (device == null)
|
|
|
return new List<BaseDeviceParam>();
|
|
|
if (string.IsNullOrEmpty(device.deviceCode))
|
|
|
return new List<BaseDeviceParam>();
|
|
|
|
|
|
var ctx = _rep?.Context;
|
|
|
if (ctx == null)
|
|
|
return new List<BaseDeviceParam>();
|
|
|
|
|
|
var list = ctx.Queryable<BaseDeviceParam>()
|
|
|
.Where(x => x.deviceCode == device.deviceCode)
|
|
|
.Where(x => x.paramName != null && x.paramName.Contains("三色灯"))
|
|
|
.ToList();
|
|
|
|
|
|
return list ?? new List<BaseDeviceParam>();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
// 任何异常(含 NRE、SqlSugar/DB 异常)均返回空列表,避免单台设备导致整轮采集停止;调用方会走“未读取到报警点位”并继续下一轮
|
|
|
return new List<BaseDeviceParam>();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} |