package com.lantone.qc.dbanaly.lt.facade;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lantone.qc.dbanaly.lt.entity.LibraryInfo;
import com.lantone.qc.dbanaly.lt.service.impl.LibraryInfoServiceImpl;
import org.springframework.stereotype.Component;

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

/**
 * @Description:
 * @author: rengb
 * @time: 2020/7/17 11:26
 */
@Component
public class LibraryInfoFacade extends LibraryInfoServiceImpl {

    public Map<Long, Map<String, Long>> getConceptIdInfo() {
        QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<>();
        libraryInfoQe.eq("is_deleted", "N");
        libraryInfoQe.select("name", "concept_id", "type_id");
        Map<Long, Map<String, Long>> ret = list(libraryInfoQe)
                .stream()
                .collect(Collectors.groupingBy(i -> i.getTypeId(), Collectors.toMap(LibraryInfo::getName, i -> i.getConceptId())));
        return ret;
    }

}