stringwhere=$" 1=1 and g.{nameof(RB_Goods_Extend.Status)}=0 and gcg.Status=0 and c.Status=0 and d.Status=0 and f.Status=0 and b.IsReserve=1 and a.AdvanceDay<=datediff(b.Date,NOW()) and g.GoodsClassify=1 and g.{nameof(RB_Goods_Extend.GoodsStatus)}=1";
stringwhere=$" 1=1 and g.{nameof(RB_Goods_Extend.Status)}=0 and gcg.Status=0 and c.Status=0 and d.Status=0 and f.Status=0 and b.IsReserve=1 and g.AdvanceDay<=datediff(b.Date,NOW()) and g.GoodsClassify=1 and g.{nameof(RB_Goods_Extend.GoodsStatus)}=1";
if(dmodel.TenantId>0)
if(dmodel.TenantId>0)
{
{
where+=$@" and g.{nameof(RB_Goods_Extend.TenantId)}={dmodel.TenantId}";
where+=$@" and g.{nameof(RB_Goods_Extend.TenantId)}={dmodel.TenantId}";
...
@@ -846,10 +846,10 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
...
@@ -846,10 +846,10 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
{
{
where+=$@" and g.{nameof(RB_Goods_Extend.Id)}={dmodel.Id}";
where+=$@" and g.{nameof(RB_Goods_Extend.Id)}={dmodel.Id}";
@@ -877,7 +877,7 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
...
@@ -877,7 +877,7 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
{
{
where+=$@" and (g.{nameof(RB_Goods_Extend.RideNum)}-b.ReserveNum)>={dmodel.RideNum}";
where+=$@" and (g.{nameof(RB_Goods_Extend.RideNum)}-b.ReserveNum)>={dmodel.RideNum}";
}
}
if(dmodel.CarClass.HasValue&&dmodel.CarClass>0)
if(dmodel.CarClass.HasValue&&dmodel.CarClass>0)
{
{
where+=$@" and e.CarClass={dmodel.CarClass}";
where+=$@" and e.CarClass={dmodel.CarClass}";
}
}
...
@@ -903,12 +903,13 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
...
@@ -903,12 +903,13 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
}
}
if(!string.IsNullOrEmpty(dmodel.StartTime))
if(!string.IsNullOrEmpty(dmodel.StartTime))
{
{
where+=$@" and b.Date >='{dmodel.StartTime}'";
where+=$" and DATE_FORMAT(b.Date,'%Y-%m-%d' )=DATE_FORMAT('{dmodel.StartTime}','%Y-%m-%d' ) ";
}
}
//if (!string.IsNullOrEmpty(dmodel.EndTime))
else
//{
{
// where += $@" and b.Date <='{dmodel.EndTime + " 23:59:59"}'";
where+=$" and DATE_FORMAT(b.Date,'%Y-%m-%d' )=DATE_FORMAT('{System.DateTime.Now.AddDays(1)}','%Y-%m-%d' ) ";
//}
}
if(dmodel.IsProcurement>0)
if(dmodel.IsProcurement>0)
{
{
where+=$@" and g.{nameof(RB_Goods_Extend.IsProcurement)}={dmodel.IsProcurement}";
where+=$@" and g.{nameof(RB_Goods_Extend.IsProcurement)}={dmodel.IsProcurement}";
...
@@ -932,7 +933,7 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
...
@@ -932,7 +933,7 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
//价格降序
//价格降序
orderBy=" g.Sort desc";
orderBy=" g.Sort desc";
}
}
elseif(dmodel.OrderBy==3)
elseif(dmodel.OrderBy==3)
{
{
//价格升序
//价格升序
orderBy=" g.SellingPrice asc";
orderBy=" g.SellingPrice asc";
...
@@ -952,7 +953,7 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
...
@@ -952,7 +953,7 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
//评分降序
//评分降序
orderBy=" e.Score desc";
orderBy=" e.Score desc";
}
}
elseif(dmodel.OrderBy==7)
elseif(dmodel.OrderBy==7)
{
{
//最新升序
//最新升序
orderBy=" g.CreateDate asc";
orderBy=" g.CreateDate asc";
...
@@ -962,14 +963,14 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
...
@@ -962,14 +963,14 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
//最新降序
//最新降序
orderBy=" g.CreateDate desc";
orderBy=" g.CreateDate desc";
}
}
stringsql=$@"SELECT g.*,c.SiteName,e.`Name` as CarName,e.CarType as GuideCarType,f.ColorName as CarColorName,gcg.Name as GuideName,gcg.WorkYears as GuideWorkYears,gcg.Score as GuideScore,gcg.Telephone as GuideTelephone from rb_goods as g
stringsql=$@"SELECT g.*,(g.RideNum-b.ReserveNum) as SurplusNum,c.SiteName,e.`Name` as CarName,e.CarType as GuideCarType,f.ColorName as CarColorName,gcg.Name as GuideName,gcg.GuidePhoto,gcg.WorkYears as GuideWorkYears,gcg.Score as GuideScore,gcg.Telephone as GuideTelephone from rb_goods as g
LEFT JOIN rb_goods_targetdate as b on g.Id=b.GoodsId
LEFT JOIN rb_goods_targetdate as b on g.Id=b.GoodsId
LEFT JOIN rb_guidecar_site as c on g.SiteId=c.ID
LEFT JOIN rb_guidecar_site as c on g.SiteId=c.ID
LEFT JOIN rb_guidecar_car as e on e.ID=g.CarId
LEFT JOIN rb_guidecar_car as e on e.ID=g.CarId
LEFT JOIN rb_guidecar_siteregion as d on d.SiteId=g.SiteId
LEFT JOIN rb_guidecar_siteregion as d on d.SiteId=g.SiteId
LEFT JOIN rb_guidecar_carcolor as f on f.ID=g.CarColorId
LEFT JOIN rb_guidecar_carcolor as f on f.ID=g.CarColorId
LEFT JOIN rb_guidecar_guide as gcg on gcg.ID=g.GuideId
LEFT JOIN rb_guidecar_guide as gcg on gcg.ID=g.GuideId
where {where} GROUP BY g.Id order by {orderBy}";
where {where} GROUP BY g.Id asc order by {orderBy} ,b.date asc";