优化
This commit is contained in:
+3
-1
@@ -53,7 +53,9 @@ class InternalInboundOrderReferenceControllerTest {
|
||||
@Test
|
||||
void unifiedQueryRequiresInternalTokenAndForwardsBatchRequest() {
|
||||
UnifiedInboundQuery request = new UnifiedInboundQuery(
|
||||
10001L, null, null, "WAIT_SPLIT", null, null, null, null, null, 1, 20);
|
||||
10001L, null, null, "WAIT_SPLIT", null, null, null,
|
||||
null, null, null, null, null, null, null, null, null, null, null, null,
|
||||
null, null, 1, 20);
|
||||
when(unifiedQueryService.page(request)).thenReturn(new PageResult<>(List.of(), 1, 20, 0, 0));
|
||||
|
||||
assertThat(controller.unifiedPage("internal-token", request).data().records()).isEmpty();
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baiyue.firstleg.dto.InboundOrderQuery;
|
||||
import com.baiyue.firstleg.dto.UnifiedInboundQuery;
|
||||
import com.baiyue.firstleg.entity.InboundOrderEntity;
|
||||
import com.baiyue.firstleg.entity.InboundPalletAllocationEntity;
|
||||
import com.baiyue.firstleg.entity.InboundTransportSnapshotEntity;
|
||||
@@ -29,6 +30,9 @@ import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@SpringJUnitConfig(InboundOrderRepository.class)
|
||||
class InboundOrderRepositoryTest {
|
||||
@MockBean private InboundOrderMapper orders;
|
||||
@@ -38,6 +42,34 @@ class InboundOrderRepositoryTest {
|
||||
@MockBean private InboundInternalNoteMapper notes;
|
||||
@MockBean private InboundStatusHistoryMapper histories;
|
||||
@Resource private InboundOrderRepository repository;
|
||||
@Test
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
void unifiedQueryPushesExpandedFiltersIntoDatabasePage() {
|
||||
TableInfoHelper.initTableInfo(
|
||||
new MapperBuilderAssistant(new MybatisConfiguration(), "test"), InboundOrderEntity.class);
|
||||
when(orders.selectPage(any(Page.class), any(Wrapper.class)))
|
||||
.thenReturn(new Page<InboundOrderEntity>(1, 20));
|
||||
UnifiedInboundQuery query = new UnifiedInboundQuery(
|
||||
10001L, null, null, "LOADING", 30001L, 40001L, 50001L,
|
||||
"RK-", "APPROVED", LocalDate.of(2026, 8, 6), "APPROVED", "美森",
|
||||
"MSCU", "CAB", LocalDate.of(2026, 8, 8), true, true, "UNRECORDED",
|
||||
List.of(77L, 78L), null, null, 1, 20);
|
||||
|
||||
repository.pageUnifiedEntities(query, List.of("LOADING"));
|
||||
|
||||
ArgumentCaptor<Wrapper<InboundOrderEntity>> captor = ArgumentCaptor.forClass(Wrapper.class);
|
||||
verify(orders).selectPage(any(Page.class), captor.capture());
|
||||
String sql = captor.getValue().getCustomSqlSegment();
|
||||
assertThat(sql).contains("inbound_code", "order_status_snapshot", "expected_arrival_at",
|
||||
"channel_name", "container_mode", "measure_review_status", "order_id IN",
|
||||
"fl_inbound_fee", "fl_inbound_transport_snapshot", "sailing_at", "loading_status");
|
||||
LambdaQueryWrapper<InboundOrderEntity> wrapper =
|
||||
(LambdaQueryWrapper<InboundOrderEntity>) captor.getValue();
|
||||
assertThat(wrapper.getParamNameValuePairs().values())
|
||||
.contains(10001L, 30001L, 40001L, 50001L, "%RK-%", "APPROVED", "美森",
|
||||
"MSCU", "CAB", 77L, 78L);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
void shouldApplyTenantCompanyAndWarehouseFilters() {
|
||||
|
||||
Reference in New Issue
Block a user