ly/Model/DeviceEntity.cs

129 lines
4.5 KiB
C#

using GraphQL;
using LY.App.Device;
using Newtonsoft.Json;
using SqlSugar;
namespace LY.App.Model
{
[SugarTable("ly_device_info")]
public class DeviceEntity : BaseEntity
{
/// <summary>
///
/// </summary>
[SugarColumn(ColumnName = "device_sn", ColumnDescription = "DeviceSN")]
public string DeviceSN { get; set; }
[SugarColumn(Length = 63, IsNullable = true, ColumnDescription = "Name")]
public string Name { get; set; }
[SugarColumn(Length = 63, IsNullable = true, ColumnDescription = "account")]
public string account { get; set; }
[SugarColumn(Length = 63, IsNullable = true, ColumnDescription = "password")]
public string password { get; set; }
[JsonConverter(typeof(ValueToStringConverter))]
[SugarColumn(ColumnName = "position_id", ColumnDescription = "阵地id")]
public long PositionId { get; set; }
/// <summary>
/// 阵地名称
/// </summary>
[SugarColumn(ColumnName = "position_name", ColumnDescription = "阵地名称")]
public string PositionName { get; set; }
public string ip { get; set; }
public ProtocolType Protocol { get; set; }
public int Port { get; set; }
[SugarColumn(IsNullable = true)]
public string GraphQlEndpoint { get; set; }
[SugarColumn(IsNullable = true)]
public string BrokerAddress { get; set; } // MQTT Broker 地址
[SugarColumn(IsNullable = true)]
public string Topic { get; set; } // MQTT 主题
/// <summary>
/// 机型
/// </summary>
[SugarColumn(Length = 63, IsNullable = true, ColumnDescription = "机型")]
public string Model { get; set; }
/// <summary>
/// 位置
/// </summary>
[SugarColumn(ColumnName = "address", ColumnDescription = "位置", IsNullable = true)]
public string Address { get; set; }
/// <summary>
/// 经度
/// </summary>
[SugarColumn(ColumnName = "lon", ColumnDescription = "经度", IsNullable = true)]
public double Lon { get; set; }
/// <summary>
/// 纬度
/// </summary>
[SugarColumn(ColumnName = "lat", ColumnDescription = "纬度", IsNullable = true)]
public double Lat { get; set; }
/// <summary>
/// 高度
/// </summary>
[SugarColumn(ColumnName = "alt", ColumnDescription = "高度", IsNullable = true)]
public double Alt { get; set; }
[SugarColumn(ColumnName = "img", ColumnDescription = "图片", IsNullable = true)]
/// <summary>
/// 图片
/// </summary>
public string Img { get; set; }
/// <summary>
/// 图片icon
/// </summary>
public string icon { get; set; }
/// <summary>
/// 是否是移动设备
/// </summary>
[SugarColumn(ColumnName = "is_move", ColumnDescription = "是否移动设备", IsNullable = true)]
public bool isMove { get; set; }
[SugarColumn(IsIgnore = true)]
public bool online { get; set; }
}
public class AddDevice
{
public long PositionId { get; set; }
/// <summary>
/// 阵地名称
/// </summary>
public string PositionName { get; set; }
public string account { get; set; }
public string password { get; set; }
public string Name { get; set; }
public string DeviceSN { get; set; }
public string ip { get; set; }
public ProtocolType Protocol { get; set; }
public int Port { get; set; }
public string GraphQlEndpoint { get; set; }
public string BrokerAddress { get; set; } // MQTT Broker 地址
public string Topic { get; set; } // MQTT 主题
public bool isMove { get; set; }
/// <summary>
/// 机型
/// </summary>
public string Model { get; set; }
/// <summary>
/// 位置
/// </summary>
public string Address { get; set; }
/// <summary>
/// 经度
/// </summary>
public double Lon { get; set; }
/// <summary>
/// 纬度
/// </summary>
public double Lat { get; set; }
/// <summary>
/// 图片
/// </summary>
public string Img { get; set; }
public string icon { get; set; }
}
public class UpdateDevice : AddDevice
{
public long Id { get; set; }
}
}