dangsn
2024-06-06 33321f5486fd586fda6fd3f46b7e71754fede28b
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package com.vci.starter.web.enumpck;
 
 
/**
 * 数据修改类型
 * @author weidy
 * @date 2019/10/10 4:23 PM
 */
public  enum VciChangeDocumentTypeEnum {
    /**
     * 添加
     */
    ADD,
    /**
     * 修改
     */
    EDIT,
    /**
     * 删除
     */
    DELETE,
 
    /**
     * 生命周期变化
     */
    LCSTATUS,
 
    /**
     * 升版
     */
    UPREVISION,
 
    /**
     * 提交流程
     */
    SUBMIT,
 
    /**
     * 发布
     */
    RELEASED,
    /**
     * 全部
     */
    ALL;
 
    /**
     * 根据名称获取对应的枚举值
     * @param text 名称
     * @return 枚举值
     */
    public static String getValueByText(String text){
        if(text == null || text.trim().length() == 0){
            return "";
        }else{
            if("删除".equalsIgnoreCase(text)){
                return DELETE.name();
            }else if("修改".equalsIgnoreCase(text)){
                return EDIT.name();
            }else if("生命周期变更".equalsIgnoreCase(text)){
                return LCSTATUS.name();
            }else if("升版".equalsIgnoreCase(text)){
                return UPREVISION.name();
            }else if("提交流程".equalsIgnoreCase(text)){
                return SUBMIT.name();
            }else if("发布".equalsIgnoreCase(text)){
                return RELEASED.name();
            }else if("全部".equalsIgnoreCase(text)){
                return ALL.name();
            }else{
                return ADD.name();
            }
        }
    }
 
    /**
     * 根据枚举值获取名称
     * @param value 枚举值
     * @return 名称
     */
    public static String getTextByValue(String value){
        VciChangeDocumentTypeEnum wenum = forValue(value);
        if(wenum == null){
            return  "";
        }
        switch (wenum){
            case DELETE:
                return "删除";
            case EDIT:
                return "修改";
            case LCSTATUS:
                return "生命周期变更";
            case UPREVISION:
                return "升版";
            case SUBMIT:
                return "提交流程";
            case RELEASED:
                return "发布";
            case ALL:
                return "全部";
            default:
                return "添加";
        }
    }
 
    /**
     * 根据枚举值获取枚举对象
     * @param value 枚举值
     * @return 对应的枚举对象,不匹配的时候返回null
     */
    public static VciChangeDocumentTypeEnum forValue(String value){
        for(VciChangeDocumentTypeEnum wenum : VciChangeDocumentTypeEnum.values()){
            if(wenum.name().equalsIgnoreCase(value)){
                return wenum;
            }
        }
        return null;
    }
 
}