实现资产双向换货链路查询

This commit is contained in:
2026-07-22 18:05:38 +09:00
parent 7c8a4cd328
commit c58773e35b
16 changed files with 1133 additions and 40 deletions

View File

@@ -0,0 +1,8 @@
-- 为已完成且未软删除的换货链双向最新记录查询增加非唯一部分索引。
CREATE INDEX idx_exchange_trace_new_asset
ON tb_exchange_order USING btree (new_asset_type, new_asset_id, completed_at DESC NULLS LAST, id DESC)
WHERE status = 4 AND deleted_at IS NULL;
CREATE INDEX idx_exchange_trace_old_asset
ON tb_exchange_order USING btree (old_asset_type, old_asset_id, completed_at DESC NULLS LAST, id DESC)
WHERE status = 4 AND deleted_at IS NULL;