From fbc7e9a142c61c2c1ecb764e3cecaf1ce3e21b75 Mon Sep 17 00:00:00 2001 From: juicew <491852417@qq.com> Date: Thu, 15 Oct 2026 23:10:26 +0800 Subject: [PATCH] fix: make mock request record lookup deterministic Order mock request records by date_updated DESC and id DESC so queryByApiId consistently returns the most recently updated record, using the primary key as a stable tie breaker. Add H2 integration coverage for duplicate api_id values, timestamp ordering, ID tie breaking, and the service-level queryByApiId selection. --- .../mappers/mock-request-record-sqlmap.xml | 1 + .../mapper/MockRequestRecordMapperTest.java | 63 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/shenyu-admin/src/main/resources/mappers/mock-request-record-sqlmap.xml b/shenyu-admin/src/main/resources/mappers/mock-request-record-sqlmap.xml index 85883814a19e..3ab689ba9bb3 100644 --- a/shenyu-admin/src/main/resources/mappers/mock-request-record-sqlmap.xml +++ b/shenyu-admin/src/main/resources/mappers/mock-request-record-sqlmap.xml @@ -64,6 +64,7 @@ and `header` = #{header, jdbcType=VARCHAR} + ORDER BY date_updated DESC, id DESC