-- ============================================
-- 此文件由 Meoo Cloud 自动生成，请勿修改
-- This file is auto-generated by Meoo Cloud, DO NOT MODIFY
-- ============================================

DROP POLICY IF EXISTS company_select_finished_products ON finished_products; CREATE POLICY company_select_finished_products ON finished_products FOR SELECT USING (company_id = get_user_master_company_id() OR EXISTS (SELECT 1 FROM washing_plans wp WHERE wp.id = finished_products.washing_plan_id AND wp.company_id = get_user_master_company_id())); DROP POLICY IF EXISTS company_update_finished_products ON finished_products; CREATE POLICY company_update_finished_products ON finished_products FOR UPDATE USING (company_id = get_user_master_company_id()); DROP POLICY IF EXISTS company_delete_finished_products ON finished_products; CREATE POLICY company_delete_finished_products ON finished_products FOR DELETE USING (company_id = get_user_master_company_id()); DROP POLICY IF EXISTS company_select_finished_inventory ON finished_product_inventory_records; CREATE POLICY company_select_finished_inventory ON finished_product_inventory_records FOR SELECT USING (company_id = get_user_master_company_id() OR EXISTS (SELECT 1 FROM finished_products fp WHERE fp.id = finished_product_inventory_records.finished_product_id AND EXISTS (SELECT 1 FROM washing_plans wp WHERE wp.id = fp.washing_plan_id AND wp.company_id = get_user_master_company_id())));
