using iWareCommon.Common.Entity; using iWareCommon.Utils; using iWareDataCore.ORM; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace iWareDataCore.DEV.Entity { public class EquipmentEntity : ICommonEntity { /// /// 设备表主键 /// public int Id { get; set; } /// /// 设备标识 /// public string EquipId { get; set; } /// /// 设备名称 /// public string EquipName { get; set; } /// /// 需要连接服务器的ip /// public string ServerIp { get; set; } /// /// 需要连接服务器的端口 /// public string ServerPort { get; set; } /// /// 设备本身的ip /// public string LocalIp { get; set; } /// /// 设备本身的端口 /// public string LocalPort { get; set; } /// /// 设备类型 0为堆垛机 1为传送机 /// public int TypeId { get; set; } /// /// 所属区域 /// public string Area { get; set; } /// /// 是否启用 0为禁用 1为启用 /// public int Status { get; set; } /// /// 展示名 /// public string DisplayName { get; set; } /// /// 构造函数 /// public EquipmentEntity() { } /// /// 构造函数 /// /// ORM中的DEVEquipment实体 public EquipmentEntity(DEVEquipment equipment) { EntityPropHelper.CopyProp(equipment, this, GetColumnMap()); } /// /// 获取自定义类中的字段名为键,ORM中对象的字段名为值的字段 /// /// public static Dictionary GetColumnMap() { return new Dictionary() { {"Id", "id"}, {"EquipId", "equipid"}, {"EquipName", "equipname"}, {"ServerIp", "serverip"}, {"ServerPort", "serverport"}, {"LocalIp", "localip"}, {"LocalPort", "localport"}, {"TypeId", "typeid"}, {"Area", "area"}, {"Status","status"}, {"DisplayName","displayname"} }; } /// /// 将place实体转化为orm里面的place模型 /// /// orm中的place模型 public DEVEquipment ToOrm() { var equip = new DEVEquipment(); EntityPropHelper.CopyProp(this, equip, GetColumnMap()); return equip; } /// /// 根据EquipmentEntity的字段转DEVEquipment的字段 /// /// EquipmentEntity的字段 /// DEVEquipment public static string GetColumnName(string name) { var columnMap = GetColumnMap(); return columnMap.ContainsKey(name) ? columnMap[name] : name; } /// /// 获取EquipmentEntity对应的表名 /// /// DEVEquipment public static string GetTableName() { return "[dbo].[DEVEquipment]"; } } }