package com.xunhong.erp.turbo.biz.infrastructure.convert;

import com.xunhong.erp.turbo.api.biz.dto.common.OrderSupplier;
import com.xunhong.erp.turbo.biz.infrastructure.entity.OrderSupplierDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.NullValueCheckStrategy;

import java.util.List;

/**
 * @author shenyifei
 */
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS, uses = {OrderPackageConvert.class})
public interface OrderSupplierConvert {
	@Mapping(target = "orderPackageDOList", source = "orderPackageList")
	@Mapping(target = "orderSupplierId", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	OrderSupplierDO toOrderSupplierDO(OrderSupplier orderSupplier);

	List<OrderSupplierDO> toOrderSupplierDOList(List<OrderSupplier> orderSupplierList);

	List<OrderSupplier> toOrderSupplierList(List<OrderSupplierDO> orderSupplierDOList);

	@Mapping(target = "createdByName", ignore = true)
	@Mapping(target = "createdBy", ignore = true)
	@Mapping(target = "orderPackageList", source = "orderPackageDOList")
	OrderSupplier toOrderSupplier(OrderSupplierDO orderSupplierDO);
}