package com.jwipc.spe.client.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jwipc.spe.client.QualityManageClient;
import com.jwipc.spe.client.base.dto.QualityManageClientDTO;
import com.jwipc.spe.client.convert.QmNoticeOrderClientConvert;
import com.jwipc.spe.entity.QmNoticeOrder;
import com.jwipc.spe.service.IQmNoticeOrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * <p> </p>
 *
 * @author ZhangJie
 * @version 1.0
 * @since JDK 1.8
 */
@Service
@RequiredArgsConstructor
public class QualityManageClientImpl implements QualityManageClient {
    private final IQmNoticeOrderService qmNoticeOrderService;
    private final QmNoticeOrderClientConvert qmNoticeOrderClientConvert;
    @Override
    public QualityManageClientDTO getQmOrderByCode(String supplierCode, String materialCode) {
        final QmNoticeOrder list = qmNoticeOrderService.getOne(
                new LambdaQueryWrapper<QmNoticeOrder>()
                        .eq(QmNoticeOrder::getSupplierCode, supplierCode)
                        .eq(QmNoticeOrder::getMaterialCode, materialCode)
                        .eq(QmNoticeOrder::getFollowingStatus,1), false);
        return qmNoticeOrderClientConvert.entity2DTO(list);
    }
}
