using iWareCommon.Utils; using iWareLog.ORM; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using iWareCommon.Common.Entity; namespace iWareLog.LOG.Entity { public class AlertEntity : ICommonEntity { /// /// 1主键 /// public int Id { get; set; } /// /// 2小车名称 /// public string Name { get; set; } /// /// 3提示类型 /// public int Type { get; set; } /// /// 4设备id /// public string EquipId { get; set; } /// /// 5提示代码 /// public string AlertCode{ get; set; } /// /// 6提示名称 /// public string AlertName { get; set; } /// /// 7是否消警 /// public int IsFinished { get; set; } /// /// 8事件代码 /// public int EventCode { get; set; } /// /// 9创建时间 /// public DateTime CreateTime { get; set; } /// /// 10结束事件 /// public DateTime FinishTime { get; set; } /// /// 无参构造 /// public AlertEntity() { } /// /// 有参构造 /// /// orm印射的类 public AlertEntity(DEVAlert alert) { EntityPropHelper.CopyProp(alert, this, GetColumnMap()); } /// /// 将对象转换成ORM中的类型 /// /// Orm中的BASEShift类型 public DEVAlert ToOrm() { DEVAlert alert = new DEVAlert(); EntityPropHelper.CopyProp(this, alert, GetColumnMap()); return alert; } /// /// 获取自定义角色类中的字段名为键,orm中对象的字段名为值的字段 /// /// public static Dictionary GetColumnMap() { return new Dictionary() { {"Id", "id"}, {"Name", "name"}, {"Type", "type"}, {"EquipId", "equipid"}, {"AlertCode", "alertcode"}, {"AlertName", "alertname"}, {"IsFinished", "isfinished"}, {"EventCode","eventcode"}, {"CreateTime","createtime"}, {"FinishTime","finishtime"} }; } /// /// 根据ShiftEntity的字段转BASEShift的字段 /// /// ShiftEntity的字段 /// BASEShift public static string GetColumnName(string name) { var columnMap = GetColumnMap(); return columnMap.ContainsKey(name) ? columnMap[name] : name; } /// /// 获取ShiftEntity对应的表名 /// /// 表名 public static string GetTableName() { return "[dbo].[DEVAlert]"; } } }