12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- package com.diagbot.enums;
- import com.diagbot.core.KeyedNamed;
- import lombok.Setter;
- /**
- * @Description:
- * @Author:zhaops
- * @time: 2021/6/15 13:20
- */
- public enum MatchSourceEnum implements KeyedNamed {
- StandWord(1, "标准词"),
- SynonymsWord(2, "同义词"),
- Code(3,"编码"),
- History(4,"历史数据"),
- SimilarWord(5,"相似词"),
- Approval(6,"国药准字");
- @Setter
- private int key;
- @Setter
- private String name;
- MatchSourceEnum(int key, String name) {
- this.key = key;
- this.name = name;
- }
- public static MatchSourceEnum getEnum(int key) {
- for (MatchSourceEnum item : MatchSourceEnum.values()) {
- if (item.key == key) {
- return item;
- }
- }
- return null;
- }
- public static MatchSourceEnum getEnum(String name) {
- for (MatchSourceEnum item : MatchSourceEnum.values()) {
- if (item.name.equals(name)) {
- return item;
- }
- }
- return null;
- }
- public static String getName(int key) {
- MatchSourceEnum item = getEnum(key);
- return item != null ? item.name : null;
- }
- public static Integer getKey(String name) {
- MatchSourceEnum item = getEnum(name);
- return item != null ? item.key : null;
- }
- @Override
- public int getKey() {
- return key;
- }
- @Override
- public String getName() {
- return name;
- }
- }
|