using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OrmTest { public class UIncludesBigData { public static void Init() { Console.WriteLine(""); Console.WriteLine("#### SqlQueryable Start ####"); SqlSugarClient db = NewUnitTest.Db; var b = DateTime.Now; var data1 = db.Queryable() .Includes(t => t.StationConfigs, m => m.BaseStationConfig) .Where(t => t.DeleteTime == null) .OrderBy(t => t.StationCode, OrderByType.Asc) .ToList(); var b1 = DateTime.Now.Subtract(b).TotalMilliseconds; Console.WriteLine("#### SqlQueryable End ####"); } } /// /// 工作站信息 /// [SugarTable("TB_STATION", TableDescription = "工作站表")] public partial class StationEntity { #region 实体成员 /// /// 主键 /// [SugarColumn(IsPrimaryKey = true, ColumnName = "F_Id")] public string KeyID { get; set; } /// /// 创建人编号 /// [SugarColumn(ColumnName = "F_CREATORUSERID")] public string CreatorUserId { get; set; } /// /// 创建时间 /// [SugarColumn(ColumnName = "F_CREATORTIME")] public DateTime? CreatorTime { get; set; } /// /// 修改人 /// [SugarColumn(ColumnName = "F_LASTMODIFYUSERID")] public String LastModifyUserId { get; set; } /// /// 修改时间 /// [SugarColumn(ColumnName = "F_LASTMODIFYTIME")] public DateTime? LastModifyTime { get; set; } /// /// 删除时间 /// [SugarColumn(ColumnName = "F_DELETETIME")] public DateTime? DeleteTime { get; set; } /// /// 删除人员ID /// [SugarColumn(ColumnName = "F_DELETEUSERID")] public string DeleteUserId { get; set; } /// /// 产线ID /// [SugarColumn(ColumnName = "C_LINEID")] public string LineID { get; set; } /// /// 工作站编组ID /// [SugarColumn(ColumnName = "C_STATIONGROUPID")] public string StationGroupID { get; set; } /// /// 工作站对应有效地址 /// [SugarColumn(ColumnName = "StationConfigs", IsIgnore = true)] [Navigate(NavigateType.OneToMany, nameof(StationConfigEntity.StationID))] public List StationConfigs { get; set; } /// /// 基础表ID /// [SugarColumn(ColumnName = "C_BASESTATIONID")] public string BaseStationID { get; set; } /// /// 站名称 /// [SugarColumn(ColumnName = "C_NAME", IsIgnore = true)] //[Navigate(NavigateType.OneToOne, nameof(BaseStationID))] public string Name { get; set; } /// /// 当前状态 /// [SugarColumn(ColumnName = "C_CURSTATE")] public int? CurState { get; set; } /// /// 工作站编号 /// [SugarColumn(ColumnName = "C_STATIONCODE")] public int? StationCode { get; set; } /// /// 配方ID(当前系统工作站正在使用的配方) /// [SugarColumn(ColumnName = "C_RECIPEID")] public string RecipeID { get; set; } /// /// IP地址 /// [SugarColumn(ColumnName = "C_IP")] public string Ip { get; set; } /// /// 站边电脑IP地址 /// [SugarColumn(ColumnName = "C_PCIP")] public String PcIp { get; set; } /// /// 端口号 /// [SugarColumn(ColumnName = "C_PORT")] public int? Port { get; set; } /// /// PLC类型 /// [SugarColumn(ColumnName = "C_PLCTYPE")] public int? PlcType { get; set; } /// /// 工作站类型 /// [SugarColumn(ColumnName = "C_STATIONTYPE")] public int? StaType { get; set; } /// /// 是否可用 /// [SugarColumn(ColumnName = "ENABLEDMARK")] public bool? EnabledMark { get; set; } /// /// 子工作站数量 /// [SugarColumn(ColumnName = "C_CHILDRENCOUNT")] public int ChildrenCount { get; set; } /// /// 打标数量 /// [SugarColumn(ColumnName = "C_PRINTCOUNT")] public int PrintCount { get; set; } /// /// 图表数量 /// [SugarColumn(ColumnName = "C_CHARTCOUNT")] public int ChartCount { get; set; } /// /// 文件数量 /// [SugarColumn(ColumnName = "C_FILECOUNT")] public int FileCount { get; set; } #endregion } /// /// 工作站地址配置表 /// [SugarTable("TB_STATIONCONFIG", TableDescription = "工作站地址配置表")] public partial class StationConfigEntity { #region 实体成员 /// /// 主键 /// [SugarColumn(IsPrimaryKey = true, ColumnName = "F_Id")] public string KeyID { get; set; } /// /// 创建人编号 /// [SugarColumn(ColumnName = "F_CREATORUSERID")] public string CreatorUserId { get; set; } /// /// 创建时间 /// [SugarColumn(ColumnName = "F_CREATORTIME")] public DateTime? CreatorTime { get; set; } /// /// 修改人 /// [SugarColumn(ColumnName = "F_LASTMODIFYUSERID")] public String LastModifyUserId { get; set; } /// /// 修改时间 /// [SugarColumn(ColumnName = "F_LASTMODIFYTIME")] public DateTime? LastModifyTime { get; set; } /// /// 删除时间 /// [SugarColumn(ColumnName = "F_DELETETIME")] public DateTime? DeleteTime { get; set; } /// /// 删除人员ID /// [SugarColumn(ColumnName = "F_DELETEUSERID")] public string DeleteUserId { get; set; } /// /// 工作站ID /// [SugarColumn(ColumnName = "C_STATIONID")] public string StationID { get; set; } /// /// 工作站站地址基本配置信息ID /// [SugarColumn(ColumnName = "C_BASESTATIONCONFIGID")] public string BaseStationConfigID { get; set; } /// /// 工作站站地址基本配置信息 /// [SugarColumn(ColumnName = "BASESTATIONCONFIG", IsIgnore = true)] [Navigate(NavigateType.OneToOne, nameof(BaseStationConfigID))] public BaseStationConfigEntity BaseStationConfig { get; set; } ///// ///// 地址对应的请求信息 ///// //[SugarColumn(ColumnName = "StationConfigRequests", IsIgnore = true)] //[Navigate(NavigateType.OneToMany, nameof(StationConfigRequestEntity.StationConfigID))] //public List StationConfigRequests { get; set; } /// /// 配置编号 /// [SugarColumn(ColumnName = "C_CONFIGCODE")] public int? ConfigCode { get; set; } /// /// DB地址 /// [SugarColumn(ColumnName = "C_DB")] public int? Db { get; set; } /// /// 偏移量 /// [SugarColumn(ColumnName = "C_OFFSET")] public decimal? Offset { get; set; } /// /// 地址类型 /// [SugarColumn(ColumnName = "C_ADDRTYPE")] public int? AddrType { get; set; } /// /// 使用类型 /// [SugarColumn(ColumnName = "C_USETYPE")] public int? UseType { get; set; } /// /// 访问权限 /// [SugarColumn(ColumnName = "C_DUTYCONTROL")] public int? DutyControl { get; set; } /// /// 描述 /// [SugarColumn(ColumnName = "C_DESC")] public String Desc { get; set; } /// /// 响应地址(存储的为基础ID) /// [SugarColumn(ColumnName = "C_REPLYID")] public String ReplyID { get; set; } /// /// 配件对应地址 /// [SugarColumn(ColumnName = "C_CMDID")] public String CmdID { get; set; } /// /// 保存参数绑定列名(用于后台,不能用于前端) /// [SugarColumn(ColumnName = "C_SAVECOL")] public String SaveCol { get; set; } /// /// 响应异常值 /// [SugarColumn(ColumnName = "C_REPLYEXCEPTION")] public int? ReplyException { get; set; } /// /// 是否可用 /// [SugarColumn(ColumnName = "ENABLEDMARK")] public bool? EnabledMark { get; set; } /// /// 序列 /// [SugarColumn(ColumnName = "C_INDEX")] public int? Index { get; set; } /// /// 读取优先级 /// [SugarColumn(ColumnName = "C_PRIORITY")] public int? Priority { get; set; } /// /// 当前值(用于仿真使用) /// [SugarColumn(ColumnName = "F_CURVALUE")] public string CurValue { get; set; } #endregion } /// /// 基本工作站配置信息 /// [SugarTable("TB_BASESTATIONCONFIG", TableDescription = "基本工作站站配置")] public partial class BaseStationConfigEntity { #region 实体成员 /// /// 主键 /// [SugarColumn(IsPrimaryKey = true, ColumnName = "F_Id")] public string KeyID { get; set; } /// /// 创建人编号 /// [SugarColumn(ColumnName = "F_CREATORUSERID")] public string CreatorUserId { get; set; } /// /// 创建时间 /// [SugarColumn(ColumnName = "F_CREATORTIME")] public DateTime? CreatorTime { get; set; } /// /// 修改人 /// [SugarColumn(ColumnName = "F_LASTMODIFYUSERID")] public String LastModifyUserId { get; set; } /// /// 修改时间 /// [SugarColumn(ColumnName = "F_LASTMODIFYTIME")] public DateTime? LastModifyTime { get; set; } /// /// 删除时间 /// [SugarColumn(ColumnName = "F_DELETETIME")] public DateTime? DeleteTime { get; set; } /// /// 删除人员ID /// [SugarColumn(ColumnName = "F_DELETEUSERID")] public string DeleteUserId { get; set; } /// /// 工作站ID /// [SugarColumn(ColumnName = "C_BASESTATIONID")] public String BaseStationID { get; set; } /// /// 地址名称 /// [SugarColumn(ColumnName = "C_ADDRNAME")] public String AddrName { get; set; } /// /// 注释 /// [SugarColumn(ColumnName = "C_DESC")] public String Desc { get; set; } /// /// 初始配置编号 /// [SugarColumn(ColumnName = "C_CONFIGCODE")] public int? ConfigCode { get; set; } /// /// 初始DB地址 /// [SugarColumn(ColumnName = "C_DB")] public int? Db { get; set; } /// /// 初始偏移量 /// [SugarColumn(ColumnName = "C_OFFSET")] public decimal? Offset { get; set; } /// /// 地址类型 /// [SugarColumn(ColumnName = "C_ADDRTYPE")] public int? AddrType { get; set; } /// /// 使用类型 /// [SugarColumn(ColumnName = "C_USETYPE")] public int? UseType { get; set; } /// /// 访问权限 /// [SugarColumn(ColumnName = "C_DUTYCONTROL")] public int? DutyControl { get; set; } /// /// 是否可用 /// [SugarColumn(ColumnName = "ENABLEDMARK")] public bool? EnabledMark { get; set; } #endregion } }