detect/detect.gui/Models/Entities/DeviceEntity.cs

44 lines
1.3 KiB
C#
Raw Normal View History

2024-11-13 17:09:15 +08:00
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using detect.gui.Commons;
using Microsoft.EntityFrameworkCore;
2024-11-14 17:11:43 +08:00
using Newtonsoft.Json;
2024-11-13 17:09:15 +08:00
namespace detect.gui.Models.Entities;
2024-11-14 17:11:43 +08:00
[Table("dat_device")]
2024-11-13 17:09:15 +08:00
[Index(nameof(Name), IsUnique = true)]
public class DeviceEntity
{
2024-11-14 17:11:43 +08:00
[Key]
[JsonProperty(PropertyName = "id")]
[Column("id")]
public long? Id { get; set; }
[StringLength(255), Comment("设备名称")]
[JsonProperty(PropertyName = "name")]
[Column("name")]
public string? Name { get; set; }
[StringLength(255), Comment("设备序列号")]
[JsonProperty(PropertyName = "deviceSn")]
[Column("device_sn")]
public string? DeviceSn { get; set; }
2024-11-13 17:09:15 +08:00
[StringLength(20), Comment("设备IP地址")]
[RegularExpression(RegexHelper.IpV4, ErrorMessage = "IpV4: {0}格式非法")]
2024-11-14 17:11:43 +08:00
[JsonProperty(PropertyName = "deviceIp")]
[Column("device_ip")]
2024-11-13 17:09:15 +08:00
public string? DeviceIp { get; set; }
2024-11-14 17:11:43 +08:00
[Comment("创建时间")]
[JsonProperty(PropertyName = "createTime")]
[Column("create_time")]
public DateTime? CreateTime { get; set; }
[Comment("更新时间")]
[JsonProperty(PropertyName = "updateTime")]
[Column("update_time")]
public DateTime? UpdateTime { get; set; }
2024-11-13 17:09:15 +08:00
}