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<Integer> siteList;
|
WrkMastExecuteType(Integer id,String code,List<Integer> siteList){
|
this.id = id;
|
this.code = code;
|
this.siteList = siteList;
|
}
|
|
public static List<Integer> get(Integer id) {
|
for (WrkMastExecuteType type : WrkMastExecuteType.values()){
|
if (type.id.equals(id)){
|
return type.siteList;
|
}
|
}
|
return new ArrayList<>();
|
}
|
|
public static List<Integer> get(String code) {
|
for (WrkMastExecuteType type : WrkMastExecuteType.values()){
|
if (type.code.equals(code)){
|
return type.siteList;
|
}
|
}
|
return new ArrayList<>();
|
}
|
|
private static List<Integer> nonlinearSmallToBig(Integer[] sites){
|
return new ArrayList<>(Arrays.asList(sites));
|
}
|
|
private static List<Integer> linearSmallToBig(List<Integer> integers,Integer smallSta,Integer bigSta){
|
for (int i = smallSta;i<bigSta;i++){
|
integers.add(i);
|
}
|
return integers;
|
}
|
}
|