From 07941b3b094f31a047e46d9d22876dff78c00991 Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Wed, 10 Jan 2024 16:43:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=87=87=E8=B4=AD=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/VenderController.cs | 10 +++++----- BBWYB.Server.Business/Vender/VenderBusiness.cs | 11 ++++++++--- .../Vender/QueryPurchaseAccountRequest.cs | 14 ++++++++++++++ .../Dto/Request/Vender/ShopSettingRequest.cs | 18 +++++++++++++++--- 4 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 BBWYB.Server.Model/Dto/Request/Vender/QueryPurchaseAccountRequest.cs diff --git a/BBWYB.Server.API/Controllers/VenderController.cs b/BBWYB.Server.API/Controllers/VenderController.cs index d2d296c..df3a8e3 100644 --- a/BBWYB.Server.API/Controllers/VenderController.cs +++ b/BBWYB.Server.API/Controllers/VenderController.cs @@ -29,14 +29,14 @@ namespace BBWYB.Server.API.Controllers } /// - /// 获取店铺下的采购账号 + /// 查询采购账号列表 /// - /// + /// /// - [HttpGet] - public IList GetPurchaserListByShopId([FromBody]long shopId) + [HttpPost] + public IList GetPurchaserListByShopId([FromBody] QueryPurchaseAccountRequest request) { - return venderBusiness.GetPurchaserListByShopId(shopId); + return venderBusiness.GetPurchaserListByShopId(request); } diff --git a/BBWYB.Server.Business/Vender/VenderBusiness.cs b/BBWYB.Server.Business/Vender/VenderBusiness.cs index f8b5822..13c71d3 100644 --- a/BBWYB.Server.Business/Vender/VenderBusiness.cs +++ b/BBWYB.Server.Business/Vender/VenderBusiness.cs @@ -81,11 +81,16 @@ namespace BBWYB.Server.Business return shopSettingRequest.PurchaseAccountId; } - public IList GetPurchaserListByShopId(long shopId) + public IList GetPurchaserListByShopId(QueryPurchaseAccountRequest request) { - var shopIdStr = shopId.ToString(); + var purchasePlatofrmId = request.PurchasePlatofrmId != null ? ((int)request.PurchasePlatofrmId).ToString() : string.Empty; + var shopIdStr = request.ShopId.ToString(); var mdsShop = fsqlManager.MDSfsql.Select().Where(s => s.ShopId == shopIdStr).ToOne(); - var plist = fsqlManager.MDSfsql.Select().Where(pa => pa.ShopId == mdsShop.Id).ToList(); + var plist = fsqlManager.MDSfsql.Select() + .Where(pa => pa.ShopId == mdsShop.Id) + .WhereIf(!string.IsNullOrEmpty(purchasePlatofrmId), pa => pa.PurchasePlatformId == purchasePlatofrmId) + .WhereIf(!string.IsNullOrEmpty(request.AccountName), pa => pa.AccountName == request.AccountName) + .ToList(); foreach (var pa in plist) pa.ShopId = shopIdStr; return plist; diff --git a/BBWYB.Server.Model/Dto/Request/Vender/QueryPurchaseAccountRequest.cs b/BBWYB.Server.Model/Dto/Request/Vender/QueryPurchaseAccountRequest.cs new file mode 100644 index 0000000..72fb4c6 --- /dev/null +++ b/BBWYB.Server.Model/Dto/Request/Vender/QueryPurchaseAccountRequest.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; + +namespace BBWYB.Server.Model.Dto +{ + public class QueryPurchaseAccountRequest + { + [Required] + public long ShopId { get; set; } + + public Enums.Platform? PurchasePlatofrmId { get; set; } + + public string AccountName { get; set;} + } +} diff --git a/BBWYB.Server.Model/Dto/Request/Vender/ShopSettingRequest.cs b/BBWYB.Server.Model/Dto/Request/Vender/ShopSettingRequest.cs index 96bf413..71a6f1e 100644 --- a/BBWYB.Server.Model/Dto/Request/Vender/ShopSettingRequest.cs +++ b/BBWYB.Server.Model/Dto/Request/Vender/ShopSettingRequest.cs @@ -10,17 +10,29 @@ public long PurchaseAccountId { get; set; } + /// + /// 采购账号AccountName + /// public string AccountName { get; set; } - + /// + /// 采购账号AppKey + /// public string AppKey { get; set; } - + /// + /// 采购账号AppSecret + /// public string AppSecret { get; set; } - + /// + /// 采购账号Token + /// public string AppToken { get; set; } + /// + /// 采购平台 + /// public Enums.Platform PurchasePlatformId { get; set; } } }