From 14726a34f9c67429f82da318a763b02b6f80fe2a Mon Sep 17 00:00:00 2001 From: gwbvipvip Date: Wed, 13 Nov 2024 10:28:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8E=A8=E5=95=86=E5=93=81=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E4=BC=98=E5=8C=9620241113?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataBase/Services/GoodsService.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs index a970f94..3ad5943 100644 --- a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs +++ b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs @@ -2494,7 +2494,19 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services var stopInfo = JsonConvert.DeserializeObject>(HttpHelper.HttpGet(url, null, dic, "application/json")); if (stopInfo?.data == null) throw Oops.Oh("店铺不存在!"); - var goodInfoList = exportDto.GoodId != null ? await _db.Queryable().Where(t => t.Id == exportDto.GoodId).ToListAsync() : await _db.Queryable().Where(t => exportDto.GoodsId.Contains(t.Id)).ToListAsync(); + var goodInfoList = new List(); + if (exportDto.GoodsId.Any()) + goodInfoList = await _db.Queryable().Where(t => exportDto.GoodsId.Contains(t.Id)).ToListAsync(); + else + { + if (exportDto.GoodId != null) + goodInfoList = await _db.Queryable().Where(t => t.Id == exportDto.GoodId).ToListAsync(); + else + { + var goodIds = await _db.Queryable().Where(t => t.DeviceId == exportDto.DeviceId).Select(q => q.GoodsId).Distinct().ToListAsync(); + goodInfoList = await _db.Queryable().Where(t => goodIds.Contains(t.Id)).ToListAsync(); + } + } if (goodInfoList.Count == 0) { var templateUrl = "https://bpa.oss-cn-chengdu.aliyuncs.com/hkerp/test/goods//商品模版.xlsx";