where+=$@" and od.{nameof(RB_Goods_OrderDetail.SupplierId)}={dmodel.SupplierId}";
}
if(!string.IsNullOrEmpty(dmodel.StartTime))
{
where+=$@" and o.{nameof(RB_Goods.CreateDate)} >='{dmodel.StartTime}'";
}
if(!string.IsNullOrEmpty(dmodel.EndTime))
{
where+=$@" and o.{nameof(RB_Goods.CreateDate)} <='{dmodel.EndTime+" 23:59:59"}'";
}
if(!string.IsNullOrEmpty(dmodel.GoodsName))
{
where+=$@" and od.{nameof(RB_Goods_OrderDetail.GoodsName)}='{dmodel.GoodsName}'";
}
stringsql=$@"SELECT GROUP_CONCAT(oc.OrderDetailId) as OrderDetailIds,oc.OrderId,oc.OrderDetailId,o.OrderNo,o.UserId,oc.CommissionRatio,oc.Type,oc.CommissionState,o.OrderStatus as DistrbutionOrderSelectStatus,SUM(oc.Commission) as Commission
from rb_distributor_billdetail as a
LEFT JOIN rb_goods_orderintroduction as oc on a.CommissionId=oc.Id
LEFT JOIN rb_goods_orderdetail as od on od.Id=a.OrderDetailId
LEFT JOIN rb_goods_order as o on o.OrderId=od.OrderId
where {where} group by oc.OrderId,o.OrderNo order by oc.OrderId desc";