优化
This commit is contained in:
@@ -25,6 +25,11 @@ public interface ContainerBookingMapper extends BaseMapper<ContainerBookingEntit
|
||||
AND (#{query.cabinetNo} IS NULL OR b.cabinet_no = #{query.cabinetNo})
|
||||
AND (#{query.billOfLadingNo} IS NULL OR b.bill_of_lading_no = #{query.billOfLadingNo})
|
||||
AND (#{query.customerId} IS NULL OR EXISTS (
|
||||
SELECT 1 FROM fl_ocean_booking_container_allocation customer_allocation
|
||||
JOIN fl_ocean_booking customer_booking ON customer_booking.id = customer_allocation.ocean_booking_id
|
||||
WHERE customer_allocation.container_booking_id = b.id
|
||||
AND customer_booking.customer_id = #{query.customerId}
|
||||
) OR EXISTS (
|
||||
SELECT 1 FROM fl_loading_plan_item customer_item
|
||||
WHERE customer_item.loading_plan_id = p.id
|
||||
AND customer_item.deleted = 0
|
||||
|
||||
+16
@@ -32,6 +32,22 @@ class ContainerBookingMapperContractTest {
|
||||
.doesNotContain("account_id");
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("货柜分页按装柜明细客户归属精确筛选")
|
||||
void filtersPageByStableCustomerId() throws Exception {
|
||||
String page = String.join("\n", ContainerBookingMapper.class
|
||||
.getDeclaredMethod("selectBookingPage", com.baomidou.mybatisplus.extension.plugins.pagination.Page.class,
|
||||
com.baiyue.firstleg.dto.ContainerDtos.Query.class)
|
||||
.getAnnotation(Select.class).value());
|
||||
assertThat(page)
|
||||
.contains("fl_ocean_booking_container_allocation customer_allocation")
|
||||
.contains("customer_allocation.container_booking_id = b.id")
|
||||
.contains("customer_booking.customer_id = #{query.customerId}")
|
||||
.contains("customer_item.loading_plan_id = p.id")
|
||||
.contains("customer_item.deleted = 0")
|
||||
.contains("customer_item.account_id = #{query.customerId}");
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("草稿完整更新和预装运输白名单都带版本与状态门禁")
|
||||
void guardsUpdatesInSql() {
|
||||
|
||||
+2
@@ -37,12 +37,14 @@ class LoadingListQueryMapperContractTest {
|
||||
.contains("p.preload_pushed_at IS NOT NULL")
|
||||
.contains("p.plan_status IN ('EDITING', 'LOADING')")
|
||||
.contains("active_item.deleted = 0")
|
||||
.contains("customer_item.account_id = #{query.customerId}")
|
||||
.contains("b.warehouse_id = #{query.warehouseId}")
|
||||
.doesNotContain("query.accountId")
|
||||
.doesNotContain("PRELOAD_PUSHED");
|
||||
assertThat(confirmed)
|
||||
.contains("FROM fl_loading_plan p")
|
||||
.contains("p.plan_status = 'COMPLETED'")
|
||||
.contains("customer_item.account_id = #{query.customerId}")
|
||||
.contains("b.warehouse_id = #{query.warehouseId}")
|
||||
.doesNotContain("query.accountId")
|
||||
.doesNotContain("fl_loading_list");
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ class TruckAppointmentMapperContractTest {
|
||||
@Test void mapsToPhase3TableAndUsesOptimisticGuards() throws Exception {
|
||||
assertThat(TruckAppointmentEntity.class.getAnnotation(TableName.class).value()).isEqualTo("fl_truck_appointment");
|
||||
String page = TruckAppointmentMapper.class.getMethod("page", com.baomidou.mybatisplus.extension.plugins.pagination.Page.class, com.baiyue.firstleg.dto.TruckAppointmentDtos.Query.class).getAnnotation(Select.class).value()[0];
|
||||
assertThat(page).contains("fl_truck_appointment", "appointment_no", "vehicle_no", "status=#{q.status}", "container_booking_id=#{q.containerBookingId}");
|
||||
assertThat(page).contains("fl_truck_appointment", "appointment_no", "vehicle_no", "status=#{q.status}", "customer_id=#{q.customerId}", "container_booking_id=#{q.containerBookingId}");
|
||||
String transition = TruckAppointmentMapper.class.getMethod("transition", long.class, String.class, String.class, int.class).getAnnotation(Update.class).value()[0];
|
||||
assertThat(transition).contains("status=#{toStatus}", "status=#{fromStatus}", "version=#{version}", "revision=revision+1", "version=version+1");
|
||||
String reschedule = TruckAppointmentMapper.class.getMethod("reschedule", long.class, java.time.LocalDateTime.class, String.class, int.class).getAnnotation(Update.class).value()[0];
|
||||
|
||||
@@ -61,7 +61,7 @@ class LoadingListServiceTest {
|
||||
|
||||
@Test
|
||||
void shouldAcceptEditingStatusFromPreloadList() {
|
||||
PreloadQuery query = new PreloadQuery(null, "EDITING", null, 100L, null, null, 1, 20);
|
||||
PreloadQuery query = new PreloadQuery(null, "EDITING", 200L, 100L, null, null, 1, 20);
|
||||
|
||||
service.preloadPage(query);
|
||||
|
||||
@@ -184,14 +184,14 @@ class LoadingListServiceTest {
|
||||
|
||||
@Test
|
||||
void confirmedPageAlwaysUsesRepositoryConfirmedProjection() {
|
||||
ConfirmedQuery query = new ConfirmedQuery(" plan ", null, 100L, null, null, 1, 20);
|
||||
ConfirmedQuery query = new ConfirmedQuery(" plan ", 200L, 100L, null, null, 1, 20);
|
||||
when(repository.confirmedPage(org.mockito.ArgumentMatchers.any())).thenReturn(
|
||||
new PageResult<>(List.of(), 1, 20, 0, 0));
|
||||
|
||||
service.confirmedPage(query);
|
||||
|
||||
verify(repository).confirmedPage(org.mockito.ArgumentMatchers.argThat(value ->
|
||||
"plan".equals(value.keyword())));
|
||||
"plan".equals(value.keyword()) && Long.valueOf(200L).equals(value.customerId())));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user