using JiShe.CollectBus.IoTDB.Model;
namespace JiShe.CollectBus.IoTDB.Provider
{
///
/// 设备路径构建器
///
public static class DevicePathBuilder
{
///
/// 构建设备路径,由于路径的层级约束规范不能是纯数字字符,所以需要做特殊处理。
///
///
///
///
public static string GetDevicePath(T entity) where T : IoTEntity
{
return $"root.{entity.SystemName.ToLower()}.`{entity.ProjectId}`.`{entity.DeviceType}`.{entity.DataType}.`{entity.DeviceId}`";
}
///
/// 获取表名称
///
///
///
///
public static string GetTableName() where T : IoTEntity
{
var type = typeof(T);
return $"{type.Name.ToLower()}";
}
///
/// 获取表名称,用作单侧点表模型特殊处理。
///
///
///
///
public static string GetDeviceTableName(T entity) where T : IoTEntity
{
return $"{entity.SystemName.ToLower()}.`{entity.ProjectId}`.`{entity.DeviceType}`.`{entity.DeviceId}`";
}
}
}