package com.engine.organization.transmethod;

import com.engine.organization.entity.DeleteParam;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.util.db.MapperProxyFactory;

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

/**
 * @description:
 * @author:dxfeng
 * @createTime: 2022/05/25
 * @version: 1.0
 */
public class CompTransMethod {

    public static String getSpanById(String planId) {
        CompMapper compMapper = MapperProxyFactory.getProxy(CompMapper.class);
        List<Map<String, Object>> maps = compMapper.listCompsByIds(DeleteParam.builder().ids(planId).build().getIds());
        String names = maps.stream().map(item -> (String) item.get("name")).collect(Collectors.joining(","));
        return names;
    }
}
