package com.zy.common.model.enums; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public enum WrkMastExecuteType { DEVP_NO_CRN_THREE(3, "DEVP_NO_CRN_THREE", linearSmallToBig(nonlinearSmallToBig(new Integer[]{261}),255,257)), DEVP_NO_CRN_FOUR(4,"DEVP_NO_CRN_FOUR", linearSmallToBig(nonlinearSmallToBig(new Integer[]{260}),246,248)), DEVP_NO_CRN_FIVE(5,"DEVP_NO_CRN_FIVE", linearSmallToBig(nonlinearSmallToBig(new Integer[]{259}),237,239)) ; private final Integer id; private final String code; private List siteList; WrkMastExecuteType(Integer id,String code,List siteList){ this.id = id; this.code = code; this.siteList = siteList; } public static List get(Integer id) { for (WrkMastExecuteType type : WrkMastExecuteType.values()){ if (type.id.equals(id)){ return type.siteList; } } return new ArrayList<>(); } public static List get(String code) { for (WrkMastExecuteType type : WrkMastExecuteType.values()){ if (type.code.equals(code)){ return type.siteList; } } return new ArrayList<>(); } private static List nonlinearSmallToBig(Integer[] sites){ return new ArrayList<>(Arrays.asList(sites)); } private static List linearSmallToBig(List integers,Integer smallSta,Integer bigSta){ for (int i = smallSta;i