package com.fizz.business.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fizz.business.domain.ProMatmap;
import com.fizz.business.dto.MatmapDTO;
import com.fizz.business.mapper.ProMatmapMapper;
import com.fizz.business.service.ProMatmapService;
import com.fizz.business.utils.MatmapUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ProMatmapServiceImpl extends ServiceImpl<ProMatmapMapper, ProMatmap> implements ProMatmapService {

    @Resource
    private ProMatmapMapper proMatmapMapper;


    @Override
    public void updateMatid(String matid) {
        proMatmapMapper.updateMatidByDisplayName(matid);
    }


    /**
     * 刷新matmap表
     */
    @Override
    public void flushMatmap() {
        List<MatmapDTO> list = MatmapUtil.getMatmapList();
        if (CollUtil.isEmpty(list)) return;
        proMatmapMapper.flushMatmap(list);
    }


}