@Getter
public class DietitianCorrespondUserConst {
@Getter
public enum StateType {
NO_STATE("0", "未开始"),
STARTING_STATE("1", "服务中"),
STOP_STATE("2", "已结束");
private String code;
private String description;
StateType(String code, String description) {
this.code = code;
this.description = description;
}
public boolean equalWithCode(String code) {
return null != code && this.code.equals(code);
}
public static StateType findByCode(Integer code) {
Optional<StateType> status = Arrays.stream(StateType.values())
.filter(d -> null != code && d.getCode().equals(code))
.findAny();
if (status.isPresent()) {
return status.get();
} else {
return null;
}
}
}
}