/**
 * @filename:PurchaseOrderInvoiceCommodityServiceImpl 2024-09-21
 * @project KJT v1.0.0 Copyright(c) 2024 wanglang Co. Ltd. All right reserved.
 */
package com.trade.service.trade.purchaseorder.service.impl;

import com.trade.service.trade.purchaseorder.domain.PurchaseOrderInvoiceCommodity;
import com.trade.service.trade.purchaseorder.dto.InvoiceCommodityDto;
import com.trade.service.trade.purchaseorder.mapper.PurchaseOrderInvoiceCommodityMapper;
import com.trade.service.trade.purchaseorder.service.PurchaseOrderInvoiceCommodityService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description:采购订单发票商品信息服务实现
 * @version: v1.0.0
 * @author: wanglang
 */
@Service
public class PurchaseOrderInvoiceCommodityServiceImpl extends ServiceImpl<PurchaseOrderInvoiceCommodityMapper, PurchaseOrderInvoiceCommodity> implements PurchaseOrderInvoiceCommodityService {

    @Override
    public List<PurchaseOrderInvoiceCommodity> getInvoiceCommodityByInvoiceId(Long invoiceId,
            List<String> commodityCodes) {
        return this.lambdaQuery().eq(PurchaseOrderInvoiceCommodity::getInvoiceId, invoiceId)
                .in(PurchaseOrderInvoiceCommodity::getCommodityCode, commodityCodes)
                .eq(PurchaseOrderInvoiceCommodity::getDeleted, 0).list();
    }

    @Override
    public List<InvoiceCommodityDto> getByInvoiceId(Long invoiceId) {
        return this.baseMapper.selectByInvoiceId(invoiceId);
    }

    @Override
    public List<PurchaseOrderInvoiceCommodity> getInvoiceCommodityByLineNumbers(Long invoiceId,
            List<String> lineNumbers) {
        return this.lambdaQuery().eq(PurchaseOrderInvoiceCommodity::getInvoiceId, invoiceId)
                .eq(PurchaseOrderInvoiceCommodity::getDeleted, 0)
                .in(PurchaseOrderInvoiceCommodity::getLineNumber, lineNumbers).list();
    }

    @Override
    public List<PurchaseOrderInvoiceCommodity> getInfoByInvoiceId(Long invoiceId) {
        return this.baseMapper.selectInfoByInvoiceId(invoiceId);
    }
}
