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

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sw.mes.itemclean.clean.domain.CleanReworking;
import com.sw.mes.itemclean.clean.mapper.CleanReworkingDetailMapper;
import com.sw.mes.itemclean.clean.mapper.CleanReworkingMapper;
import com.sw.mes.itemclean.clean.service.CleanReworkingService;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CleanReworkingServiceImpl extends ServiceImpl<CleanReworkingMapper, CleanReworking> implements CleanReworkingService {

    @Autowired
    private CleanReworkingMapper materialReworkingMapper;

    @Autowired
    private CleanReworkingDetailMapper materialReworkingDetailMapper;

    @Autowired
    ModelMapper modelMapper;


    @Override
    public CleanReworking getByBatchNo(String batchNo) {
        LambdaQueryWrapper<CleanReworking> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(CleanReworking::getProductBatchNo, batchNo);
        queryWrapper.last("limit 1");
        return getOne(queryWrapper);
    }
}
