zhoushihao
2024-05-24 6db1c7d6ddc4e5781557f0c44b48716f5b32a12d
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/impl/EdgStorageCageServiceImpl.java
@@ -37,7 +37,7 @@
    UpPattenUsageMapper upPattenUsageMapper;
    @Override
    public EdgStorageCage selectNearestEmpty(int currentSlot) {
    public EdgStorageCage selectNearestEmpty(int currentSlot, boolean flag) {
        List<EdgStorageCage> emptyList = this.selectJoinList(EdgStorageCage.class, new MPJLambdaWrapper<EdgStorageCage>()
                .selectAll(EdgStorageCage.class)
                .leftJoin(EdgStorageCageDetails.class, on -> on
@@ -46,7 +46,10 @@
                .isNull(EdgStorageCageDetails::getSlot)
                .last("order by abs(t.slot - " + currentSlot + ")  asc limit 2")
        );
        if (CollectionUtil.isEmpty(emptyList) || emptyList.size() < 2) {
        if (flag && CollectionUtil.isNotEmpty(emptyList)) {
            return emptyList.get(0);
        }
        if (CollectionUtil.isEmpty(emptyList) || emptyList.size() == 1) {
            return null;
        }
        return emptyList.get(0);