luyie
2 months ago
4 changed files with 87 additions and 2 deletions
@ -0,0 +1,49 @@
|
||||
package com.hnac.gglm.bigmodel.business.constants; |
||||
|
||||
import lombok.Getter; |
||||
|
||||
import java.util.Map; |
||||
import java.util.concurrent.ConcurrentHashMap; |
||||
|
||||
/** |
||||
* @Author: ypj |
||||
* @Date: 2024/9/20 22:39 |
||||
*/ |
||||
@Getter |
||||
public enum AccessRules { |
||||
MOST_EARLY("0", "最早值"), |
||||
LARGEST("1", "最大值"), |
||||
SMALLEST("2", "最小值"), |
||||
AVERAGE("3", "平均值"), |
||||
SUM("4", "累计值/和值"), |
||||
CHANGE("5", "变化值/差值"), |
||||
LAST("6", "最新值/最后值"); |
||||
|
||||
private final String code; |
||||
private final String desc; |
||||
|
||||
private static final Map<String, AccessRules> map = new ConcurrentHashMap<>(); |
||||
|
||||
static { |
||||
for (AccessRules accessRules : AccessRules.values()) { |
||||
map.put(accessRules.code, accessRules); |
||||
} |
||||
} |
||||
|
||||
AccessRules(String code, String desc) { |
||||
this.code = code; |
||||
this.desc = desc; |
||||
} |
||||
|
||||
public static AccessRules getByCode(String code) { |
||||
return map.get(code); |
||||
} |
||||
|
||||
public static String getDescByCode(String code) { |
||||
AccessRules rule = getByCode(code); |
||||
if (null != rule) { |
||||
return rule.getDesc(); |
||||
} |
||||
return null; |
||||
} |
||||
} |
Loading…
Reference in new issue