326 lines
8.8 KiB
C#
326 lines
8.8 KiB
C#
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
|
|
namespace APT.Infrastructure.Core
|
|
{
|
|
/// <summary>
|
|
/// 实体基类
|
|
/// </summary>
|
|
/// <typeparam name="TKey">主键类型</typeparam>
|
|
public abstract class EntityBase<TKey> : ICloneable
|
|
{
|
|
/// <summary>
|
|
/// 实体基类
|
|
/// </summary>
|
|
public EntityBase()
|
|
{
|
|
this.FLOW_STATUS = 0;//默认为审核通过
|
|
|
|
}
|
|
public Object Clone()
|
|
{
|
|
return MemberwiseClone();
|
|
}
|
|
|
|
[Description("主键")]
|
|
public TKey ID { get; set; }
|
|
|
|
[Description("逻辑删除")]
|
|
|
|
public bool IS_DELETED { get; set; }
|
|
[Description("组织ID")]
|
|
|
|
public Guid? ORG_ID { get; set; }
|
|
/// <summary>
|
|
/// EntityOrgTypeEnum
|
|
/// </summary>
|
|
[Description("实体组织类型")]
|
|
public int ENTITY_ORG_TPYE { get; set; }
|
|
|
|
[Description("窗体模板ID")]
|
|
public Guid? FORM_ID { get; set; }
|
|
|
|
[Description("审核状态")]
|
|
public int FLOW_STATUS { get; set; }
|
|
|
|
[Description("送审状态")]
|
|
public int FLOW_SEND_STATUS { get; set; }
|
|
|
|
[Description("流程ID")]
|
|
public Guid? FLOW_ID { get; set; }
|
|
|
|
|
|
[Description("创建时间")]
|
|
public System.DateTime? CREATE_TIME { get; set; }
|
|
[Description("修改时间")]
|
|
public System.DateTime? MODIFY_TIME { get; set; }
|
|
//[Description("时间戳")]
|
|
//public byte[] RowVersion { get; set; }
|
|
[Description("创建人")]
|
|
public Guid? CREATER_ID { get; set; }
|
|
|
|
[Description("修改人")]
|
|
public Guid? MODIFIER_ID { get; set; }
|
|
|
|
[Description("数据库连接")]
|
|
public string DbConn { get; set; }
|
|
|
|
[Description("组织")]
|
|
public virtual T_FM_ORGANIZATION Nav_Org { get; set; }
|
|
|
|
[Description("消息ID")]
|
|
public Guid TaskID { get; set; }
|
|
|
|
/// <summary>
|
|
/// 参数
|
|
/// </summary>
|
|
[JsonIgnore]
|
|
private ParamDynamicDictionary _parmDic = null;
|
|
[JsonIgnore]
|
|
[Description("参数")]
|
|
public dynamic SysParams
|
|
{
|
|
get
|
|
{
|
|
if (_parmDic == null)
|
|
{
|
|
if (this.Nav_SysParams == null)
|
|
this.Nav_SysParams = new List<T_PF_PARAM>();
|
|
_parmDic = new ParamDynamicDictionary(this.Nav_SysParams, this);
|
|
}
|
|
return _parmDic;
|
|
}
|
|
}
|
|
|
|
[Description("系统参数")]
|
|
public virtual List<T_PF_PARAM> Nav_SysParams { get; set; }
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 主键类型为Guid的实体基类
|
|
/// </summary>
|
|
public abstract class MesEntityBase : EntityBase<Guid>
|
|
{
|
|
public MesEntityBase()
|
|
{
|
|
this.ID = Guid.NewGuid();
|
|
this.IS_DELETED = false;
|
|
this.CREATE_TIME = DateTime.Now;
|
|
this.MODIFY_TIME = DateTime.Now;
|
|
}
|
|
|
|
public virtual string ToString()
|
|
{
|
|
StringBuilder sb = new StringBuilder("");
|
|
sb.Append("{");
|
|
Type type = this.GetType();
|
|
PropertyInfo[] properties = type.GetProperties(
|
|
BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance);
|
|
|
|
foreach (PropertyInfo property in properties)
|
|
{
|
|
object propertyValue = property.GetValue(this, null);
|
|
sb.Append("\"");
|
|
sb.Append(property.Name);
|
|
sb.Append("\":");
|
|
if (propertyValue != null)
|
|
{
|
|
sb.Append(propertyValue.ToString());
|
|
}
|
|
else
|
|
{
|
|
sb.Append("");
|
|
}
|
|
sb.AppendLine("");
|
|
}
|
|
sb.Append("}");
|
|
return sb.ToString();
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// int型主键基类
|
|
/// </summary>
|
|
public abstract class MesIntEntityBase : EntityBase<int>
|
|
{
|
|
public MesIntEntityBase()
|
|
{
|
|
this.IS_DELETED = false;
|
|
this.CREATE_TIME = DateTime.Now;
|
|
this.MODIFY_TIME = DateTime.Now;
|
|
}
|
|
|
|
public virtual string ToString()
|
|
{
|
|
StringBuilder sb = new StringBuilder("");
|
|
sb.Append("{");
|
|
Type type = this.GetType();
|
|
PropertyInfo[] properties = type.GetProperties(
|
|
BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance);
|
|
|
|
foreach (PropertyInfo property in properties)
|
|
{
|
|
object propertyValue = property.GetValue(this, null);
|
|
sb.Append("\"");
|
|
sb.Append(property.Name);
|
|
sb.Append("\":");
|
|
if (propertyValue != null)
|
|
{
|
|
sb.Append(propertyValue.ToString());
|
|
}
|
|
else
|
|
{
|
|
sb.Append("");
|
|
}
|
|
sb.AppendLine("");
|
|
}
|
|
sb.Append("}");
|
|
return sb.ToString();
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// int型主键的树形表基类
|
|
/// </summary>
|
|
public abstract class MesTreeIntEntityBase : MesIntEntityBase
|
|
{
|
|
/// <summary>
|
|
/// 父级ID
|
|
/// </summary>
|
|
[Description("父级ID")]
|
|
public Guid? PARENT_ID { get; set; }
|
|
/// <summary>
|
|
/// 显示名称
|
|
/// </summary>
|
|
[Description("显示")]
|
|
public string TEXT { get; set; }
|
|
|
|
}
|
|
/// <summary>
|
|
/// GUID主键的树形表基类
|
|
/// </summary>
|
|
public abstract class MesTreeEntityBase : MesEntityBase
|
|
{
|
|
public MesTreeEntityBase()
|
|
{
|
|
this.IS_LEAF = true;
|
|
}
|
|
/// <summary>
|
|
/// 父级ID
|
|
/// </summary>
|
|
[Description("父级ID")]
|
|
public Guid? PARENT_ID { get; set; }
|
|
/// <summary>
|
|
/// 显示名称
|
|
/// </summary>
|
|
[Description("父级ID")]
|
|
public string TEXT { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否叶子节点
|
|
/// </summary>
|
|
[Description("是否叶子节点")]
|
|
public bool IS_LEAF { get; set; }
|
|
|
|
}
|
|
|
|
public abstract class TreeEntityBase<T> : MesTreeEntityBase
|
|
{
|
|
[Description("父节点")]
|
|
public virtual T Nav_Parent { get; set; }
|
|
|
|
[Description("子节点")]
|
|
public virtual ICollection<T> Nav_Children { get; set; }
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 审核
|
|
/// </summary>
|
|
public abstract class AuditMesEntityBase : MesEntityBase
|
|
{
|
|
|
|
#region
|
|
/// <summary>
|
|
/// 审核状态
|
|
/// </summary>
|
|
[Description("审核状态")]
|
|
public int AUDIT_STATUS { get; set; }
|
|
/// <summary>
|
|
/// 当前审批子节点ID
|
|
/// </summary>
|
|
[Description("当前审批子节点")]
|
|
|
|
public Guid? NODE_CHILD_ID { get; set; }
|
|
/// <summary>
|
|
/// 当前审批节点ID
|
|
/// </summary>
|
|
[Description("当前审批节点ID")]
|
|
|
|
public Guid? AUDIT_NODE_ID { get; set; }
|
|
/// <summary>
|
|
/// 审批流ID
|
|
/// </summary>
|
|
[Description("审批流ID")]
|
|
public Guid? AUDIT_FLOW_ID { get; set; }
|
|
#endregion
|
|
}
|
|
public abstract class EntityBase : EntityBase<Guid>
|
|
{
|
|
/// <summary>
|
|
/// 构造函数
|
|
/// </summary>
|
|
public EntityBase()
|
|
{
|
|
this.ID = Guid.NewGuid();
|
|
this.IS_DELETED = false;
|
|
this.CREATE_TIME = DateTime.Now;
|
|
this.MODIFY_TIME = DateTime.Now;
|
|
}
|
|
|
|
public virtual string ToString()
|
|
{
|
|
StringBuilder sb = new StringBuilder("");
|
|
sb.Append("{");
|
|
Type type = this.GetType();
|
|
PropertyInfo[] properties = type.GetProperties(
|
|
BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance);
|
|
|
|
foreach (PropertyInfo property in properties)
|
|
{
|
|
object propertyValue = property.GetValue(this, null);
|
|
sb.Append("\"");
|
|
sb.Append(property.Name);
|
|
sb.Append("\":");
|
|
if (propertyValue != null)
|
|
{
|
|
sb.Append(propertyValue.ToString());
|
|
}
|
|
else
|
|
{
|
|
sb.Append("");
|
|
}
|
|
sb.AppendLine("");
|
|
}
|
|
sb.Append("}");
|
|
return sb.ToString();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 包含部门ID的实体接口
|
|
/// </summary>
|
|
public interface IDepartmentEntity
|
|
{
|
|
/// <summary>
|
|
/// 部门ID
|
|
/// </summary>
|
|
Guid DEPARTMENT_ID { get; set; }
|
|
}
|
|
}
|