This commit is contained in:
2026-09-20 11:09:52 +08:00
parent c909d9044e
commit 78a36d1a39
4 changed files with 29 additions and 8 deletions
@@ -29,6 +29,15 @@ class ContainerOverviewSqlContractTest {
.doesNotContain("SELECT *");
}
@Test void pickExceptionReasonsRemainOrderedWithoutInvalidDistinctOrdering() throws Exception {
String sql = String.join(" ", ContainerOverviewMapper.class
.getDeclaredMethod("pickExceptionReasons", long.class)
.getAnnotation(Select.class).value());
assertThat(sql)
.contains("GROUP BY h.operation_reason", "ORDER BY MIN(h.id)")
.doesNotContain("SELECT DISTINCT");
}
@Test void exceptionQueriesSelectEveryExceptionRowConstructorField() throws Exception {
for (String method : java.util.List.of("exceptions", "latestException")) {
String sql = String.join(" ", ContainerOverviewMapper.class.getDeclaredMethod(method, long.class)
@@ -0,0 +1,19 @@
package com.baiyue.firstleg.repository;
import com.baiyue.firstleg.mapper.InboundHoldGateMapper;
import org.apache.ibatis.annotations.Select;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
class InboundHoldGateSqlContractTest {
@Test void physicalWorkGateUsesOnlyCurrentFulfillmentTables() throws Exception {
String sql = String.join(" ", InboundHoldGateMapper.class
.getDeclaredMethod("hasPhysicalWork", long.class, long.class)
.getAnnotation(Select.class).value());
assertThat(sql)
.contains("fl_loading_pick_item", "picked_package_count>0", "fl_outbound_dispatch")
.doesNotContain("fl_loading_work_pallet", "fl_loading_work_pallet_carton");
}
}