// builder.Append(@$" SELECT a.*,b.TriggerType,b.GrantNum from rb_coupon_selfmotion as b LEFT JOIN {TableName} as a on a.ID=b.DiscountCouponId WHERE a.{nameof(RB_DiscountCoupon_Extend.Status)}=0 and b.`Status`=0 and (a.IndateType=1 or (a.IndateType=2 and a.StartDate<NOW() and a.EndDate>NOW()))");
if(query!=null)
{
if(query.TenantId>0)
{
builder.Append($" AND a.{nameof(RB_DiscountCoupon_Extend.TenantId)}={query.TenantId}");
}
if(query.TenantId>0)
{
builder.Append($" AND a.{nameof(RB_DiscountCoupon_Extend.MallBaseId)}={query.MallBaseId}");
}
if(query.TriggerType>0)
{
builder.Append($" AND b.{nameof(RB_DiscountCoupon_Extend.TriggerType)}={query.TriggerType}");
}
if(query.UserId>0)
{
userWhere+=$"and c.UserId={query.UserId}";
}
}
stringsql=@$"SELECT a.*,b.TriggerType,b.GrantNum from rb_coupon_selfmotion as b LEFT JOIN {TableName} as a on a.ID=b.DiscountCouponId