|
|
@ -14,9 +14,48 @@ namespace BBWYB.Server.Business |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public ListResponse<string> QueryPurchaserNameList(string keywords) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(keywords)) |
|
|
|
throw new BusinessException("关键字不能为空"); |
|
|
|
var list = fsql.Select<Purchaser>().Where(p => p.Name.Contains(keywords)).Distinct().ToList(x => x.Name); |
|
|
|
return new ListResponse<string> { Items = list, TotalCount = list.Count() }; |
|
|
|
} |
|
|
|
|
|
|
|
public ListResponse<string> QueryPurchaserLocationList(string keywords) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(keywords)) |
|
|
|
throw new BusinessException("关键字不能为空"); |
|
|
|
var list = fsql.Select<Purchaser>().Where(p => p.Location.Contains(keywords)).Distinct().ToList(x => x.Location); |
|
|
|
return new ListResponse<string> { Items = list, TotalCount = list.Count() }; |
|
|
|
} |
|
|
|
|
|
|
|
public ListResponse<PurchaserResponse> QueryPurchaserList(QueryPurchaserRequest request) |
|
|
|
{ |
|
|
|
return new ListResponse<PurchaserResponse>(); |
|
|
|
if (request.PageSize > 20) |
|
|
|
request.PageSize = 20; |
|
|
|
var purchaserList = fsql.Select<Purchaser>() |
|
|
|
.WhereIf(!string.IsNullOrEmpty(request.Spu), p => fsql.Select<PurchaseSchemeProduct>() |
|
|
|
.Where(psp1 => psp1.PurchaserId == p.Id && |
|
|
|
psp1.ProductId == request.Spu) |
|
|
|
.Any()) |
|
|
|
.WhereIf(!string.IsNullOrEmpty(request.Sku), p => fsql.Select<PurchaseSchemeProduct>() |
|
|
|
.Where(psp2 => psp2.PurchaserId == p.Id && |
|
|
|
psp2.SkuId == request.Sku) |
|
|
|
.Any()) |
|
|
|
.WhereIf(request.PurchaserNameList != null && request.PurchaserNameList.Count() > 0, p => request.PurchaserNameList.Contains(p.Name)) |
|
|
|
.WhereIf(request.CategoryIdList != null && request.CategoryIdList.Count() > 0, p => fsql.Select<Purchaser_ExtendedInfo_Relation>() |
|
|
|
.Where(per => per.PurchaserId == p.Id && |
|
|
|
request.CategoryIdList.Contains(per.ExtendedInfoId.Value)).Any()) |
|
|
|
.WhereIf(request.LocationList != null && request.LocationList.Count() > 0, p => request.LocationList.Contains(p.Location)) |
|
|
|
.Page(request.PageIndex, request.PageSize) |
|
|
|
.Count(out var count) |
|
|
|
.ToList<PurchaserResponse>(); |
|
|
|
return new ListResponse<PurchaserResponse>() |
|
|
|
{ |
|
|
|
Items = purchaserList, |
|
|
|
TotalCount = count |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
public ListResponse<PurchaserExtendedInfoResponse> QueryPurchaserCategoryList(QueryPurchaserExtendedRequest request) |
|
|
|