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();
寻寻觅觅转流年,磕磕碰碰道缘浅。
揽几缕、轻挽起,暮暮朝朝与君语。
浙公网安备 33010602011771号