package com.hdkj.lt.utils.sys;

import com.hdkj.lt.core.sys.model.po.DicSingle;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description:
 * @Author: wenhao
 * @Create: 2024/06/14 11:00
 * @Version: 1.0
 */
public final class DictUtils {

    private DictUtils() {
    }

    public static String valueToLabel(List<DicSingle> dictList, String value) {
        List<DicSingle> dictSingleList = dictList.stream().filter(e -> StringUtils.equals(e.getValue(), value)).collect(Collectors.toList());
        if (dictSingleList.size() > 0) {
            return dictSingleList.get(0).getLabel();
        }
        return null;
    }

}
