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

import com.xunhong.erp.turbo.api.biz.dto.cmd.CostItemCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CostItemUpdateCmd;
import com.xunhong.erp.turbo.biz.domain.entity.CostItem;
import com.xunhong.erp.turbo.biz.infrastructure.entity.CostItemDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValueCheckStrategy;

/**
 * @author shenyifei
 */
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface CostItemConvert {

	CostItem toCostItem(CostItemDO costItemDO);

	@Mapping(target = "sort", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	CostItemDO toCostItemDO(CostItemCreateCmd costItemCreateCmd);

	@Mapping(target = "sort", ignore = true)
	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	void toCostItemDO(@MappingTarget CostItemDO costItemDO, CostItemUpdateCmd costItemUpdateCmd);
}

