优化
This commit is contained in:
-2
@@ -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
|
||||
|
||||
-1
@@ -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. */
|
||||
|
||||
+2
-2
@@ -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)
|
||||
""")
|
||||
|
||||
+1
-3
@@ -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));
|
||||
}
|
||||
|
||||
-3
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user