dengsixing 3 năm trước cách đây
mục cha
commit
755641690a

+ 22 - 7
4dkankan-common-utils/src/main/java/com/fdkankan/common/constant/LoginType.java

@@ -2,17 +2,32 @@ package com.fdkankan.common.constant;
 
 public enum LoginType {
 
-    USER("User"),  MANAGER("Manager"), AGENT("Agent"), APP("App");
+    USER("User"),
+    MANAGER("Manager"),
+    AGENT("Agent"),
+    APP("App");
 
-    private String type;
+    private String code;
 
-    private LoginType(String type) {
-        this.type = type;
+    private LoginType(String code) {
+        this.code = code;
     }
 
-    @Override
-    public String toString() {
-        return this.type.toString();
+    public String code() {
+        return code;
     }
 
+    public static LoginType get(String code){
+        LoginType[] values = LoginType.values();
+        String enumValue = null;
+        for(LoginType eachValue : values){
+            enumValue = eachValue.code();
+            if(enumValue.equals(code)){
+                return eachValue;
+            }
+        }
+        return null;
+    }
+
+
 }