Browse Source

查询采购账号列表接口

liangku_skuoptimazation
shanji 1 year ago
parent
commit
07941b3b09
  1. 10
      BBWYB.Server.API/Controllers/VenderController.cs
  2. 11
      BBWYB.Server.Business/Vender/VenderBusiness.cs
  3. 14
      BBWYB.Server.Model/Dto/Request/Vender/QueryPurchaseAccountRequest.cs
  4. 18
      BBWYB.Server.Model/Dto/Request/Vender/ShopSettingRequest.cs

10
BBWYB.Server.API/Controllers/VenderController.cs

@ -29,14 +29,14 @@ namespace BBWYB.Server.API.Controllers
}
/// <summary>
/// 获取店铺下的采购账号
/// 查询采购账号列表
/// </summary>
/// <param name="shopId"></param>
/// <param name="request"></param>
/// <returns></returns>
[HttpGet]
public IList<Purchaseaccount> GetPurchaserListByShopId([FromBody]long shopId)
[HttpPost]
public IList<Purchaseaccount> GetPurchaserListByShopId([FromBody] QueryPurchaseAccountRequest request)
{
return venderBusiness.GetPurchaserListByShopId(shopId);
return venderBusiness.GetPurchaserListByShopId(request);
}

11
BBWYB.Server.Business/Vender/VenderBusiness.cs

@ -81,11 +81,16 @@ namespace BBWYB.Server.Business
return shopSettingRequest.PurchaseAccountId;
}
public IList<Purchaseaccount> GetPurchaserListByShopId(long shopId)
public IList<Purchaseaccount> 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<Shops>().Where(s => s.ShopId == shopIdStr).ToOne();
var plist = fsqlManager.MDSfsql.Select<Purchaseaccount>().Where(pa => pa.ShopId == mdsShop.Id).ToList();
var plist = fsqlManager.MDSfsql.Select<Purchaseaccount>()
.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;

14
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;}
}
}

18
BBWYB.Server.Model/Dto/Request/Vender/ShopSettingRequest.cs

@ -10,17 +10,29 @@
public long PurchaseAccountId { get; set; }
/// <summary>
/// 采购账号AccountName
/// </summary>
public string AccountName { get; set; }
/// <summary>
/// 采购账号AppKey
/// </summary>
public string AppKey { get; set; }
/// <summary>
/// 采购账号AppSecret
/// </summary>
public string AppSecret { get; set; }
/// <summary>
/// 采购账号Token
/// </summary>
public string AppToken { get; set; }
/// <summary>
/// 采购平台
/// </summary>
public Enums.Platform PurchasePlatformId { get; set; }
}
}

Loading…
Cancel
Save