Commit c1bda959 authored by 吴春's avatar 吴春

提交

parent bc3030eb
...@@ -15,9 +15,46 @@ namespace Mall.Repository.Product ...@@ -15,9 +15,46 @@ namespace Mall.Repository.Product
public class RB_SmallShops_CommissionRepository : BaseRepository<RB_SmallShops_Commission> public class RB_SmallShops_CommissionRepository : BaseRepository<RB_SmallShops_Commission>
{ {
/// <summary>
/// 获取用户返佣
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_SmallShops_Commission_Extend> GetListGroupByUser(RB_SmallShops_Commission_Extend dmodel)
{
string where = $" 1=1 and oa.ReOrderId is null";
if (dmodel.TenantId > 0)
{
where += $@" and oc.{nameof(RB_SmallShops_Commission.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and oc.{nameof(RB_SmallShops_Commission.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.OrderId > 0)
{
where += $@" and oc.{nameof(RB_SmallShops_Commission.OrderId)}={dmodel.OrderId}";
}
if (dmodel.UserId > 0)
{
where += $@" and oc.{nameof(RB_SmallShops_Commission.UserId)}={dmodel.UserId}";
}
if (dmodel.OrderDetailId > 0)
{
where += $@" and oc.{nameof(RB_SmallShops_Commission.OrderDetailId)}={dmodel.OrderDetailId}";
}
if (!string.IsNullOrEmpty(dmodel.OrderIds))
{
where += $@" and oc.{nameof(RB_SmallShops_Commission.OrderId)} in({dmodel.OrderIds})";
}
string sql = $@"SELECT oc.OrderId,oc.UserId,oc.Type,oc.CommissionState,SUM(oc.Commission) as Commission FROM rb_smallshops_commission 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.Type ";
return Get<RB_SmallShops_Commission_Extend>(sql).ToList();
}
/// <summary> /// <summary>
/// 获取用户返佣 /// 获取用户返佣
......
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