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 MaterialTypeViewEntity : ICommonEntity { /// /// 1主键id /// public int Id { get; set; } /// /// 2物料类型名称 /// public string Name { get; set; } /// /// 3备注 /// public string Remark { get; set; } /// /// 4类型 /// public int Type { get; set; } /// /// 是否被引用(0,否、1,是) /// public int RefLabel { get; set; } /// /// 无参构造 /// public MaterialTypeViewEntity() { } /// /// 有参构造 /// /// orm映射的类 public MaterialTypeViewEntity(BASEMaterialTypeView type) { EntityPropHelper.CopyProp(type, this, GetColumnMap()); } /// /// 将对象转换成ORM中的类型 /// /// Orm中的BASEMaterialTypeView类型 public BASEMaterialTypeView ToOrm() { BASEMaterialTypeView type = new BASEMaterialTypeView(); EntityPropHelper.CopyProp(this, type, GetColumnMap()); return type; } /// /// 获取自定义角色类中的字段名为键,orm中对象的字段名为值的字段 /// /// public static Dictionary GetColumnMap() { return new Dictionary() { {"Id", "id"}, {"Name", "name"}, {"Remark", "remark"}, {"Type", "type"}, {"RefLabel", "reflabel"} }; } /// /// 根据MaterialTypeViewEntity的字段转BASEMaterialTypeView的字段 /// /// MaterialTypeViewEntity的字段 /// BASEMaterialTypeView public static string GetColumnName(string name) { var columnMap = GetColumnMap(); return columnMap.ContainsKey(name) ? columnMap[name] : name; } /// /// 获取MaterialTypeViewEntity对应的表名 /// /// 表名 public static string GetTableName() { return "[dbo].[BASEMaterialTypeView]"; } } }