#
vincentlu
2025-05-13 ebd2f4397a92c6a5096de1b86d59154363344720
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/enums/LocStsType.java
@@ -5,6 +5,9 @@
import com.zy.acs.manager.manager.entity.LocSts;
import com.zy.acs.manager.manager.service.LocStsService;
import java.util.EnumMap;
import java.util.Map;
public enum LocStsType {
    IDLE,
@@ -18,13 +21,17 @@
    LocStsType() {
    }
    private static final Map<LocStsType, Long> cache = new EnumMap<>(LocStsType.class);
    public long val() {
        LocStsService service = SpringUtils.getBean(LocStsService.class);
        LocSts locSts = service.selectByUuid(this.toString());
        if (locSts == null) {
            throw new BusinessException("LocStsType Error!");
        }
        return locSts.getId();
        return cache.computeIfAbsent(this, key -> {
            LocStsService service = SpringUtils.getBean(LocStsService.class);
            LocSts locSts = service.selectByUuid(this.toString());
            if (locSts == null) {
                throw new BusinessException("LocStsType Error!");
            }
            return locSts.getId();
        });
    }
}