package com.sw.mes.itemclean.clean.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sw.mes.itemclean.clean.domain.MaterialCleaningBasket;
import com.sw.mes.itemclean.clean.mapper.MaterialCleaningBasketMapper;
import com.sw.mes.itemclean.clean.service.MaterialCleaningBasketService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 清洗花篮 服务实现类
 * </p>
 *
 * @author liuzemin
 * @since 2022-11-10
 */
@Service
public class MaterialCleaningBasketServiceImpl extends ServiceImpl<MaterialCleaningBasketMapper, MaterialCleaningBasket> implements MaterialCleaningBasketService {

    @Override
    public MaterialCleaningBasket findByBasketNoAndCleanId(String basketNo, Integer id) {
        LambdaQueryWrapper<MaterialCleaningBasket> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(MaterialCleaningBasket::getBasketNo, basketNo);
        queryWrapper.eq(MaterialCleaningBasket::getCleanId, id);
        queryWrapper.last("limit 1");
        return getOne(queryWrapper);
    }

    @Override
    public List<MaterialCleaningBasket> findByCleanId(Integer id) {
        LambdaQueryWrapper<MaterialCleaningBasket> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(MaterialCleaningBasket::getCleanId, id);
        return getBaseMapper().selectList(queryWrapper);
    }
}
