This commit is contained in:
2026-08-05 13:50:37 +08:00
parent 487f398eb8
commit 264458920b
7 changed files with 41 additions and 16 deletions
@@ -89,8 +89,8 @@ public class PlatformWarehouseController {
}
@Operation(
summary = "List tenant warehouses / 查询租户仓库",
description = "Returns a tenant-scoped warehouse page with optional country, capability and status filters. / 按租户分页查询仓库,可按国家、能力和状态筛选。"
summary = "List platform warehouses / 查询平台仓库",
description = "Returns all platform warehouses by default; customer ID is an optional compatibility filter. / 默认分页查询平台全部仓库,客户 ID 仅作为兼容筛选条件。"
)
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "Query succeeded / 查询成功"),
@@ -101,11 +101,11 @@ public class PlatformWarehouseController {
@PreAuthorize("hasAuthority('platform:warehouse:list')")
public ApiResponse<PageResult<WarehouseEntity>> page(
@AuthenticationPrincipal AuthenticatedUser user,
@Parameter(description = "Target tenant ID / 目标租户 ID", example = "10001", required = true)
@RequestParam @NotNull Long tenantId,
@Parameter(description = "Optional customer ID / 可选客户 ID", example = "10001")
@RequestParam(required = false) Long tenantId,
@Valid WarehouseRequests.QueryRequest request) {
requirePlatform(user);
requireTenant(tenantId);
if (tenantId != null) requireTenant(tenantId);
return ApiResponse.success(service.page(tenantId, request));
}
@@ -169,4 +169,3 @@ public class PlatformWarehouseController {
}
}
}
@@ -56,9 +56,9 @@ public class WarehouseRepository {
.ne(excludedId != null, WarehouseEntity::getId, excludedId)) > 0;
}
public PageResult<WarehouseEntity> page(long tenantId, WarehouseRequests.QueryRequest query) {
public PageResult<WarehouseEntity> page(Long tenantId, WarehouseRequests.QueryRequest query) {
LambdaQueryWrapper<WarehouseEntity> wrapper = new LambdaQueryWrapper<WarehouseEntity>()
.eq(WarehouseEntity::getTenantId, tenantId)
.eq(tenantId != null, WarehouseEntity::getTenantId, tenantId)
.eq(StringUtils.hasText(query.status()), WarehouseEntity::getStatus, query.status())
.eq(StringUtils.hasText(query.warehouseType()), WarehouseEntity::getWarehouseType, query.warehouseType())
.eq(StringUtils.hasText(query.countryCode()), WarehouseEntity::getCountryCode, query.countryCode())
@@ -67,7 +67,7 @@ public class WarehouseRepository {
if (StringUtils.hasText(query.capabilityCode())) {
List<Long> ids = capabilities.selectList(new LambdaQueryWrapper<ServiceCapabilityEntity>()
.select(ServiceCapabilityEntity::getWarehouseId)
.eq(ServiceCapabilityEntity::getTenantId, tenantId)
.eq(tenantId != null, ServiceCapabilityEntity::getTenantId, tenantId)
.eq(ServiceCapabilityEntity::getCapabilityCode, query.capabilityCode())
.eq(ServiceCapabilityEntity::getEnabled, true))
.stream()
@@ -63,7 +63,7 @@ public class WarehouseApplicationService {
insertChildren(tenantId, id, request.address(), request.capabilities());
}
public PageResult<WarehouseEntity> page(long tenantId, WarehouseRequests.QueryRequest query) {
public PageResult<WarehouseEntity> page(Long tenantId, WarehouseRequests.QueryRequest query) {
return repository.page(tenantId, query);
}