|
@ -201,16 +201,31 @@ namespace SiNan.Business |
|
|
if (request.PageSize > 5) |
|
|
if (request.PageSize > 5) |
|
|
request.PageSize = 5; |
|
|
request.PageSize = 5; |
|
|
|
|
|
|
|
|
ISelect<ProductSku>? skuChildSelect = string.IsNullOrEmpty(request.Sku) ? |
|
|
//ISelect<ProductSku>? skuChildSelect = string.IsNullOrEmpty(request.Sku) ?
|
|
|
null : |
|
|
// null :
|
|
|
fsql.Select<ProductSku>().As("ps").Where(ps => ps.ShopId == request.ShopId && ps.Id == request.Sku); |
|
|
// fsql.Select<ProductSku>().As("ps").Where(ps => ps.ShopId == request.ShopId && ps.Id == request.Sku);
|
|
|
|
|
|
//var productList = fsql.Select<Product>().Where(p => p.ShopId == request.ShopId)
|
|
|
|
|
|
// .WhereIf(!string.IsNullOrEmpty(request.Spu), p => p.Id == request.Spu)
|
|
|
|
|
|
// .WhereIf(skuChildSelect != null, p => skuChildSelect.Where(ps => ps.ProductId == p.Id).Any())
|
|
|
|
|
|
// .OrderByDescending(p => p.CreateTime)
|
|
|
|
|
|
// .Page(request.PageIndex, request.PageSize)
|
|
|
|
|
|
// .Count(out var productCount)
|
|
|
|
|
|
// .ToList<ProductResponse>();
|
|
|
|
|
|
|
|
|
var productList = fsql.Select<Product>().Where(p => p.ShopId == request.ShopId) |
|
|
var productList = fsql.Select<Product>().Where(p => p.ShopId == request.ShopId) |
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(request.SpuTitle), p => p.Title.Contains(request.SpuTitle)) |
|
|
.WhereIf(!string.IsNullOrEmpty(request.Spu), p => p.Id == request.Spu) |
|
|
.WhereIf(!string.IsNullOrEmpty(request.Spu), p => p.Id == request.Spu) |
|
|
.WhereIf(skuChildSelect != null, p => skuChildSelect.Where(ps => ps.ProductId == p.Id).Any()) |
|
|
.Where(p => fsql.Select<ProductSku, JDPopularizeAdSku>() |
|
|
|
|
|
.InnerJoin((ps, jas) => ps.Id == jas.Sku) |
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(request.Sku), (ps, jas) => ps.Id == request.Sku) |
|
|
|
|
|
.Where((ps, jas) => jas.ShopId == request.ShopId && ps.ProductId == p.Id) |
|
|
|
|
|
.Any()) |
|
|
.OrderByDescending(p => p.CreateTime) |
|
|
.OrderByDescending(p => p.CreateTime) |
|
|
.Page(request.PageIndex, request.PageSize) |
|
|
.Page(request.PageIndex, request.PageSize) |
|
|
.Count(out var productCount) |
|
|
.Count(out var productCount) |
|
|
.ToList<ProductResponse>(); |
|
|
.ToList<ProductResponse>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (productList.Count == 0) |
|
|
if (productList.Count == 0) |
|
|
return new ListResponse<ProductGOIResponse>() { ItemList = new List<ProductGOIResponse>() }; |
|
|
return new ListResponse<ProductGOIResponse>() { ItemList = new List<ProductGOIResponse>() }; |
|
|
|
|
|
|
|
|