诗情寻知己
揽几缕、轻挽起,暮暮朝朝与君语。
var query = from h in _repository.Context.Set<TbCapcity>().Where(e => e.IsActive == true)
                        join l in _repository.Context.Set<TbLocation>().Where(e => e.IsActive == true) on h.LocationCode equals l.LocationCode 
                        join b in _repository.Context.Set<TbBooking>().Where(b => b.IsActive == true) on 
                        new { BuCode = h.Bucode, LocationCode = h.LocationCode, Date = h.Date } equals new { BuCode = b.Bucode, LocationCode = b.LocationCode, Date = b.InspectionDate }
                        into hlb from hlb2 in hlb.DefaultIfEmpty()
                        group new { h, hlb2 } by new { h.Bucode, h.LocationCode, l.LocationShortName } into g
                        select new CapcityDto
                        {
                            #region Field
                            BuCode = g.Key.Bucode,
                            LocationName = g.Key.LocationShortName,
                            LocationCode = g.Key.LocationCode,
                            Mds = g.Sum(h=>h.h.Mds),
                            BookingMds = g.Sum(b=>b.hlb2.Mds),
                            #endregion
                        };

query = query.Where(i => i.BuCode == queryDto.BuCode);
list =await query.ToListAsync();

  

posted on 2022-08-17 17:16  诗情寻知己  阅读(95)  评论(0)    收藏  举报