62,074
社区成员
发帖
与我相关
我的任务
分享
using System;
using NHibernate.Mapping.Attributes;
using PCITC.MES.EAM.Poco.Equip;
using PCITC.MES.EAM.Poco.SysManager;
namespace PCITC.MES.EAM.Poco.ProfessionalManagement
{
[Class(Table = "eam_pro_sealed_management_t")]
[Component(Name = "SealedManagement")]
public class SealedManagement
{
/// <summary>
/// ID
/// </summary>
[Id(0, TypeType = typeof(long), Name = "Id", UnsavedValue = "0")]
[Column(1, Name = "ID", NotNull = true, SqlType = "number")]
[Generator(2, Class = "sequence")]
[Param(3, Name = "sequence", Content = "s_eam_pro_sealed_management")]
public virtual long Id { get; set; }
/// <summary>
/// 装置编号
/// </summary>
[Property(Column = "function_place_code")]
public virtual string FunctionPlaceCode { get; set; }
/// <summary>
/// 装置名称
/// </summary>
[Property(Column = "function_place_name")]
public virtual string FunctionPlaceName { get; set; }
/// <summary>
/// 密封类型Id
/// </summary>
[Property(Column = "seal_type_id")]
public virtual long? SealTypeId { get; set; }
/// <summary>
/// 设备种类Id
/// </summary>
[Property(Column = "equip_type_id")]
public virtual long? EquipTypeId { get; set; }
/// <summary>
/// 计数键值/ID
/// </summary>
[Property(Column = "countkey_id")]
public virtual long? CountKeyId { get; set; }
/// <summary>
/// 密封点数
/// </summary>
[Property(Column = "sealpoints_count")]
public virtual long? SealPointsCount { get; set; }
/// <summary>
/// 登记日期
/// </summary>
[Property(Column = "registration_date")]
public virtual DateTime? RegistrationDate { get; set; }
/// <summary>
/// 登记人
/// </summary>
[Property(Column = "registration_people")]
public virtual string RegistrationPeople { get; set; }
/// <summary>
/// 上次修改时间
/// </summary>
[Property(Column = "last_modified_date")]
public virtual DateTime? LastModifiedDate { get; set; }
/// <summary>
/// 上次修改人
/// </summary>
[Property(Column = "last_modified_people")]
public virtual string LastModifiedPeople { get; set; }
/// <summary>
/// 上次备注
/// </summary>
[Property(Column = "last_remark")]
public virtual string LastRemark { get; set; }
/// <summary>
/// 装置区域Id
/// </summary>
[Property(Column = "equip_area_id")]
public virtual long? EquipAreaId { get; set; }
/// <summary>
/// 密封类型:在字典表中定义
/// </summary>
[ManyToOne(0, ClassType = typeof(SysDictSub), Column = "SealTypeId", OuterJoin = OuterJoinStrategy.True, Lazy = Laziness.False, NotFound = NotFoundMode.Ignore, Cascade = "save-update", Insert = false, Update = false)]
public virtual SysDictSub SysDictSubEntityBySealType { get; set; }
/// <summary>
/// 设备种类:在字典表中定义
/// </summary>
[ManyToOne(0, ClassType = typeof(SysDictSub), Column = "EquipTypeId", OuterJoin = OuterJoinStrategy.True, Lazy = Laziness.False, NotFound = NotFoundMode.Ignore, Cascade = "save-update", Insert = false, Update = false)]
public virtual SysDictSub SysDictSubEntityByEquipType { get; set; }
/// <summary>
/// 装置区域:在字典表中定义
/// </summary>
[ManyToOne(0, ClassType = typeof(SysDictSub), Column = "EquipAreaId", OuterJoin = OuterJoinStrategy.True, Lazy = Laziness.False, NotFound = NotFoundMode.Ignore, Cascade = "save-update", Insert = false, Update = false)]
public virtual SysDictSub SysDictSubEntityByEquipArea { get; set; }
}
}
using System;
using PCITC.MES.EAM.UI.Areas.SysManager.Models;
namespace PCITC.MES.EAM.UI.Areas.ProfessionalManagement.Models
{
public class SealedManagement
{
/// <summary>
/// ID
/// </summary>
public long Id { get; set; }
/// <summary>
/// 装置编号
/// </summary>
public string FunctionPlaceCode { get; set; }
/// <summary>
/// 装置名称
/// </summary>
public string FunctionPlaceName { get; set; }
/// <summary>
/// 密封类型
/// </summary>
public string SealType { get; set; }
/// <summary>
/// 设备种类
/// </summary>
public string EquipType { get; set; }
/// <summary>
/// 计数键值/ID
/// </summary>
public long? CountKeyId { get; set; }
/// <summary>
/// 密封点数
/// </summary>
public long? SealPointsCount { get; set; }
/// <summary>
/// 登记日期
/// </summary>
public DateTime? RegistrationDate { get; set; }
/// <summary>
/// 登记人
/// </summary>
public string RegistrationPeople { get; set; }
/// <summary>
/// 上次修改时间
/// </summary>
public DateTime? LastModifiedDate { get; set; }
/// <summary>
/// 上次修改人
/// </summary>
public string LastModifiedPeople { get; set; }
/// <summary>
/// 上次备注
/// </summary>
public string LastRemark { get; set; }
//外键
/// <summary>
/// 密封类型字典表编号
/// </summary>
public long? SealTypeId { get; set; }
/// <summary>
/// 设备种类字典表编号
/// </summary>
public long? EquipTypeId { get; set; }
/// <summary>
/// 装置区域Id
/// </summary>
public long? EquipAreaId { get; set; }
/// <summary>
/// 装置ID
/// </summary>
public long? EquipFuncPlaceId { get; set; }
}
}
/// <summary>
/// pocoModel转viewModel
/// </summary>
/// <param name="pocoModel"></param>
/// <returns></returns>
public static SealedManagement BuildSealedManagementToViewModel(Poco.ProfessionalManagement.SealedManagement pocoModel)
{
// 必须声明要转换的类型。可以在程序开始时一次性完成
Mapper.CreateMap<Poco.ProfessionalManagement.SealedManagement, SealedManagement>()
.ForMember(dto => dto.SealType, conf => conf.MapFrom(ol => ol.SysDictSubEntityByEquipType.SubKeyValue))
.ForMember(dto => dto.EquipType, conf => conf.MapFrom(ol => ol.SysDictSubEntityByEquipType.SubKeyValue));
//.ForMember(dto => dto.FunctionPlaceCode, conf => conf.MapFrom(ol => ol.SysDictSubEntityByEquipFuncPlace.FunctionPlaceCode))
//.ForMember(dto => dto.FunctionPlaceName, conf => conf.MapFrom(ol => ol.SysDictSubEntityByEquipFuncPlace.FunctionPlaceName));
// 验证类型映射是否正确
//Mapper.AssertConfigurationIsValid();
return Mapper.Map<Poco.ProfessionalManagement.SealedManagement, SealedManagement>(pocoModel);