From 7e90112cbf75fb78a79d59b9b514b01098e0f6ce Mon Sep 17 00:00:00 2001 From: zzh <1368735060@qq.com> Date: Tue, 14 Jul 2026 11:12:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BB=93=E5=82=A8=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E4=B8=8A=E4=B8=8B=E6=96=87=E8=A7=A3=E6=9E=90=EF=BC=88?= =?UTF-8?q?=E6=9C=AA=E4=BC=A0=E5=AE=A2=E6=88=B7=E6=9F=A5=E5=85=A8=E9=83=A8?= =?UTF-8?q?=EF=BC=89=EF=BC=8C=E5=B9=B6=E8=A1=A5=E5=85=85=E5=BA=93=E4=BD=8D?= =?UTF-8?q?=E4=B8=8E=E7=A1=AE=E8=AE=A4=E6=94=B6=E8=B4=A7=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=A7=8D=E5=AD=90=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- sql/seed_warehouse_module_permissions.sql | 7 +++++-- .../Shared/WarehouseCustomerHelper.cs | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/sql/seed_warehouse_module_permissions.sql b/sql/seed_warehouse_module_permissions.sql index b50ce94..b50bbae 100644 --- a/sql/seed_warehouse_module_permissions.sql +++ b/sql/seed_warehouse_module_permissions.sql @@ -1,5 +1,5 @@ --- 仓储模块 + 店铺授权/订单 RBAC 权限(幂等) --- RBAC 库执行;执行后用户需重新登录或刷新权限缓存 +-- ???? + ????/?? RBAC ?????? +-- RBAC ????????????????????? SET @ADMIN_USER_ID = ( SELECT `Id` FROM `user` @@ -20,11 +20,14 @@ CROSS JOIN ( SELECT 'Warehouse.Sku.Delete' UNION ALL SELECT 'Warehouse.Inventory.Query' UNION ALL SELECT 'Warehouse.Inventory.Relocate' UNION ALL + SELECT 'Warehouse.BinLocation.Query' UNION ALL + SELECT 'Warehouse.BinLocation.Save' UNION ALL SELECT 'Warehouse.Parcel.Query' UNION ALL SELECT 'Warehouse.Parcel.Save' UNION ALL SELECT 'Warehouse.Parcel.Delete' UNION ALL SELECT 'Warehouse.InboundNotice.Query' UNION ALL SELECT 'Warehouse.InboundNotice.Save' UNION ALL + SELECT 'Warehouse.InboundNotice.ConfirmReceive' UNION ALL SELECT 'Warehouse.InboundNotice.Delete' UNION ALL SELECT 'Order.PlatformStore.Query' UNION ALL SELECT 'Order.PlatformStore.Save' UNION ALL diff --git a/src/Oms.Application/Shared/WarehouseCustomerHelper.cs b/src/Oms.Application/Shared/WarehouseCustomerHelper.cs index ae2c8f2..5c67aff 100644 --- a/src/Oms.Application/Shared/WarehouseCustomerHelper.cs +++ b/src/Oms.Application/Shared/WarehouseCustomerHelper.cs @@ -10,16 +10,22 @@ namespace Oms.Application.Shared; public static class WarehouseCustomerHelper { /// - /// 列表/汇总查询用的客户 ID:客户登录强制为自身;管理员未传 customerId 时返回 null(查询全部)。 + /// 列表/汇总查询用的客户 ID:客户登录强制为自身;管理员未传或传入 ≤0 时返回 null(查询全部)。 /// - public static Task ResolveListCustomerIdAsync( + public static async Task ResolveListCustomerIdAsync( ICustomerRepository customerRepository, ICurrentUser currentUser, - int? requestedCustomerId = null) => - OmsSessionHelper.ResolveListCustomerIdAsync(customerRepository, currentUser, requestedCustomerId); + int? requestedCustomerId = null) + { + var normalizedRequest = requestedCustomerId is > 0 ? requestedCustomerId : null; + return await OmsSessionHelper.ResolveListCustomerIdAsync( + customerRepository, + currentUser, + normalizedRequest); + } /// - /// 写入/删除等必须明确客户归属的操作:客户登录强制为自身;管理员须传 customerId。 + /// 写入/删除等必须明确客户归属的操作:客户登录强制为自身;管理员须传有效 customerId(>0)。 /// public static async Task ResolveRequiredCustomerIdAsync( ICustomerRepository customerRepository, @@ -27,7 +33,7 @@ public static class WarehouseCustomerHelper int? requestedCustomerId = null) { var customerId = await ResolveListCustomerIdAsync(customerRepository, currentUser, requestedCustomerId); - if (!customerId.HasValue) + if (!customerId.HasValue || customerId.Value <= 0) { throw new BusinessException("客户ID不能为空"); }