ludc
2025-01-16 68fd566d21b3efc3a670a5295289b1801f5a4155
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
package com.vci.web.enumpck;
 
import com.vci.common.portal.enums.GetByType;
import com.vci.constant.PortalVIEnumConstant;
import com.vci.starter.web.annotation.VciEnum;
 
/**
 * 表单类型
 * @author xiej
 *
 */
@VciEnum(name = PortalVIEnumConstant.PORTALVI_VI_TYPE,text = "表单类型")
public enum PortalVIType {
    Form("Form", "表单", (short)1),
    Table("Table", "表格", (short)0);
    
    private String name = "";
    private String label = "";
    private short intVal = 1;
    
    private PortalVIType(String name, String label, short intVal){
        this.name = name;
        this.label = label;
        this.intVal = intVal;
    }
    
    public static PortalVIType getByName(String name){
        PortalVIType res = getByType(GetByType.Name, name);
        return res;
    }
    
    public static PortalVIType getByLabel(String label){
        PortalVIType res = getByType(GetByType.Label, label);
        return res;
    }
    
    public static PortalVIType getByIntVal(int intVal){
        PortalVIType res = getByType(GetByType.IntVal, String.valueOf(intVal));
        return res;
    }
    
    public static PortalVIType getByType(GetByType type, String val){
        PortalVIType[] alls = getAll();
        PortalVIType res = null;
        for(PortalVIType obj : alls){
            if(type == GetByType.Name && obj.getName().equalsIgnoreCase(val)){
                res = obj;
                break;
            } else if(type  == GetByType.Label && obj.getLabel().equalsIgnoreCase(val)){
                res = obj;
                break;
            } else if(type  == GetByType.IntVal && String.valueOf(obj.getIntVal()).equalsIgnoreCase(val)){
                res = obj;
                break;
            }
        }
        return res;
    }
    
    public static PortalVIType[] getAll(){
        return PortalVIType.values();
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public String getLabel() {
        return label;
    }
 
    public void setLabel(String label) {
        this.label = label;
    }
 
    public short getIntVal() {
        return intVal;
    }
 
    public void setIntVal(short intVal) {
        this.intVal = intVal;
    }
 
}