PayrollManagementSystem/db/queries/tplus/progress/counts.sql

15 lines
865 B
MySQL
Raw Normal View History

-- 与九类白名单读取范围对应的原始行总量,仅用于进度统计,不写入源库。
SELECT entity_type, total_records
FROM (
SELECT 'personnel' AS entity_type, COUNT_BIG(*) AS total_records FROM dbo.AA_Person
UNION ALL SELECT 'products', COUNT_BIG(*) FROM dbo.AA_Inventory
UNION ALL SELECT 'customers', COUNT_BIG(*) FROM dbo.AA_Partner
UNION ALL SELECT 'businesses', COUNT_BIG(*) FROM dbo.SA_SaleOrder
UNION ALL SELECT 'business_items', COUNT_BIG(*) FROM dbo.SA_SaleOrder_b
UNION ALL SELECT 'shipments', COUNT_BIG(*) FROM dbo.SA_SaleDelivery
UNION ALL SELECT 'shipment_items', COUNT_BIG(*) FROM dbo.SA_SaleDelivery_b
UNION ALL SELECT 'receipts', COUNT_BIG(*) FROM dbo.ARAP_ReceivePayment
UNION ALL SELECT 'receipt_items', COUNT_BIG(*) FROM dbo.ARAP_ReceivePayment_b
) AS counts
WHERE entity_type IN :entities;