package com.ankaibei.workFlow.common.online.model;

import com.ankaibei.workFlow.common.online.model.OnlineDatasourceRelation.OnlineDatasourceRelationModelMapper;
import com.ankaibei.workFlow.common.online.vo.OnlineDatasourceRelationVo;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2023-05-08T14:15:47+0800",
    comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_144 (Oracle Corporation)"
)
public class OnlineDatasourceRelation$OnlineDatasourceRelationModelMapperImpl implements OnlineDatasourceRelationModelMapper {

    @Override
    public List<OnlineDatasourceRelationVo> fromModelList(List<OnlineDatasourceRelation> arg0) {
        if ( arg0 == null ) {
            return null;
        }

        List<OnlineDatasourceRelationVo> list = new ArrayList<OnlineDatasourceRelationVo>( arg0.size() );
        for ( OnlineDatasourceRelation onlineDatasourceRelation : arg0 ) {
            list.add( fromModel( onlineDatasourceRelation ) );
        }

        return list;
    }

    @Override
    public List<OnlineDatasourceRelation> toModelList(List<OnlineDatasourceRelationVo> arg0) {
        if ( arg0 == null ) {
            return null;
        }

        List<OnlineDatasourceRelation> list = new ArrayList<OnlineDatasourceRelation>( arg0.size() );
        for ( OnlineDatasourceRelationVo onlineDatasourceRelationVo : arg0 ) {
            list.add( toModel( onlineDatasourceRelationVo ) );
        }

        return list;
    }

    @Override
    public OnlineDatasourceRelation toModel(OnlineDatasourceRelationVo onlineDatasourceRelationVo) {
        if ( onlineDatasourceRelationVo == null ) {
            return null;
        }

        OnlineDatasourceRelation onlineDatasourceRelation = new OnlineDatasourceRelation();

        onlineDatasourceRelation.setRelationId( onlineDatasourceRelationVo.getRelationId() );
        onlineDatasourceRelation.setRelationName( onlineDatasourceRelationVo.getRelationName() );
        onlineDatasourceRelation.setVariableName( onlineDatasourceRelationVo.getVariableName() );
        onlineDatasourceRelation.setDatasourceId( onlineDatasourceRelationVo.getDatasourceId() );
        onlineDatasourceRelation.setRelationType( onlineDatasourceRelationVo.getRelationType() );
        onlineDatasourceRelation.setMasterColumnId( onlineDatasourceRelationVo.getMasterColumnId() );
        onlineDatasourceRelation.setSlaveTableId( onlineDatasourceRelationVo.getSlaveTableId() );
        onlineDatasourceRelation.setSlaveColumnId( onlineDatasourceRelationVo.getSlaveColumnId() );
        onlineDatasourceRelation.setCascadeDelete( onlineDatasourceRelationVo.getCascadeDelete() );
        onlineDatasourceRelation.setLeftJoin( onlineDatasourceRelationVo.getLeftJoin() );
        onlineDatasourceRelation.setUpdateTime( onlineDatasourceRelationVo.getUpdateTime() );
        onlineDatasourceRelation.setCreateTime( onlineDatasourceRelationVo.getCreateTime() );
        onlineDatasourceRelation.setMasterColumnIdDictMap( mapToMap( onlineDatasourceRelationVo.getMasterColumnIdDictMap() ) );
        onlineDatasourceRelation.setSlaveTableIdDictMap( mapToMap( onlineDatasourceRelationVo.getSlaveTableIdDictMap() ) );
        onlineDatasourceRelation.setSlaveColumnIdDictMap( mapToMap( onlineDatasourceRelationVo.getSlaveColumnIdDictMap() ) );
        onlineDatasourceRelation.setRelationTypeDictMap( mapToMap( onlineDatasourceRelationVo.getRelationTypeDictMap() ) );

        onlineDatasourceRelation.setMasterColumn( mapToBean(onlineDatasourceRelationVo.getMasterColumn(), com.ankaibei.workFlow.common.online.model.OnlineColumn.class) );
        onlineDatasourceRelation.setSlaveTable( mapToBean(onlineDatasourceRelationVo.getSlaveTable(), com.ankaibei.workFlow.common.online.model.OnlineTable.class) );
        onlineDatasourceRelation.setSlaveColumn( mapToBean(onlineDatasourceRelationVo.getSlaveColumn(), com.ankaibei.workFlow.common.online.model.OnlineColumn.class) );

        return onlineDatasourceRelation;
    }

    @Override
    public OnlineDatasourceRelationVo fromModel(OnlineDatasourceRelation onlineDatasourceRelation) {
        if ( onlineDatasourceRelation == null ) {
            return null;
        }

        OnlineDatasourceRelationVo onlineDatasourceRelationVo = new OnlineDatasourceRelationVo();

        onlineDatasourceRelationVo.setRelationId( onlineDatasourceRelation.getRelationId() );
        onlineDatasourceRelationVo.setRelationName( onlineDatasourceRelation.getRelationName() );
        onlineDatasourceRelationVo.setVariableName( onlineDatasourceRelation.getVariableName() );
        onlineDatasourceRelationVo.setDatasourceId( onlineDatasourceRelation.getDatasourceId() );
        onlineDatasourceRelationVo.setRelationType( onlineDatasourceRelation.getRelationType() );
        onlineDatasourceRelationVo.setMasterColumnId( onlineDatasourceRelation.getMasterColumnId() );
        onlineDatasourceRelationVo.setSlaveTableId( onlineDatasourceRelation.getSlaveTableId() );
        onlineDatasourceRelationVo.setSlaveColumnId( onlineDatasourceRelation.getSlaveColumnId() );
        onlineDatasourceRelationVo.setCascadeDelete( onlineDatasourceRelation.getCascadeDelete() );
        onlineDatasourceRelationVo.setLeftJoin( onlineDatasourceRelation.getLeftJoin() );
        onlineDatasourceRelationVo.setUpdateTime( onlineDatasourceRelation.getUpdateTime() );
        onlineDatasourceRelationVo.setCreateTime( onlineDatasourceRelation.getCreateTime() );
        onlineDatasourceRelationVo.setMasterColumnIdDictMap( mapToMap( onlineDatasourceRelation.getMasterColumnIdDictMap() ) );
        onlineDatasourceRelationVo.setSlaveTableIdDictMap( mapToMap( onlineDatasourceRelation.getSlaveTableIdDictMap() ) );
        onlineDatasourceRelationVo.setSlaveColumnIdDictMap( mapToMap( onlineDatasourceRelation.getSlaveColumnIdDictMap() ) );
        onlineDatasourceRelationVo.setRelationTypeDictMap( mapToMap( onlineDatasourceRelation.getRelationTypeDictMap() ) );

        onlineDatasourceRelationVo.setMasterColumn( beanToMap(onlineDatasourceRelation.getMasterColumn(), false) );
        onlineDatasourceRelationVo.setSlaveTable( beanToMap(onlineDatasourceRelation.getSlaveTable(), false) );
        onlineDatasourceRelationVo.setSlaveColumn( beanToMap(onlineDatasourceRelation.getSlaveColumn(), false) );

        return onlineDatasourceRelationVo;
    }
}
