package com.ankaibei.workFlow.webadmin.upms.model;

import com.ankaibei.workFlow.webadmin.upms.model.SysRole.SysRoleModelMapper;
import com.ankaibei.workFlow.webadmin.upms.vo.SysRoleVo;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;

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

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

        List<SysRoleVo> list = new ArrayList<SysRoleVo>( arg0.size() );
        for ( SysRole sysRole : arg0 ) {
            list.add( fromModel( sysRole ) );
        }

        return list;
    }

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

        List<SysRole> list = new ArrayList<SysRole>( arg0.size() );
        for ( SysRoleVo sysRoleVo : arg0 ) {
            list.add( toModel( sysRoleVo ) );
        }

        return list;
    }

    @Override
    public SysRole toModel(SysRoleVo sysRoleVo) {
        if ( sysRoleVo == null ) {
            return null;
        }

        SysRole sysRole = new SysRole();

        sysRole.setRoleId( sysRoleVo.getRoleId() );
        sysRole.setRoleName( sysRoleVo.getRoleName() );
        sysRole.setCreateUserId( sysRoleVo.getCreateUserId() );
        sysRole.setCreateTime( sysRoleVo.getCreateTime() );
        sysRole.setUpdateUserId( sysRoleVo.getUpdateUserId() );
        sysRole.setUpdateTime( sysRoleVo.getUpdateTime() );

        sysRole.setSysRoleMenuList( mapToBean(sysRoleVo.getSysRoleMenuList(), com.ankaibei.workFlow.webadmin.upms.model.SysRoleMenu.class) );

        return sysRole;
    }

    @Override
    public SysRoleVo fromModel(SysRole sysRole) {
        if ( sysRole == null ) {
            return null;
        }

        SysRoleVo sysRoleVo = new SysRoleVo();

        sysRoleVo.setRoleId( sysRole.getRoleId() );
        sysRoleVo.setRoleName( sysRole.getRoleName() );
        sysRoleVo.setCreateUserId( sysRole.getCreateUserId() );
        sysRoleVo.setCreateTime( sysRole.getCreateTime() );
        sysRoleVo.setUpdateUserId( sysRole.getUpdateUserId() );
        sysRoleVo.setUpdateTime( sysRole.getUpdateTime() );

        sysRoleVo.setSysRoleMenuList( beanToMap(sysRole.getSysRoleMenuList(), false) );

        return sysRoleVo;
    }
}
