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.BASE.Entity { public class WebOrderEntity : ICommonEntity { /// /// 1物料主键 /// public int Id { get; set; } public string RequestOrder { get; set; } public string ListNo { get; set; } public int? BusType { get; set; } public int? StatusFlag { get; set; } public DateTime CreateTime { get; set; } public string Remark { get; set; } /// /// 明细 /// public List WebOrderDetail { get; set; } /// /// 无参构造 /// public WebOrderEntity() { } /// /// 有参构造 /// /// orm映射的类 public WebOrderEntity(WebOrder webOrder) { EntityPropHelper.CopyProp(webOrder, this, GetColumnMap()); } /// /// 将对象转换成ORM中的类型 /// /// Orm中的BASEMaterial类型 public WebOrder ToOrm() { WebOrder webOrder = new WebOrder(); EntityPropHelper.CopyProp(this, webOrder, GetColumnMap()); return webOrder; } /// /// 获取自定义角色类中的字段名为键,orm中对象的字段名为值的字段 /// /// public static Dictionary GetColumnMap() { return new Dictionary() { { "Id", "id"}, { "RequestOrder", "requestorder"}, { "ListNo", "listno"}, { "BusType", "bustype"}, { "StatusFlag", "statusflag"}, { "CreateTime", "createtime"}, { "Remark","remark"} }; } /// /// 根据MaterialEntity的字段转BASEMaterial的字段 /// /// MaterialEntity的字段 /// BASEMaterial public static string GetColumnName(string name) { var columnMap = GetColumnMap(); return columnMap.ContainsKey(name) ? columnMap[name] : name; } /// /// 获取MaterialEntity对应的表名 /// /// 表名 public static string GetTableName() { return "[dbo].[WebOrder]"; } } }