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

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.meta.model.entity.MetaDictionary;
import com.ningdatech.pmapi.meta.mapper.MetaDictionaryMapper;
import com.ningdatech.pmapi.meta.service.IMetaDictionaryService;
import com.ningdatech.pmapi.meta.assembler.MetaDictionaryAssembler;
import com.ningdatech.pmapi.meta.model.dto.DictionaryDTO;
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 MetaDictionaryServiceImpl extends ServiceImpl<MetaDictionaryMapper, MetaDictionary> implements IMetaDictionaryService {

    @Override
    public List<DictionaryDTO> queryAll() {
        List<MetaDictionary> dictionaryList = this.lambdaQuery().ne(MetaDictionary::getId, -1).list();
        List<DictionaryDTO> dictionaryDTOList = dictionaryList.stream().map(MetaDictionaryAssembler::toDictionaryDTO).collect(Collectors.toList());
        return dictionaryDTOList;
    }

}
