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.Check.Entity { public class PlanEntity : ICommonEntity { /// /// 1计划表主键id /// public int Id { get; set; } /// /// 2计划编号 /// public string PlanNo { get; set; } /// /// 3开始时间 /// public DateTime BeginTime { get; set; } /// /// 4结束时间 /// public DateTime EndTime { get; set; } /// /// 5修改时间 /// public DateTime UpdateTime { get; set; } /// /// 6计划类型(日计划,月计划) /// public string TypeName { get; set; } /// /// 7计划状态 /// public int Status { get; set; } /// /// 8备注 /// public string Remark { get; set; } /// /// 盘点计划明细 /// public List PlanMaterialPlace { get; set; } /// /// 无参构造 /// public PlanEntity() { } /// /// 有参构造 /// /// orm映射的类 public PlanEntity(CheckPlan plan) { EntityPropHelper.CopyProp(plan, this, GetColumnMap()); } /// /// 将对象转换成ORM中的类型 /// /// Orm中的CheckPlan类型 public CheckPlan ToOrm() { var place = new CheckPlan(); EntityPropHelper.CopyProp(this, place, GetColumnMap()); return place; } /// /// 获取自定义角色类中的字段名为键,orm中对象的字段名为值的字段 /// /// public static Dictionary GetColumnMap() { return new Dictionary() { {"Id", "id"}, {"PlanNo", "planno"}, {"BeginTime", "begintime"}, {"EndTime", "endtime"}, {"UpdateTime", "updatetime"}, {"TypeName", "typename"}, {"Status", "status"}, {"Remark", "remark"} }; } /// /// 根据 的字段转CheckPlan的字段 /// /// 的字段 /// CheckPlan public static string GetColumnName(string name) { var columnMap = GetColumnMap(); return columnMap.ContainsKey(name) ? columnMap[name] : name; } /// /// 获取WareHouseAreaTypeEntity对应的表名 /// /// 表名 public static string GetTableName() { return "[dbo].[CheckPlan]"; } } }