| | |
| | | exp.AndIF(StartTime.HasValue, x => x.DataTime >= StartTime.Value); |
| | | exp.AndIF(EndTime.HasValue, x => x.DataTime <= EndTime.Value); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | |
| | | var exp = Expressionable.Create<Entity.RunRealRecord>(); |
| | | exp.And(x => x.DataTime >= Day.Date && x.DataTime < Day.AddDays(1).Date); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | |
| | | var exp = Expressionable.Create<Entity.RunRealRecord>(); |
| | | exp.And(x => x.DataTime >= StartDay.Date && x.DataTime < EndDay.AddDays(1).Date); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | |
| | | var exp = Expressionable.Create<Entity.RunRealRecord>(); |
| | | exp.And(x => x.DataTime >= StartTime && x.DataTime <= EndTime); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | |
| | | exp.AndIF(StartTime.HasValue, x => x.DataTime >= StartTime.Value); |
| | | exp.AndIF(EndTime.HasValue, x => x.DataTime <= EndTime.Value); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | |
| | | var exp = Expressionable.Create<Entity.RunRealRecord>(); |
| | | exp.And(x => x.DataTime >= Day.Date && x.DataTime < Day.AddDays(1).Date); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | |
| | | var exp = Expressionable.Create<Entity.RunRealRecord>(); |
| | | exp.And(x => x.DataTime >= StartDay.Date && x.DataTime < EndDay.AddDays(1).Date); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | |
| | | var exp = Expressionable.Create<Entity.RunRealRecord>(); |
| | | exp.And(x => x.DataTime >= StartTime && x.DataTime <= EndTime); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | |
| | | exp.AndIF(StartTime.HasValue, x => x.DataTime >= StartTime.Value); |
| | | exp.AndIF(EndTime.HasValue, x => x.DataTime <= EndTime.Value); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | |
| | | exp.And(x => x.ObjectType == ObjectType); |
| | | exp.And(x => x.ObjectID == ObjectID); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | |
| | | exp.And(x => x.ObjectType == ObjectType); |
| | | exp.And(x => x.ObjectID == ObjectID); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | |
| | | .Where(exp.ToExpression()) |
| | | .OrderBy(x => x.DataTime, OrderByType.Asc) |
| | | .ToList(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过 ObjectType 和 ObjectID 获取 (限制数量) |
| | | /// </summary> |
| | | public List<Entity.RunRealRecord> GetLimitByObjectTypeAndObjectID(string ObjectType, long ObjectID, DateTime? StartTime, DateTime? EndTime, int Limit, bool? Run = null) |
| | | { |
| | | if (StartTime.HasValue && EndTime.HasValue) |
| | | { |
| | | if (StartTime.Value > EndTime.Value) |
| | | { |
| | | return default; |
| | | } |
| | | } |
| | | var exp = Expressionable.Create<Entity.RunRealRecord>(); |
| | | exp.AndIF(StartTime.HasValue, x => x.DataTime >= StartTime.Value); |
| | | exp.AndIF(EndTime.HasValue, x => x.DataTime <= EndTime.Value); |
| | | exp.And(x => x.ObjectType == ObjectType); |
| | | exp.And(x => x.ObjectID == ObjectID); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | var list = db.Queryable<Entity.RunRealRecord>() |
| | | .Where(exp.ToExpression()) |
| | | .OrderBy(x => x.DataTime, OrderByType.Asc) |
| | | .ToList(); |
| | | return list?.ToLimitList(Limit); |
| | | } |
| | | } |
| | | |
| | |
| | | exp.And(x => x.ObjectType == ObjectType); |
| | | exp.And(x => x.ObjectID == ObjectID); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | |
| | | .Where(exp.ToExpression()) |
| | | .OrderBy(x => x.DataTime, OrderByType.Asc) |
| | | .ToList(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过 ObjectType 和 ObjectID 获取某日的数据 (限制数量) |
| | | /// </summary> |
| | | public List<Entity.RunRealRecord> GetLimitByObjectTypeAndObjectIDOfDay(string ObjectType, long ObjectID, DateTime Day, int Limit, bool? Run = null) |
| | | { |
| | | var exp = Expressionable.Create<Entity.RunRealRecord>(); |
| | | exp.And(x => x.DataTime >= Day.Date && x.DataTime < Day.AddDays(1).Date); |
| | | exp.And(x => x.ObjectType == ObjectType); |
| | | exp.And(x => x.ObjectID == ObjectID); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | var list = db.Queryable<Entity.RunRealRecord>() |
| | | .Where(exp.ToExpression()) |
| | | .OrderBy(x => x.DataTime, OrderByType.Asc) |
| | | .ToList(); |
| | | return list?.ToLimitList(Limit); |
| | | } |
| | | } |
| | | |
| | |
| | | exp.And(x => x.ObjectType == ObjectType); |
| | | exp.And(x => x.ObjectID == ObjectID); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | |
| | | .Where(exp.ToExpression()) |
| | | .OrderBy(x => x.DataTime, OrderByType.Asc) |
| | | .ToList(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过 ObjectType 和 ObjectID 获取日期区间内的数据 (限制数量) |
| | | /// </summary> |
| | | public List<Entity.RunRealRecord> GetLimitByObjectTypeAndObjectIDOfDayRange(string ObjectType, long ObjectID, DateTime StartDay, DateTime EndDay, int Limit, bool? Run = null) |
| | | { |
| | | if (StartDay.Date > EndDay.Date) |
| | | { |
| | | return default; |
| | | } |
| | | var exp = Expressionable.Create<Entity.RunRealRecord>(); |
| | | exp.And(x => x.DataTime >= StartDay.Date && x.DataTime < EndDay.AddDays(1).Date); |
| | | exp.And(x => x.ObjectType == ObjectType); |
| | | exp.And(x => x.ObjectID == ObjectID); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | var list = db.Queryable<Entity.RunRealRecord>() |
| | | .Where(exp.ToExpression()) |
| | | .OrderBy(x => x.DataTime, OrderByType.Asc) |
| | | .ToList(); |
| | | return list?.ToLimitList(Limit); |
| | | } |
| | | } |
| | | |
| | |
| | | exp.And(x => x.ObjectType == ObjectType); |
| | | exp.And(x => x.ObjectID == ObjectID); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | |
| | | .Where(exp.ToExpression()) |
| | | .OrderBy(x => x.DataTime, OrderByType.Asc) |
| | | .ToList(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过 ObjectType 和 ObjectID 获取时间区间内的数据 (限制数量) |
| | | /// </summary> |
| | | public List<Entity.RunRealRecord> GetLimitByObjectTypeAndObjectIDOfTimeRange(string ObjectType, long ObjectID, DateTime StartTime, DateTime EndTime, int Limit, bool? Run = null) |
| | | { |
| | | if (StartTime > EndTime) |
| | | { |
| | | return default; |
| | | } |
| | | var exp = Expressionable.Create<Entity.RunRealRecord>(); |
| | | exp.And(x => x.DataTime >= StartTime && x.DataTime <= EndTime); |
| | | exp.And(x => x.ObjectType == ObjectType); |
| | | exp.And(x => x.ObjectID == ObjectID); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | var list = db.Queryable<Entity.RunRealRecord>() |
| | | .Where(exp.ToExpression()) |
| | | .OrderBy(x => x.DataTime, OrderByType.Asc) |
| | | .ToList(); |
| | | return list?.ToLimitList(Limit); |
| | | } |
| | | } |
| | | |
| | |
| | | exp.And(x => x.ObjectType == ObjectType); |
| | | exp.And(x => x.ObjectID == ObjectID); |
| | | exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); |
| | | exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); |
| | | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | |
| | | { |
| | | var sb = new StringBuilder(); |
| | | sb.AppendLine("INSERT INTO run_real_record"); |
| | | sb.AppendLine($" VALUES(@objecttype,@objectid,@datatime,@rsa,@continueruntime,@totalruntime,@boottimes,@analystatus,@analyinfo)"); |
| | | sb.AppendLine($" VALUES(@objecttype,@objectid,@datatime,@rsa,@continuetime,@totalshuttime,@totalruntime,@boottimes,@analystatus,@analyinfo)"); |
| | | sb.AppendLine("ON CONFLICT(objecttype, objectid, datatime) DO UPDATE"); |
| | | sb.AppendLine("SET rsa = excluded.rsa,"); |
| | | sb.AppendLine("continueruntime = excluded.continueruntime,"); |
| | | sb.AppendLine("continuetime = excluded.continuetime,"); |
| | | sb.AppendLine("totalshuttime = excluded.totalshuttime,"); |
| | | sb.AppendLine("totalruntime = excluded.totalruntime,"); |
| | | sb.AppendLine("boottimes = excluded.boottimes,"); |
| | | sb.AppendLine("analystatus = excluded.analystatus,"); |
| | |
| | | //创建参数 |
| | | private List<SugarParameter> CreateParameters(Entity.RunRealRecord entity) |
| | | { |
| | | var list = new List<SugarParameter>(); |
| | | list.Add(new SugarParameter("@objecttype", entity.ObjectType)); |
| | | list.Add(new SugarParameter("@objectid", entity.ObjectID)); |
| | | list.Add(new SugarParameter("@datatime", entity.DataTime)); |
| | | list.Add(new SugarParameter("@rsa", entity.RSa)); |
| | | list.Add(new SugarParameter("@continueruntime", entity.ContinueRunTime)); |
| | | list.Add(new SugarParameter("@totalruntime", entity.TotalRunTime)); |
| | | list.Add(new SugarParameter("@boottimes", entity.BootTimes)); |
| | | list.Add(new SugarParameter("@analystatus", entity.AnalyStatus)); |
| | | list.Add(new SugarParameter("@analyinfo", entity.AnalyInfo)); |
| | | var list = new List<SugarParameter> |
| | | { |
| | | new SugarParameter("@objecttype", entity.ObjectType), |
| | | new SugarParameter("@objectid", entity.ObjectID), |
| | | new SugarParameter("@datatime", entity.DataTime), |
| | | new SugarParameter("@rsa", entity.RSa), |
| | | new SugarParameter("@continuetime", entity.ContinueTime), |
| | | new SugarParameter("@totalshuttime", entity.TotalShutTime), |
| | | new SugarParameter("@totalruntime", entity.TotalRunTime), |
| | | new SugarParameter("@boottimes", entity.BootTimes), |
| | | new SugarParameter("@analystatus", entity.AnalyStatus), |
| | | new SugarParameter("@analyinfo", entity.AnalyInfo) |
| | | }; |
| | | return list; |
| | | } |
| | | |