3 changed files with 61 additions and 19 deletions
@ -0,0 +1,51 @@ |
|||
package com.epmet.commons.tools.enums; |
|||
|
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
|
|||
/** |
|||
* 组织级别枚举类 |
|||
* dev|test|prod |
|||
* |
|||
* @author jianjun liu |
|||
* @date 2020-07-03 11:14 |
|||
**/ |
|||
public enum OrgLevelEnum { |
|||
/** |
|||
* 组织等级枚举 |
|||
*/ |
|||
GRID("grid"), |
|||
COMMUNITY("community"), |
|||
STREET("street"), |
|||
DISTRICT("district"), |
|||
CITY("city"), |
|||
PROVINCE("province"), |
|||
; |
|||
|
|||
private String code; |
|||
|
|||
|
|||
|
|||
|
|||
OrgLevelEnum(String code) { |
|||
this.code = code; |
|||
|
|||
} |
|||
|
|||
public static OrgLevelEnum getEnum(String code) { |
|||
OrgLevelEnum[] values = OrgLevelEnum.values(); |
|||
for (OrgLevelEnum value : values) { |
|||
if (value.getCode().equals(code)) { |
|||
return value; |
|||
} |
|||
} |
|||
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode()); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
} |
Loading…
Reference in new issue