using iWareCommon.Common.Entity; using iWareCommon.Utils; using iWareDataCore.ORM; using System.Collections.Generic; namespace iWareDataCore.DEV.Entity { public class EquipmentViewEntity : 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; } /// /// 外键,设备类型ID /// public int TypeId { get; set; } /// /// 所属区域 /// public string Area { get; set; } /// /// 设备是否启用,0为禁用,1为启用 /// public int Status { get; set; } /// /// 展示名 /// public string DisplayName { get; set; } /// /// 设备类别备注 /// public string TypeRemark { get; set; } /// /// 类别名称 /// public string TypeName { get; set; } /// /// 构造函数 /// public EquipmentViewEntity() { } /// /// 构造函数 /// /// 角色 public EquipmentViewEntity(DEVEquipmentView role) { EntityPropHelper.CopyProp(role, this, GetColumnMap()); } /// /// 将对象转换成ORM中的类型 /// /// Orm中的角色类型 public DEVEquipmentView ToOrm() { var equip = new DEVEquipmentView(); EntityPropHelper.CopyProp(this, equip, GetColumnMap()); return equip; } /// /// 获取自定义角色类中的字段名为键,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"}, {"TypeRemark","typeremark"}, {"TypeName","typename"}, }; } /// /// 根据RoleEntity的字段转RBAC_Role的字段 /// /// RoleEntity的字段 /// RBAC_Role public static string GetColumnName(string name) { var columnMap = GetColumnMap(); return columnMap.ContainsKey(name) ? columnMap[name] : name; } /// /// 获取RoleEntity对于的表名 /// /// DEVEquipment public static string GetTableName() { return "[dbo].[DEVEquipmentView]"; } } }