package com.brilliance.isc.transfer.transaction;


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

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

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

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

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

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

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