2025-04-02 14:06:40 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace JiShe.CollectBus.IoTDBProvider
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设备路径构建器
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static class DevicePathBuilder
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2025-04-02 17:23:52 +08:00
|
|
|
|
/// 构建设备路径
|
2025-04-02 14:06:40 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
2025-04-02 17:23:52 +08:00
|
|
|
|
/// <param name="entity"></param>
|
2025-04-02 14:06:40 +08:00
|
|
|
|
/// <returns></returns>
|
2025-04-02 17:23:52 +08:00
|
|
|
|
public static string GetDeviceId<T>(T entity) where T : IoTEntity
|
2025-04-02 14:06:40 +08:00
|
|
|
|
{
|
2025-04-02 17:23:52 +08:00
|
|
|
|
return $"root.{entity.SystemName}.{entity.ProjectCode}.{entity.DeviceId}";
|
2025-04-02 14:06:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-02 17:23:52 +08:00
|
|
|
|
|
2025-04-02 14:06:40 +08:00
|
|
|
|
/// <summary>
|
2025-04-02 17:23:52 +08:00
|
|
|
|
/// 获取表名称
|
2025-04-02 14:06:40 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
|
/// <param name="entity"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2025-04-02 17:23:52 +08:00
|
|
|
|
public static string GetTableName<T>() where T : IoTEntity
|
2025-04-02 14:06:40 +08:00
|
|
|
|
{
|
2025-04-02 17:23:52 +08:00
|
|
|
|
var type = typeof(T);
|
|
|
|
|
|
return $"{type.Name}";
|
2025-04-02 14:06:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|