Commit 6ea00c15 authored by liudong1993's avatar liudong1993

1

parent 6df8e2a8
......@@ -22,29 +22,31 @@ namespace Mall.Repository.Product
/// <returns></returns>
public List<RB_Goods_OrderCommission_Extend> GetList(RB_Goods_OrderCommission_Extend dmodel)
{
string where = $" 1=1 ";
string where = $" 1=1 and oa.ReOrderId is null";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.TenantId)}={dmodel.TenantId}";
where += $@" and oc.{nameof(RB_Goods_OrderCommission.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.MallBaseId)}={dmodel.MallBaseId}";
where += $@" and oc.{nameof(RB_Goods_OrderCommission.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.OrderId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.OrderId)}={dmodel.OrderId}";
where += $@" and oc.{nameof(RB_Goods_OrderCommission.OrderId)}={dmodel.OrderId}";
}
if (dmodel.UserId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.UserId)}={dmodel.UserId}";
where += $@" and oc.{nameof(RB_Goods_OrderCommission.UserId)}={dmodel.UserId}";
}
if (!string.IsNullOrEmpty(dmodel.OrderIds))
{
where += $@" and {nameof(RB_Goods_OrderCommission.OrderId)} in({dmodel.OrderIds})";
where += $@" and oc.{nameof(RB_Goods_OrderCommission.OrderId)} in({dmodel.OrderIds})";
}
string sql = $@"SELECT * FROM RB_Goods_OrderCommission where {where} order by Id asc";
string sql = $@"SELECT oc.* FROM RB_Goods_OrderCommission oc
left join rb_goods_orderaftersale oa on oc.OrderDetailId= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (2,3,4,5)
where {where} order by oc.Id asc";
return Get<RB_Goods_OrderCommission_Extend>(sql).ToList();
}
......@@ -55,29 +57,31 @@ namespace Mall.Repository.Product
/// <returns></returns>
public List<RB_Goods_OrderCommission_Extend> GetListGroupByUser(RB_Goods_OrderCommission_Extend dmodel)
{
string where = $" 1=1 ";
string where = $" 1=1 and oa.ReOrderId is null";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.TenantId)}={dmodel.TenantId}";
where += $@" and oc.{nameof(RB_Goods_OrderCommission.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.MallBaseId)}={dmodel.MallBaseId}";
where += $@" and oc.{nameof(RB_Goods_OrderCommission.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.OrderId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.OrderId)}={dmodel.OrderId}";
where += $@" and oc.{nameof(RB_Goods_OrderCommission.OrderId)}={dmodel.OrderId}";
}
if (dmodel.UserId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.UserId)}={dmodel.UserId}";
where += $@" and oc.{nameof(RB_Goods_OrderCommission.UserId)}={dmodel.UserId}";
}
if (!string.IsNullOrEmpty(dmodel.OrderIds))
{
where += $@" and {nameof(RB_Goods_OrderCommission.OrderId)} in({dmodel.OrderIds})";
where += $@" and oc.{nameof(RB_Goods_OrderCommission.OrderId)} in({dmodel.OrderIds})";
}
string sql = $@"SELECT OrderId,UserId,Grade,Type,SUM(Commission) as Commission FROM RB_Goods_OrderCommission where {where} group by OrderId,UserId,Grade,Type order by Grade asc";
string sql = $@"SELECT oc.OrderId,oc.UserId,oc.Grade,oc.Type,SUM(oc.Commission) as Commission FROM RB_Goods_OrderCommission oc
left join rb_goods_orderaftersale oa on oc.OrderDetailId= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (2,3,4,5)
where {where} group by oc.OrderId,oc.UserId,oc.Grade,oc.Type order by oc.Grade asc";
return Get<RB_Goods_OrderCommission_Extend>(sql).ToList();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment