package com.ningdatech.pmapi.expert.assembler;

import cn.hutool.core.collection.CollectionUtil;
import com.ningdatech.pmapi.expert.model.TagFieldInfo;
import com.ningdatech.pmapi.meta.model.entity.ExpertTag;

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

/**
 * @author liuxinxin
 * @date 2022/7/25 下午4:30
 */

public class TagAssembler {

    public static List<TagFieldInfo> toTagFieldInfoList(List<ExpertTag> expertTagList) {
        if (CollectionUtil.isEmpty(expertTagList)) {
            return new ArrayList<>();
        }
        return expertTagList.stream().map(r -> {
            TagFieldInfo dictionaryFieldInfo = new TagFieldInfo();
            dictionaryFieldInfo.setTagFieldName(r.getExpertInfoField());
            dictionaryFieldInfo.setTagCode(r.getTagCode());
            return dictionaryFieldInfo;
        }).collect(Collectors.toList());
    }
}
