| GroupAggregate (cost=163308.48..320203.55 rows=719 width=96) |
| Group Key: (CASE WHEN ((l.ticket_type = 20012) AND ((alternatives: SubPlan 1 or hashed SubPlan 2) OR (alternatives: SubPlan 3 or hashed SubPlan 4))) THEN '200101'::text WHEN ((l.ticket_type = 20013) AND ((alternatives: SubPlan 5 or hashed SubPlan 6) OR (alternatives: SubPlan 7 or hashed SubPlan 8))) THEN '200105'::text WHEN ((l.ticket_type = 20013) AND (alternatives: SubPlan 9 or hashed SubPlan 10)) THEN '200103'::text WHEN (l.ticket_type = 20013) THEN '200101'::text WHEN ((l.ticket_type = 20015) AND (alternatives: SubPlan 11 or hashed SubPlan 12)) THEN '200102'::text WHEN (l.ticket_type = 20015) THEN '200103'::text WHEN ((l.ticket_type = 20012) AND ((alternatives: SubPlan 13 or hashed SubPlan 14) OR (alternatives: SubPlan 15 or hashed SubPlan 16))) THEN '200105'::text WHEN (l.ticket_type = 20019) THEN '200105'::text WHEN (l.ticket_type = ANY ('{20023,20024,20025,20027}'::integer[])) THEN '200106'::text WHEN (l.ticket_type = 20026) THEN '200107'::text WHEN (l.ticket_type = ANY ('{20012,20018,20020,20021}'::integer[])) THEN '200108'::text WHEN (l.in_amount IS NOT NULL) THEN '200103'::text ELSE '200108'::text END) |
| -> Sort (cost=163308.48..163310.35 rows=748 width=43) |
| Sort Key: (CASE WHEN ((l.ticket_type = 20012) AND ((alternatives: SubPlan 1 or hashed SubPlan 2) OR (alternatives: SubPlan 3 or hashed SubPlan 4))) THEN '200101'::text WHEN ((l.ticket_type = 20013) AND ((alternatives: SubPlan 5 or hashed SubPlan 6) OR (alternatives: SubPlan 7 or hashed SubPlan 8))) THEN '200105'::text WHEN ((l.ticket_type = 20013) AND (alternatives: SubPlan 9 or hashed SubPlan 10)) THEN '200103'::text WHEN (l.ticket_type = 20013) THEN '200101'::text WHEN ((l.ticket_type = 20015) AND (alternatives: SubPlan 11 or hashed SubPlan 12)) THEN '200102'::text WHEN (l.ticket_type = 20015) THEN '200103'::text WHEN ((l.ticket_type = 20012) AND ((alternatives: SubPlan 13 or hashed SubPlan 14) OR (alternatives: SubPlan 15 or hashed SubPlan 16))) THEN '200105'::text WHEN (l.ticket_type = 20019) THEN '200105'::text WHEN (l.ticket_type = ANY ('{20023,20024,20025,20027}'::integer[])) THEN '200106'::text WHEN (l.ticket_type = 20026) THEN '200107'::text WHEN (l.ticket_type = ANY ('{20012,20018,20020,20021}'::integer[])) THEN '200108'::text WHEN (l.in_amount IS NOT NULL) THEN '200103'::text ELSE '200108'::text END) |
| -> Seq Scan on tbl_erp_bank_amount_change_logs l (cost=0.00..163272.77 rows=748 width=43) |
| Filter: (((in_amount IS NOT NULL) OR (out_amount IS NOT NULL)) AND (ticket_type <> 20017) AND (settle_at >= '2025-08-08 00:00:00+08'::timestamp with time zone) AND (settle_at <= '2025-11-30 23:59:59+08'::timestamp with time zone)) |
| SubPlan 1 |
| -> Seq Scan on tbl_erp_payment_ticket_settles pts (cost=0.00..47.26 rows=1 width=0) |
| Filter: ((sales_contract_id IS NOT NULL) AND (erp_payment_ticket_id = l.object_id)) |
| SubPlan 2 |
| -> Seq Scan on tbl_erp_payment_ticket_settles pts_1 (cost=0.00..41.01 rows=2 width=4) |
| Filter: (sales_contract_id IS NOT NULL) |
| SubPlan 3 |
| -> Index Scan using tbl_erp_payment_tickets_pkey on tbl_erp_payment_tickets pt (cost=0.28..8.30 rows=1 width=0) |
| Index Cond: (id = l.object_id) |
| Filter: (sales_contract_id IS NOT NULL) |
| SubPlan 4 |
| -> Seq Scan on tbl_erp_payment_tickets pt_1 (cost=0.00..97.51 rows=1 width=4) |
| Filter: (sales_contract_id IS NOT NULL) |
| SubPlan 5 |
| -> Seq Scan on tbl_erp_collect_ticket_settles cts (cost=0.00..41.29 rows=1 width=0) |
| Filter: ((purchase_contract_id IS NOT NULL) AND (erp_collect_ticket_id = l.object_id)) |
| SubPlan 6 |
| -> Seq Scan on tbl_erp_collect_ticket_settles cts_1 (cost=0.00..35.83 rows=2 width=4) |
| Filter: (purchase_contract_id IS NOT NULL) |
| SubPlan 7 |
| -> Index Scan using tbl_erp_collect_tickets_pkey on tbl_erp_collect_tickets ct (cost=0.28..8.30 rows=1 width=0) |
| Index Cond: (id = l.object_id) |
| Filter: (purchase_contract_id IS NOT NULL) |
| SubPlan 8 |
| -> Seq Scan on tbl_erp_collect_tickets ct_1 (cost=0.00..89.94 rows=1 width=4) |
| Filter: (purchase_contract_id IS NOT NULL) |
| SubPlan 9 |
| -> Seq Scan on tbl_erp_collect_ticket_settles cts_2 (cost=0.00..41.29 rows=1 width=0) |
| Filter: (((erp_other_income_ticket_id IS NOT NULL) OR (erp_other_collect_ticket_id IS NOT NULL)) AND (erp_collect_ticket_id = l.object_id)) |
| SubPlan 10 |
| -> Seq Scan on tbl_erp_collect_ticket_settles cts_3 (cost=0.00..35.83 rows=27 width=4) |
| Filter: ((erp_other_income_ticket_id IS NOT NULL) OR (erp_other_collect_ticket_id IS NOT NULL)) |
| SubPlan 11 |
| -> Nested Loop (cost=0.29..16.16 rows=1 width=0) |
| Join Filter: (tr.taxonomy_id = tt.id) |
| -> Index Scan using tbl_term_taxonomy_relationships_object_id_term_id_idx on tbl_term_taxonomy_relationships tr (cost=0.29..8.31 rows=1 width=4) |
| Index Cond: ((object_id = l.object_id) AND (term_id = 20)) |
| Filter: (object_type = 14) |
| -> Seq Scan on tbl_term_taxonomies tt (cost=0.00..7.84 rows=1 width=4) |
| Filter: ((name)::text ~~ '%税费返还%'::text) |
| SubPlan 12 |
| -> Nested Loop (cost=0.29..1384.60 rows=1 width=4) |
| Join Filter: (tr_1.taxonomy_id = tt_1.id) |
| -> Index Scan using tbl_term_taxonomy_relationships_object_id_term_id_idx on tbl_term_taxonomy_relationships tr_1 (cost=0.29..1376.75 rows=1 width=8) |
| Index Cond: (term_id = 20) |
| Filter: (object_type = 14) |
| -> Seq Scan on tbl_term_taxonomies tt_1 (cost=0.00..7.84 rows=1 width=4) |
| Filter: ((name)::text ~~ '%税费返还%'::text) |
| SubPlan 13 |
| -> Seq Scan on tbl_erp_payment_ticket_settles pts_2 (cost=0.00..47.26 rows=1 width=0) |
| Filter: ((purchase_contract_id IS NOT NULL) AND (erp_payment_ticket_id = l.object_id)) |
| SubPlan 14 |
| -> Seq Scan on tbl_erp_payment_ticket_settles pts_3 (cost=0.00..41.01 rows=2435 width=4) |
| Filter: (purchase_contract_id IS NOT NULL) |
| SubPlan 15 |
| -> Index Scan using tbl_erp_payment_tickets_pkey on tbl_erp_payment_tickets pt_2 (cost=0.28..8.30 rows=1 width=0) |
| Index Cond: (id = l.object_id) |
| Filter: (purchase_contract_id IS NOT NULL) |
| SubPlan 16 |
| -> Seq Scan on tbl_erp_payment_tickets pt_3 (cost=0.00..97.51 rows=2059 width=4) |
| Filter: (purchase_contract_id IS NOT NULL) |