package com.nantian.cloud.jljc.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nantian.cloud.jljc.entity.EnergyInfo;
import com.nantian.cloud.jljc.mapper.EnergyInfoMapper;
import com.nantian.cloud.jljc.service.EnergyInfoService;
import com.nantian.cloud.jljc.vo.EnergyInfoTreeVo;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import static com.nantian.cloud.jljc.vo.util.TreeVoUtil.findTree;

/**
 * <p>
 * 能源信息 服务实现类
 * </p>
 *
 * @author stz
 * @since 2020-08-05
 */
@Service("energyInfoService")
public class EnergyInfoServiceImpl extends ServiceImpl<EnergyInfoMapper, EnergyInfo> implements EnergyInfoService {

    @Override
    public List<EnergyInfo> getInfoByStr(String energyTypeStr) {
        String[] list = energyTypeStr.split(",");
        return   baseMapper.getInfoByStr(list);
    }

    @Override
    public List<EnergyInfoTreeVo> getEnergyInfoTree() {
        List<EnergyInfoTreeVo>  treeVos = baseMapper.getEnergyInfoTree();
        return findTree(treeVos);
    }

    @Override
    public IPage<EnergyInfo> getPageScope(Page page, EnergyInfo energyInfo) {
        //return baseMapper.getPageScope(page,energyInfo,new DataScope());
        return baseMapper.getPageScope(page,energyInfo);
    }

    @Override
    public List<String> getCodeByPid() {
        return baseMapper.getCodeByPid();
    }

    @Override
    public List<EnergyInfo> energyListAndChild() {
        return baseMapper.energyListAndChild();
    }
    @Override
    public List<EnergyInfo> energyCodeList() {
        return baseMapper.energyCodeList();
    }
    @Override
    public List<Map<String,Object>> getEnergyInfoList() {
        return baseMapper.getEnergyInfoList();
    }
}

