在状态枚举中添加一个抽象方法getToOldStatusList(),并在每个枚举常量中实现该方法
public enum BsiOppMediumStatus {
HANDLE_0(0, "商机媒介初始化") {
@Override
public List<Integer> getToOldStatusList() {
return List.of(BsiOppMediumStatus.HANDLE_0.getCode());
}
},
HANDLE_1(1, "商机媒介待接单") {
@Override
public List<Integer> getToOldStatusList() {
return List.of(BsiOppMediumStatus.HANDLE_0.getCode(),BsiOppMediumStatus.HANDLE_1.getCode());
}
},
// 其他枚举常量
private final int code;
private final String description;
BsiOppMediumStatus(int code, String description) {
this.code = code;
this.description = description;
}
public int getCode() {
return code;
}
public String getDescription() {
return description;
}
public abstract List<Integer> getToOldStatusList();
}