From 18af62e111e0fb7384c417b85c80035dbd2fd037 Mon Sep 17 00:00:00 2001 From: MSuMshk <2039814060@qq.com> Date: Wed, 25 Feb 2026 10:00:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A9=BASKU=E7=BC=96=E7=A0=81=E6=97=B6?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TakeoutSaaS.TenantApi/Services/ProductSkuSaveService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Api/TakeoutSaaS.TenantApi/Services/ProductSkuSaveService.cs b/src/Api/TakeoutSaaS.TenantApi/Services/ProductSkuSaveService.cs index 75fb21c..c7501c9 100644 --- a/src/Api/TakeoutSaaS.TenantApi/Services/ProductSkuSaveService.cs +++ b/src/Api/TakeoutSaaS.TenantApi/Services/ProductSkuSaveService.cs @@ -147,7 +147,9 @@ public sealed class ProductSkuSaveService(TakeoutAppDbContext dbContext) continue; } - var generatedCode = normalizedSkuCode ?? GenerateUniqueSkuCode(productId, currentProductSkuCodes); + var generatedCode = !string.IsNullOrWhiteSpace(normalizedSkuCode) + ? normalizedSkuCode + : GenerateUniqueSkuCode(productId, currentProductSkuCodes); if (!plannedSkuCodes.Add(generatedCode)) { throw new BusinessException(ErrorCodes.BadRequest, $"SKU 编码冲突: {generatedCode}");