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 = []