package com.hz.pm.api.portrait.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hz.pm.api.portrait.model.entity.ProjectTag;
import com.hz.pm.api.portrait.model.entity.Tag;
import com.ningdatech.basic.util.CollUtils;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @Classname ITagService
 * @Description
 * @Date 2023/8/2 10:47
 * @Author PoffyZhang
 */
public interface IProjectTagService extends IService<ProjectTag> {
    /**
     * 获取项目 标签
     * @param projectCode \
     * @return \
     */
    List<Tag> getProjectTas(String projectCode);


    default Map<String, List<ProjectTag>> listByProjectCodes(Collection<String> projectCodes){
        LambdaQueryWrapper<ProjectTag> query = Wrappers.lambdaQuery(ProjectTag.class)
                .in(ProjectTag::getProjectCode, projectCodes);
        return CollUtils.group(list(query), ProjectTag::getProjectCode);
    }

}
