|
@@ -1,5 +1,6 @@
|
|
package com.fjhx.enums.classify;
|
|
package com.fjhx.enums.classify;
|
|
|
|
|
|
|
|
+import lombok.Getter;
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.StringPool;
|
|
import org.springblade.core.tool.utils.StringPool;
|
|
|
|
|
|
@@ -10,16 +11,17 @@ import java.util.Map;
|
|
/**
|
|
/**
|
|
* 分类类型枚举
|
|
* 分类类型枚举
|
|
*/
|
|
*/
|
|
|
|
+@Getter
|
|
public enum ClassifyTypeEnum {
|
|
public enum ClassifyTypeEnum {
|
|
CLASSIFY_TYPE_1(1, "产品分类"),
|
|
CLASSIFY_TYPE_1(1, "产品分类"),
|
|
CLASSIFY_TYPE_2(2, "物料分类"),
|
|
CLASSIFY_TYPE_2(2, "物料分类"),
|
|
;
|
|
;
|
|
|
|
|
|
- private int key;
|
|
|
|
|
|
+ private final int key;
|
|
|
|
|
|
- private String value;
|
|
|
|
|
|
+ private final String value;
|
|
|
|
|
|
- private static Map<Integer, String> map = new LinkedHashMap<>();
|
|
|
|
|
|
+ private static final Map<Integer, String> map = new LinkedHashMap<>();
|
|
|
|
|
|
private static final HashMap<Integer, ClassifyTypeEnum> classMap = new HashMap<>();
|
|
private static final HashMap<Integer, ClassifyTypeEnum> classMap = new HashMap<>();
|
|
|
|
|
|
@@ -28,7 +30,6 @@ public enum ClassifyTypeEnum {
|
|
this.value = value;
|
|
this.value = value;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
static {
|
|
static {
|
|
for (ClassifyTypeEnum value : ClassifyTypeEnum.values()) {
|
|
for (ClassifyTypeEnum value : ClassifyTypeEnum.values()) {
|
|
classMap.put(value.getKey(), value);
|
|
classMap.put(value.getKey(), value);
|
|
@@ -44,8 +45,6 @@ public enum ClassifyTypeEnum {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取枚举map
|
|
* 获取枚举map
|
|
- *
|
|
|
|
- * @return
|
|
|
|
*/
|
|
*/
|
|
public static Map<Integer, String> getMap() {
|
|
public static Map<Integer, String> getMap() {
|
|
if (Func.isNotEmpty(map)) {
|
|
if (Func.isNotEmpty(map)) {
|
|
@@ -59,9 +58,6 @@ public enum ClassifyTypeEnum {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 通过key获取名称
|
|
* 通过key获取名称
|
|
- *
|
|
|
|
- * @param key
|
|
|
|
- * @return
|
|
|
|
*/
|
|
*/
|
|
public static String getNameByKey(Integer key) {
|
|
public static String getNameByKey(Integer key) {
|
|
if (key == null || key < 0) {
|
|
if (key == null || key < 0) {
|
|
@@ -71,12 +67,4 @@ public enum ClassifyTypeEnum {
|
|
return map.getOrDefault(key, StringPool.EMPTY);
|
|
return map.getOrDefault(key, StringPool.EMPTY);
|
|
}
|
|
}
|
|
|
|
|
|
- public int getKey() {
|
|
|
|
- return key;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public String getValue() {
|
|
|
|
- return value;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|