package com.ai.da.service.impl;

import com.ai.da.mapper.primary.ColorLoopUpTableMapper;
import com.ai.da.mapper.primary.entity.ColorLookupTable;
import com.ai.da.service.ColorLoopUpTableService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

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

@Service
public class ColorLoopUpTableServiceImpl extends ServiceImpl<ColorLoopUpTableMapper, ColorLookupTable> implements ColorLoopUpTableService {

    @Resource
    private ColorLoopUpTableMapper colorLoopUpTableMapper;

    @Override
    public ColorLookupTable getByColorValue(Integer colorValue) {
        QueryWrapper<ColorLookupTable> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("color_value", colorValue);
        return colorLoopUpTableMapper.selectOne(queryWrapper);
    }

    @Override
    public List<ColorLookupTable> getByColorValueList(List<Integer> colorValues) {
        QueryWrapper<ColorLookupTable> queryWrapper = new QueryWrapper<>();
        queryWrapper.in("color_value", colorValues);
        return colorLoopUpTableMapper.selectList(queryWrapper);
    }
}
