builder.Append(@$" SELECT a.*,b.CommentNum,c.Major,c.TeacherLogo,c.`Name` as TeacherName FROM {TableName} as a LEFT JOIN (SELECT ArticleId,COUNT(*) as CommentNum from rb_education_articlecomment where `Status`=0 GROUP BY ArticleId )
@@ -85,8 +85,8 @@ LEFT JOIN rb_education_teacher as c on a.TeacherId=c.ID WHERE a.{nameof(RB_Educ
{
StringBuilderbuilder=newStringBuilder();
builder.Append(@$" SELECT a.*,b.CommentNum,c.Major,c.TeacherLogo,c.`Name` as TeacherName FROM {TableName} as a LEFT JOIN (SELECT ArticleId,COUNT(*) as CommentNum from rb_education_articlecomment where `Status`=0 GROUP BY ArticleId )
stringwhere=$" 1=1 and g.{nameof(RB_Goods_Extend.Status)}=0 and g.GoodsClassify=2 and g.{nameof(RB_Goods_Extend.GoodsStatus)}=1 and b.`Status`=0";
if(dmodel.TenantId>0)
{
where+=$@" and g.{nameof(RB_Goods_Extend.TenantId)}={dmodel.TenantId}";
}
if(dmodel.NotTenantId>0)
{
where+=$@" and g.{nameof(RB_Goods_Extend.TenantId)}<>{dmodel.NotTenantId}";
}
if(dmodel.MallBaseId>0)
{
where+=$@" and g.{nameof(RB_Goods_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if(dmodel.Id>0)
{
where+=$@" and g.{nameof(RB_Goods_Extend.Id)}={dmodel.Id}";
}
if(!string.IsNullOrEmpty(dmodel.GoodsIds))
{
where+=$@" and g.{nameof(RB_Goods_Extend.Id)} in({dmodel.GoodsIds})";
}
if(!string.IsNullOrEmpty(dmodel.Name))
{
where+=$@" and g.{nameof(RB_Goods_Extend.Name)} like '%{dmodel.Name}%'";
}
if(dmodel.IsSelectSellOut==1)
{
where+=$@" and g.{nameof(RB_Goods_Extend.InventoryNum)}<=0";
}
if(!string.IsNullOrEmpty(dmodel.CategoryIds))
{
where+=$@" and c.{nameof(RB_Goods_Category.CategoryId)} in({dmodel.CategoryIds})";
}
if(dmodel.IsProcurement>0)
{
where+=$@" and g.{nameof(RB_Goods_Extend.IsProcurement)}={dmodel.IsProcurement}";
}
if(dmodel.IsProxy>0)
{
where+=$@" and g.{nameof(RB_Goods_Extend.IsProxy)}={dmodel.IsProxy}";
}
if(dmodel.SupplierId>0)
{
where+=$@" and g.{nameof(RB_Goods_Extend.SupplierId)}={dmodel.SupplierId}";
}
if(dmodel.TeacherId>0)
{
where+=$@" and b.{nameof(RB_Goods_Extend.TeacherId)}={dmodel.TeacherId}";
}
stringorderBy=" g.Sort desc";
stringsql=$@" SELECT g.*,c.CourseNum from rb_goods as g
LEFT JOIN rb_goods_wk_teacher as b on g.Id=b.GoodsId
LEFT JOIN (SELECT GoodsId,COUNT(*) as CourseNum from rb_goods_wk_course where `Status`=0 GROUP BY GoodsId) as c on c.GoodsId=g.Id where {where} order by {orderBy}";