package com.panzhihua.common.enums; import lombok.Getter; /** * 是否状态 * * @author huanghongfa */ @Getter public enum PopulIsRentEnum { YES(1, "租住"), NO(0, "自住"); private final Integer code; private final String name; PopulIsRentEnum(Integer code, String name) { this.code = code; this.name = name; } public static int getCodeByName(String name) { for (PopulIsRentEnum item : PopulIsRentEnum.values()) { if (item.name.equals(name)) { return item.getCode(); } } return 0; } public static String getCnDescByName(Integer code) { for (PopulIsRentEnum item : PopulIsRentEnum.values()) { if (item.code.equals(code)) { return item.getName(); } } return "否"; } }