package com.brilliance.isc.transfer.transaction;


import com.brilliance.isc.bo.lg.ConresBo;
import com.brilliance.isc.transfer.IBaseStructMapper;
import com.brilliance.isc.transfer.model.*;
import com.brilliance.isc.vo.lg.ConresVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;


/**
 * Conres Bo、Vo之间的转换处理类。如果有很复杂的函数，则可以用适配器模式重写
 */
@Mapper(componentModel = "spring",uses = {
        IGctMapper.class, IGitMapper.class,
        INitMapper.class, INctMapper.class, IOtherModMapper.class}
        )
public interface ConresStructMapper extends IBaseStructMapper<ConresBo, ConresVo> {

    /**
     * 此行语句一定要写，StructMapper需要
     */
    ConresStructMapper INSTANCE = Mappers.getMapper(ConresStructMapper.class);

    /**
     * Vo转为Bo
     *
     * @param vo
     * @return 返回业务Bo
     */
    @Override
    ConresBo voTransferToBo(ConresVo vo);

    /**
     * Vo追加更新至Bo
     * 忽略oldgrp的复制
     * @param vo
     * @param bo
     */
    @Override
    @Mappings({
//            @Mapping(target = "oldgidgrp",ignore = true)
    })
    void voUpdateToBo(ConresVo vo, @MappingTarget ConresBo bo);

    /**
     * Bo转为Vo
     *
     * @param bo
     * @return 返回Vo
     */
    @Override
    ConresVo boTransferToVo(ConresBo bo);

    /**
     * bo追加更新至Bo
     *
     * @param bo
     * @param vo
     */
    @Override
    void boUpdateToVo(ConresBo bo, @MappingTarget ConresVo vo);
}
