FROM rb_share_friend AS A LEFT JOIN rb_goods AS B ON A.GoodsId=B.Id
WHERE 1=1 AND A.Status=0
");
if(query!=null)
{
if(query.TenantId>0)
{
builder.Append($" AND {nameof(RB_Share_Friend_Extend.TenantId)}={query.TenantId}");
builder.Append($" AND A.{nameof(RB_Share_Friend_Extend.TenantId)}={query.TenantId}");
}
if(query.TenantId>0)
{
builder.Append($" AND {nameof(RB_Share_Friend_Extend.MallBaseId)}={query.MallBaseId}");
builder.Append($" AND A.{nameof(RB_Share_Friend_Extend.MallBaseId)}={query.MallBaseId}");
}
if(query.CateId>0)
{
builder.AppendFormat(" AND {0}={1} ",nameof(RB_Share_Friend_Extend.CateId),query.CateId);
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_Share_Friend_Extend.CateId),query.CateId);
}
if(!string.IsNullOrWhiteSpace(query.CateIds))
{
builder.AppendFormat(" AND {0} IN({1}) ",nameof(RB_Share_Friend_Extend.CateId),query.CateIds);
builder.AppendFormat(" AND A.{0} IN({1}) ",nameof(RB_Share_Friend_Extend.CateId),query.CateIds);
}
if(!string.IsNullOrWhiteSpace(query.KeyWords))
{
builder.AppendFormat(" AND {0} LIKE '%{1}%' ",nameof(RB_Share_Friend_Extend.MaterialInfo),query.KeyWords);
builder.AppendFormat(" AND A.{0} LIKE '%{1}%' ",nameof(RB_Share_Friend_Extend.MaterialInfo),query.KeyWords);
}
if(!string.IsNullOrWhiteSpace(query.QStartDate))
{
builder.AppendFormat(" AND {0}>='{1}' ",nameof(RB_Share_Friend_Extend.CreateDate),Convert.ToDateTime(query.QStartDate).ToString("yyyy-MM-dd"));
builder.AppendFormat(" AND A.{0}>='{1}' ",nameof(RB_Share_Friend_Extend.CreateDate),Convert.ToDateTime(query.QStartDate).ToString("yyyy-MM-dd"));
}
if(!string.IsNullOrWhiteSpace(query.QEndDate))
{
builder.AppendFormat(" AND {0}<='{1} 23:59:59' ",nameof(RB_Share_Friend_Extend.CreateDate),Convert.ToDateTime(query.QEndDate).ToString("yyyy-MM-dd"));
builder.AppendFormat(" AND A.{0}<='{1} 23:59:59' ",nameof(RB_Share_Friend_Extend.CreateDate),Convert.ToDateTime(query.QEndDate).ToString("yyyy-MM-dd"));