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 OperationEntity : ICommonEntity { /// /// 1主键 /// public int Id { get; set; } /// /// 2 /// public int WbLogType { get; set; } /// /// 3 /// public DateTime WbLogDate { get; set; } /// /// 4 /// public string WbLogacCount { get; set; } /// /// 5 /// public string WbUserName { get; set; } /// /// 6 /// public string WbUserIpaddress { get; set; } /// /// 7 /// public string WbLogTxt { get; set; } /// /// 8 /// public string Log_backup1 { get; set; } /// /// 9 /// public string Log_backup2 { get; set; } /// /// 10 /// public string Log_backup3 { get; set; } /// /// 无参构造 /// public OperationEntity() { } /// /// 有参构造 /// /// orm印射的类 public OperationEntity(LOGOperation alert) { EntityPropHelper.CopyProp(alert, this, GetColumnMap()); } /// /// 将对象转换成ORM中的类型 /// /// Orm中的BASEShift类型 public LOGOperation ToOrm() { LOGOperation alert = new LOGOperation(); EntityPropHelper.CopyProp(this, alert, GetColumnMap()); return alert; } /// /// 获取自定义角色类中的字段名为键,orm中对象的字段名为值的字段 /// /// public static Dictionary GetColumnMap() { return new Dictionary() { {"Id", "wbdatalogid"}, {"WbLogType", "wblogtype"}, {"WbLogDate", "wblogdate"}, {"WbLogacCount", "wblogaccount"}, {"WbUserName", "wbusername"}, {"WbUserIpaddress", "wbuseripaddress"}, {"WbLogTxt", "wblogtxt"}, {"Log_backup1","log_backup1"}, {"Log_backup2","log_backup2"}, {"Log_backup3","log_backup3"} }; } /// /// 根据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].[LOGOperation]"; } } }