| | |
| | | } |
| | | |
| | | /// <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); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过 ObjectType 和 ObjectID 获取某日的数据 |
| | | /// </summary> |
| | | public List<Entity.RunRealRecord> GetByObjectTypeAndObjectIDOfDay(string ObjectType, long ObjectID, DateTime Day, bool? Run = null) |
| | |
| | | .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); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /// <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); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过 ObjectType 和 ObjectID 获取时间区间内的数据 |
| | | /// </summary> |
| | | public List<Entity.RunRealRecord> GetByObjectTypeAndObjectIDOfTimeRange(string ObjectType, long ObjectID, DateTime StartTime, DateTime EndTime, bool? Run = null) |
| | |
| | | } |
| | | |
| | | /// <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); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过 ObjectType 和 ObjectID 获取分页列表 |
| | | /// </summary> |
| | | public List<Entity.RunRealRecord> GetPageListByObjectTypeAndObjectID(string ObjectType, long ObjectID, DateTime? StartTime, DateTime? EndTime, bool? Run, int PageIndex, int PageSize, ref int Total) |