package com.ots.common.enums; import lombok.Getter; import java.util.Objects; /** * @version 1.0 * @Author linzhijie * @Description //TODO * @Date 2022/03/11 16:25 */ @Getter public enum TableEnum { table1(0,"表1"), table2(1,"表2"), table3(2,"表3"), table4(4,"表4"), table4Children(99,"表4子集合"), table5(5,"表5"); private Integer code; private String name; TableEnum(Integer code,String name) { this.code = code; this.name = name; } public static TableEnum codeOf(Integer code) { for (TableEnum xxxEnum : values()) { if (Objects.equals(xxxEnum.getCode(), code)) { return xxxEnum; } } throw new RuntimeException("The table is not supported!"); } }