package com.ningdatech.pmapi.meta.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.meta.assembler.MetaTagAssembler;
import com.ningdatech.pmapi.meta.model.entity.MetaTag;
import com.ningdatech.pmapi.meta.mapper.MetaTagMapper;
import com.ningdatech.pmapi.meta.model.dto.TagDTO;
import com.ningdatech.pmapi.meta.service.IMetaTagService;
import org.springframework.stereotype.Service;

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

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Liuxinxin
 * @since 2023-02-22
 */
@Service
public class MetaTagServiceImpl extends ServiceImpl<MetaTagMapper, MetaTag> implements IMetaTagService {


    @Override
    public List<TagDTO> queryAll() {
        List<MetaTag> allTags = this.lambdaQuery().ne(MetaTag::getId, -1).list();
        List<TagDTO> allTagDTOList = allTags.stream().map(MetaTagAssembler::toTagDTO).collect(Collectors.toList());
        return allTagDTOList;
    }

}
