package com.gci.boot.modules.basedata.service.impl;

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

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gci.boot.modules.basedata.entity.TbCustomerFollowTemplatePart;
import com.gci.boot.modules.basedata.mapper.TbCustomerFollowTemplatePartMapper;
import com.gci.boot.modules.basedata.service.ITbCustomerFollowTemplatePartService;

import lombok.extern.slf4j.Slf4j;

/**
 * <p>
 * 客户回放模板详情 服务实现类
 * </p>
 *
 * @author 2464
 * @since 2023-10-11
 */
@Service
@Slf4j
public class TbCustomerFollowTemplatePartServiceImpl extends ServiceImpl<TbCustomerFollowTemplatePartMapper, TbCustomerFollowTemplatePart> implements ITbCustomerFollowTemplatePartService {

	@Override
	public Map<String, TbCustomerFollowTemplatePart> getMapByTemplateId(String templateId) {
		QueryWrapper<TbCustomerFollowTemplatePart> queryWrapper = new QueryWrapper<>();
		queryWrapper.eq("template_id", templateId);
		List<TbCustomerFollowTemplatePart> list = this.list(queryWrapper);
		Map<String,TbCustomerFollowTemplatePart> map = list.stream().collect(Collectors.toMap(TbCustomerFollowTemplatePart::getId,Function.identity()));
		return map;
	}
	
}
