/// <summary> /// 大数据界面用户区域用气量数据 /// </summary> /// <param name="currtime"></param> /// <param name="begtime"></param> /// <returns></returns> public object GasUseSer(DateTime currtime, DateTime begtime) { //获取区域信息 var bbarea = bbdal.QueryWhere(x => true); //Join ef联表查询 ,一个表的结果集合join另一个表的结果集合,然后用相同字段 var res = dal.QuerySplitPage(d => d.DateTime >= begtime && d.DateTime <= currtime, or => or.OrderByDescending(o => o.Id), 25, 1).Select(s => new { inletSQ = Math.Round((decimal)s.Inlet_SQ, 2), areaID = s.AreaID }).OrderBy(o => o.areaID).Join(bbarea, m => m.areaID, n => n.Code, (m, n) => new { value = m.inletSQ,//单位kNm3 name = n.Name }).ToList(); return(res); }
public object GasUseSer(DateTime currtime, DateTime begtime) { var bbarea = bbdal.QueryWhere(x => true); //var res = dal.QueryWhere(d => d.DateTime >= begtime && d.DateTime <= currtime).GroupBy(g => new { g.AreaID, g.FactoryID }).Select(s => new //{ // inletSQ = Math.Round((decimal)s.Average(i => i.Inlet_SQ), 2), // areaID = s.Key.AreaID //}).Join(bbarea, m => m.areaID, n => n.Code, (m, n) => new //{ // value = m.inletSQ, // name = n.Name //}).ToList(); var res = dal.QuerySplitPage(d => d.DateTime >= begtime && d.DateTime <= currtime, or => or.OrderByDescending(o => o.Id), 21, 1).Select(s => new { inletSQ = Math.Round((decimal)s.Inlet_SQ, 2), areaID = s.AreaID }).OrderBy(o => o.areaID).Join(bbarea, m => m.areaID, n => n.Code, (m, n) => new { value = m.inletSQ, name = n.Name }).ToList(); return(res); }