package com.trade.service.sales.service.impl;

import com.trade.common.utils.bean.BeanCopyUtils;
import com.trade.service.sales.domain.ContractTerms;
import com.trade.service.sales.domain.SalesCommodity;
import com.trade.service.sales.domain.SalesContract;
import com.trade.service.sales.dto.ContractTermsDto;
import com.trade.service.sales.dto.SalesCommodityDto;
import com.trade.service.sales.dto.SalesContractDto;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @description: 销售相关数据转换
 * @Author: wanglang
 * @Date: 2024/9/3 14:17
 * @Version: 1.0
 */
@Component
public class SalesDataConverter {

    public SalesCommodity convertCommodityDo(SalesCommodityDto salesCommodityDto) {
        return BeanCopyUtils.copy(salesCommodityDto, SalesCommodity.class);
    }

    public List<SalesCommodity> convertCommodityDo(List<SalesCommodityDto> salesCommodityDtos) {
        return BeanCopyUtils.copyList(salesCommodityDtos, SalesCommodity.class);
    }

    public SalesCommodityDto convertCommodityDto(SalesCommodity salesCommodity) {
        return BeanCopyUtils.copy(salesCommodity, SalesCommodityDto.class);
    }

    public List<SalesCommodityDto> convertCommodityDto(List<SalesCommodity> salesCommodities) {
        return BeanCopyUtils.copyList(salesCommodities, SalesCommodityDto.class);
    }

    public SalesContract convertSalesContractDo(SalesContractDto salesContractDto) {
        return BeanCopyUtils.copy(salesContractDto, SalesContract.class);
    }

    public SalesContractDto convertSalesContractDto(SalesContract salesContract) {
        return BeanCopyUtils.copy(salesContract, SalesContractDto.class);
    }

    public ContractTerms convertContractTermsDo(ContractTermsDto contractTermsDto) {
        return BeanCopyUtils.copy(contractTermsDto, ContractTerms.class);
    }

    public ContractTermsDto convertContractTermsDto(ContractTerms contractTerms) {
        return BeanCopyUtils.copy(contractTerms, ContractTermsDto.class);
    }
}
