package com.jeeplus.test.wdt.merchantCompany.service.mapstuct;

import com.jeeplus.core.mapstruct.TreeWrapper;
import com.jeeplus.test.wdt.merchantCompany.domain.MerchantCompany;
import com.jeeplus.test.wdt.merchantCompany.service.dto.MerchantCompanyDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

/**
 * 入驻商家MAPPER接口
 * @author 刘高峰
 * @version 2024-01-04 10:42
 */
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {} )
public interface MerchantCompanyWrapper extends TreeWrapper<MerchantCompanyDTO, MerchantCompany> {

    MerchantCompanyWrapper INSTANCE = Mappers.getMapper(MerchantCompanyWrapper.class);
    @Mappings({
            @Mapping(source = "createBy.id", target = "createById"),
            @Mapping (source = "updateBy.id", target = "updateById")})
    MerchantCompany toEntity(MerchantCompanyDTO dto);


    @Mappings({
            @Mapping (source = "createById", target = "createBy.id"),
            @Mapping (source = "updateById", target = "updateBy.id")})
    MerchantCompanyDTO toDTO(MerchantCompany entity);
}
