zss
2025-01-13 8d85246f061e3da623c7b9eb4e323ee724b4de0b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.yuanchu.mom.enums;
 
import org.apache.commons.lang3.StringUtils;
 
public enum QrModelType {
 
    WORD_TYPE("word","word_qr_show"),
    DEVICE_TYPE("device","device_qr_show");
 
    String type,value;
 
    QrModelType(String desc, String value) {
        this.type = desc;
        this.value = value;
    }
 
    public String getType() {
        return type;
    }
 
    public String getValue() {
        return value;
    }
 
    /**
     * 根据类型获取枚举值
     * @param type
     * @return
     */
    public static String getValueByType(String type){
        for (QrModelType qrModelType : QrModelType.values()) {
            if(StringUtils.isNotBlank(type) && type.equals(qrModelType.getType())){
                return qrModelType.getValue();
            }
        }
        throw new IllegalArgumentException();
    }
 
}