| | |
| | | import com.zy.acs.manager.manager.entity.ActionType; |
| | | import com.zy.acs.manager.manager.service.ActionTypeService; |
| | | |
| | | import java.util.EnumMap; |
| | | import java.util.Map; |
| | | |
| | | public enum ActionTypeType { |
| | | |
| | | TurnCorner("转弯"), // 转弯 |
| | |
| | | } |
| | | public String desc; |
| | | |
| | | private static final Map<ActionTypeType, Long> cache = new EnumMap<>(ActionTypeType.class); |
| | | |
| | | public long val() { |
| | | ActionTypeService service = SpringUtils.getBean(ActionTypeService.class); |
| | | ActionType actionType = service.selectByUuid(this.toString()); |
| | | if (actionType == null) { |
| | | throw new BusinessException("ActionTypeType Error!"); |
| | | } |
| | | return actionType.getId(); |
| | | return cache.computeIfAbsent(this, key -> { |
| | | ActionTypeService service = SpringUtils.getBean(ActionTypeService.class); |
| | | ActionType actionType = service.selectByUuid(this.toString()); |
| | | if (actionType == null) { |
| | | throw new BusinessException("ActionTypeType Error!"); |
| | | } |
| | | return actionType.getId(); |
| | | }); |
| | | } |
| | | |
| | | public static ActionTypeType get(String el) { |