From 275bcf975a288730b7e3c26f67fe484bc33f0510 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期四, 12 六月 2025 08:51:33 +0800
Subject: [PATCH] 代码优化
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java
index 60fec73..c4dcabd 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java
@@ -2,13 +2,11 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.vincent.rsf.framework.common.SpringUtils;
-import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.manager.entity.DeviceSite;
import com.vincent.rsf.server.manager.entity.Loc;
import com.vincent.rsf.server.manager.service.DeviceSiteService;
import com.vincent.rsf.server.manager.service.LocService;
-import com.vincent.rsf.server.system.enums.LocStsType;
-import org.apache.commons.lang3.StringUtils;
+import com.vincent.rsf.server.manager.enums.LocStsType;
import java.util.Objects;
@@ -21,13 +19,19 @@
* @return
* @time 2025/3/31 08:50
*/
- public static String getTargetLoc() {
+ public static String getTargetLoc(Long areaId) {
//TODO 搴撲綅绛栫暐鍚庣画鎺掓湡
LocService locService = SpringUtils.getBean(LocService.class);
- Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_D.type), false);
+ Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>()
+ .eq(Loc::getAreaId, areaId)
+ .orderByAsc(Loc::getLev)
+ .orderByAsc(Loc::getCol)
+ .orderByAsc(Loc::getRow)
+ .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type), false
+ );
- return Objects.isNull(loc) ? loc.getCode() : null;
+ return !Objects.isNull(loc) ? loc.getCode() : null;
}
@@ -42,6 +46,6 @@
//TODO 绔欑偣绛栫暐鍚庣画鎺掓湡
DeviceSiteService deviceSite = SpringUtils.getBean(DeviceSiteService.class);
DeviceSite loc = deviceSite.getOne(new LambdaQueryWrapper<DeviceSite>().eq(DeviceSite::getStatus, 1), false);
- return Objects.isNull(loc) ? loc.getSite() : null;
+ return !Objects.isNull(loc) ? loc.getSite() : null;
}
}
--
Gitblit v1.9.1