package com.brilliance.isc.transfer.transaction;


import com.brilliance.isc.bo.lg.NcdinfBo;
import com.brilliance.isc.transfer.IBaseStructMapper;
import com.brilliance.isc.transfer.model.*;
import com.brilliance.isc.vo.lg.NcdinfVo;
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 NcdinfStructMapper extends IBaseStructMapper<NcdinfBo, NcdinfVo> {

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

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

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

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

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