From e5c49c51771af5244a1b2792d91a1701e81be5d1 Mon Sep 17 00:00:00 2001 From: yueli Date: Fri, 4 Sep 2026 09:42:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=A5=E5=BA=93=20search-base=20?= =?UTF-8?q?=E7=89=A9=E6=96=99=E9=80=89=E6=8B=A9=E5=8A=A0=E5=85=AC=E5=8F=B8?= =?UTF-8?q?=E9=9A=94=E7=A6=BB=EF=BC=8C=E6=81=A2=E5=A4=8D=E5=8D=8A=E6=88=90?= =?UTF-8?q?=E5=93=81=E6=89=B9=E5=8F=B7=E6=8C=89=E6=9C=AC=E5=85=AC=E5=8F=B8?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E8=87=AA=E5=8A=A8=E9=80=92=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inventory-backend/app/services/inbound/buy_service.py | 5 +++++ inventory-backend/app/services/inbound/product_service.py | 5 +++++ inventory-backend/app/services/inbound/semi_service.py | 5 +++++ inventory-backend/app/services/inbound/service_service.py | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/inventory-backend/app/services/inbound/buy_service.py b/inventory-backend/app/services/inbound/buy_service.py index dcb6a08..1a12ebb 100644 --- a/inventory-backend/app/services/inbound/buy_service.py +++ b/inventory-backend/app/services/inbound/buy_service.py @@ -59,6 +59,11 @@ class BuyInboundService: ) )) + # ★ 行级公司隔离:只能搜索/选择本公司的物料(超管/跨域不受限) + from app.utils.decorators import get_current_company_filter + company_limit = get_current_company_filter() + if company_limit is not None: + query = query.filter(MaterialBase.company_name == company_limit) query = query.order_by(MaterialBase.id.desc()) pagination = query.paginate(page=page, per_page=limit, error_out=False) diff --git a/inventory-backend/app/services/inbound/product_service.py b/inventory-backend/app/services/inbound/product_service.py index 15a76e3..036582a 100644 --- a/inventory-backend/app/services/inbound/product_service.py +++ b/inventory-backend/app/services/inbound/product_service.py @@ -43,6 +43,11 @@ class ProductInboundService: MaterialBase.company_name.ilike(kw) ) ) + # ★ 行级公司隔离:只能搜索/选择本公司的物料(超管/跨域不受限) + from app.utils.decorators import get_current_company_filter + company_limit = get_current_company_filter() + if company_limit is not None: + query = query.filter(MaterialBase.company_name == company_limit) query = query.order_by(MaterialBase.id.desc()) pagination = query.paginate(page=page, per_page=limit, error_out=False) results = [] diff --git a/inventory-backend/app/services/inbound/semi_service.py b/inventory-backend/app/services/inbound/semi_service.py index 3cb3cc6..1814ee8 100644 --- a/inventory-backend/app/services/inbound/semi_service.py +++ b/inventory-backend/app/services/inbound/semi_service.py @@ -53,6 +53,11 @@ class SemiInboundService: MaterialBase.company_name.ilike(kw) ) ) + # ★ 行级公司隔离:只能搜索/选择本公司的物料(超管/跨域不受限) + from app.utils.decorators import get_current_company_filter + company_limit = get_current_company_filter() + if company_limit is not None: + query = query.filter(MaterialBase.company_name == company_limit) query = query.order_by(MaterialBase.id.desc()) pagination = query.paginate(page=page, per_page=limit, error_out=False) results = [] diff --git a/inventory-backend/app/services/inbound/service_service.py b/inventory-backend/app/services/inbound/service_service.py index 980e101..2ca9035 100644 --- a/inventory-backend/app/services/inbound/service_service.py +++ b/inventory-backend/app/services/inbound/service_service.py @@ -55,6 +55,11 @@ class ServiceService: MaterialBase.spec_model.ilike(f'%{keyword}%'), ) ) + # ★ 行级公司隔离:只能搜索/选择本公司的物料(超管/跨域不受限) + from app.utils.decorators import get_current_company_filter + company_limit = get_current_company_filter() + if company_limit is not None: + query = query.filter(MaterialBase.company_name == company_limit) query = query.order_by(MaterialBase.id.desc()).limit(20) results = []