Browse Source

图谱返回控件类型

Zhaops 6 years ago
parent
commit
ac029446cb
1 changed files with 51 additions and 0 deletions
  1. 51 0
      icss-service/src/main/java/com/diagbot/enums/GBControlTypeEnum.java

+ 51 - 0
icss-service/src/main/java/com/diagbot/enums/GBControlTypeEnum.java

@@ -0,0 +1,51 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @Description: 不良反应控件类型
+ * @Author:zhaops
+ * @time: 2019/3/14 11:16
+ */
+public enum GBControlTypeEnum implements KeyedNamed {
+    Radio(0, "单选"),
+    CheckBox(1, "多选"),
+    Text(2,"文本"),
+    Dropdownlist(3,"下拉列表");
+
+    @Setter
+    private Integer key;
+
+    @Setter
+    private String name;
+
+    GBControlTypeEnum(Integer key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static GBControlTypeEnum getEnum(Integer key) {
+        for (GBControlTypeEnum item : GBControlTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(Integer key) {
+        GBControlTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}