This commit is contained in:
2026-09-24 08:54:26 +08:00
parent 66c2651be7
commit 49e63eca9f
10 changed files with 23 additions and 20 deletions
@@ -14,7 +14,6 @@ public final class LocationRequests {
}
public record SaveRequest(
@NotBlank @Size(max = 50) String zoneCode,
@NotBlank @Size(max = 64) String locationCode,
@NotBlank @Size(max = 32) String locationType,
@NotNull @DecimalMin(value = "0.000", inclusive = false) BigDecimal maxLoadKg,
@@ -26,7 +25,6 @@ public final class LocationRequests {
public record QueryRequest(
@Min(1) long page,
@Min(1) @Max(200) long size,
String zoneCode,
String locationType,
String status,
String keyword
@@ -17,7 +17,6 @@ public class WarehouseLocationEntity extends BaseEntity {
private Long id;
private Long customerId;
private Long warehouseId;
private String zoneCode;
private String locationCode;
private String locationType;
/** A0 is a system-managed shared overflow location; normal locations are exclusive. */
@@ -14,10 +14,10 @@ public interface WarehouseLocationMapper extends BaseMapper<WarehouseLocationEnt
*/
@Insert("""
INSERT IGNORE INTO wh_location
(id, customer_id, warehouse_id, zone_code, location_code, location_type,
(id, customer_id, warehouse_id, location_code, location_type,
max_load_kg, status, remark, deleted, version)
VALUES
(#{location.id}, #{location.customerId}, #{location.warehouseId}, #{location.zoneCode},
(#{location.id}, #{location.customerId}, #{location.warehouseId},
#{location.locationCode}, #{location.locationType}, #{location.maxLoadKg},
#{location.status}, #{location.remark}, 0, 0)
""")
@@ -94,13 +94,11 @@ public class WarehouseResourceRepository {
var wrapper = new LambdaQueryWrapper<WarehouseLocationEntity>()
.eq(WarehouseLocationEntity::getCustomerId, customerId)
.eq(WarehouseLocationEntity::getWarehouseId, warehouseId)
.eq(StringUtils.hasText(query.zoneCode()), WarehouseLocationEntity::getZoneCode, query.zoneCode())
.eq(StringUtils.hasText(query.locationType()), WarehouseLocationEntity::getLocationType, query.locationType())
.eq(StringUtils.hasText(query.status()), WarehouseLocationEntity::getStatus, query.status())
.and(StringUtils.hasText(query.keyword()), q -> q
.like(WarehouseLocationEntity::getLocationCode, query.keyword())
.or().like(WarehouseLocationEntity::getZoneCode, query.keyword()))
.orderByAsc(WarehouseLocationEntity::getZoneCode)
)
.orderByAsc(WarehouseLocationEntity::getLocationCode);
return PageResult.from(locations.selectPage(new Page<>(query.page(), query.size()), wrapper));
}
@@ -185,7 +185,6 @@ public class WarehouseResourceService {
location.setId(IdWorker.getId());
location.setCustomerId(customerId);
location.setWarehouseId(warehouseId);
location.setZoneCode("DEFAULT");
location.setLocationCode(locationCode);
location.setLocationType("VIRTUAL");
location.setMaxLoadKg(new java.math.BigDecimal("999999999.000"));
@@ -214,7 +213,6 @@ public class WarehouseResourceService {
location.setId(IdWorker.getId());
location.setCustomerId(PUBLIC_RESOURCE_SCOPE);
location.setWarehouseId(warehouseId);
location.setZoneCode("OVERFLOW");
location.setLocationCode(SHARED_OVERFLOW_LOCATION_CODE);
location.setLocationType("SHARED_OVERFLOW");
location.setSharedOverflow(true);
@@ -424,7 +422,6 @@ public class WarehouseResourceService {
WarehouseLocationEntity entity = new WarehouseLocationEntity();
entity.setCustomerId(customerId);
entity.setWarehouseId(warehouseId);
entity.setZoneCode(request.zoneCode());
entity.setLocationCode(request.locationCode());
entity.setLocationType(request.locationType());
entity.setMaxLoadKg(request.maxLoadKg());