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

import com.ankaibei.workFlow.webadmin.ankaibei.entity.UserInfoEntity;
import com.ankaibei.workFlow.webadmin.upms.model.SysDept.SysDeptModelMapper;
import com.ankaibei.workFlow.webadmin.upms.vo.SysDeptVo;
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 SysDept$SysDeptModelMapperImpl implements SysDeptModelMapper {

    @Override
    public SysDeptVo fromModel(SysDept arg0) {
        if ( arg0 == null ) {
            return null;
        }

        SysDeptVo sysDeptVo = new SysDeptVo();

        sysDeptVo.setDeptId( arg0.getDeptId() );
        sysDeptVo.setDeptName( arg0.getDeptName() );
        sysDeptVo.setShowOrder( arg0.getShowOrder() );
        sysDeptVo.setParentId( arg0.getParentId() );
        sysDeptVo.setCreateUserId( arg0.getCreateUserId() );
        sysDeptVo.setUpdateUserId( arg0.getUpdateUserId() );
        sysDeptVo.setCreateTime( arg0.getCreateTime() );
        sysDeptVo.setUpdateTime( arg0.getUpdateTime() );
        sysDeptVo.setUserList( userInfoEntityListToSysUserList( arg0.getUserList() ) );

        return sysDeptVo;
    }

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

        List<SysDeptVo> list = new ArrayList<SysDeptVo>( arg0.size() );
        for ( SysDept sysDept : arg0 ) {
            list.add( fromModel( sysDept ) );
        }

        return list;
    }

    @Override
    public SysDept toModel(SysDeptVo arg0) {
        if ( arg0 == null ) {
            return null;
        }

        SysDept sysDept = new SysDept();

        sysDept.setDeptId( arg0.getDeptId() );
        sysDept.setDeptName( arg0.getDeptName() );
        sysDept.setShowOrder( arg0.getShowOrder() );
        sysDept.setParentId( arg0.getParentId() );
        sysDept.setCreateUserId( arg0.getCreateUserId() );
        sysDept.setUpdateUserId( arg0.getUpdateUserId() );
        sysDept.setCreateTime( arg0.getCreateTime() );
        sysDept.setUpdateTime( arg0.getUpdateTime() );
        sysDept.setUserList( sysUserListToUserInfoEntityList( arg0.getUserList() ) );

        return sysDept;
    }

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

        List<SysDept> list = new ArrayList<SysDept>( arg0.size() );
        for ( SysDeptVo sysDeptVo : arg0 ) {
            list.add( toModel( sysDeptVo ) );
        }

        return list;
    }

    protected SysUser userInfoEntityToSysUser(UserInfoEntity userInfoEntity) {
        if ( userInfoEntity == null ) {
            return null;
        }

        SysUser sysUser = new SysUser();

        sysUser.setUserId( userInfoEntity.getUserId() );
        sysUser.setLoginName( userInfoEntity.getLoginName() );
        sysUser.setPassword( userInfoEntity.getPassword() );
        sysUser.setShowName( userInfoEntity.getShowName() );
        sysUser.setDeptId( userInfoEntity.getDeptId() );
        sysUser.setUserType( userInfoEntity.getUserType() );
        sysUser.setHeadImageUrl( userInfoEntity.getHeadImageUrl() );
        sysUser.setUserStatus( userInfoEntity.getUserStatus() );
        sysUser.setEmail( userInfoEntity.getEmail() );
        sysUser.setMobile( userInfoEntity.getMobile() );
        sysUser.setDeletedFlag( userInfoEntity.getDeletedFlag() );
        sysUser.setCreateUserId( userInfoEntity.getCreateUserId() );
        sysUser.setUpdateUserId( userInfoEntity.getUpdateUserId() );
        sysUser.setCreateTime( userInfoEntity.getCreateTime() );
        sysUser.setUpdateTime( userInfoEntity.getUpdateTime() );
        sysUser.setRegion( userInfoEntity.getRegion() );
        sysUser.setJobNumber( userInfoEntity.getJobNumber() );

        return sysUser;
    }

    protected List<SysUser> userInfoEntityListToSysUserList(List<UserInfoEntity> list) {
        if ( list == null ) {
            return null;
        }

        List<SysUser> list1 = new ArrayList<SysUser>( list.size() );
        for ( UserInfoEntity userInfoEntity : list ) {
            list1.add( userInfoEntityToSysUser( userInfoEntity ) );
        }

        return list1;
    }

    protected UserInfoEntity sysUserToUserInfoEntity(SysUser sysUser) {
        if ( sysUser == null ) {
            return null;
        }

        UserInfoEntity userInfoEntity = new UserInfoEntity();

        userInfoEntity.setUserId( sysUser.getUserId() );
        userInfoEntity.setLoginName( sysUser.getLoginName() );
        userInfoEntity.setPassword( sysUser.getPassword() );
        userInfoEntity.setShowName( sysUser.getShowName() );
        if ( sysUser.getDeptId() != null ) {
            userInfoEntity.setDeptId( sysUser.getDeptId() );
        }
        userInfoEntity.setHeadImageUrl( sysUser.getHeadImageUrl() );
        if ( sysUser.getUserType() != null ) {
            userInfoEntity.setUserType( sysUser.getUserType() );
        }
        if ( sysUser.getUserStatus() != null ) {
            userInfoEntity.setUserStatus( sysUser.getUserStatus() );
        }
        userInfoEntity.setEmail( sysUser.getEmail() );
        userInfoEntity.setMobile( sysUser.getMobile() );
        if ( sysUser.getCreateUserId() != null ) {
            userInfoEntity.setCreateUserId( sysUser.getCreateUserId() );
        }
        userInfoEntity.setCreateTime( sysUser.getCreateTime() );
        if ( sysUser.getUpdateUserId() != null ) {
            userInfoEntity.setUpdateUserId( sysUser.getUpdateUserId() );
        }
        userInfoEntity.setUpdateTime( sysUser.getUpdateTime() );
        if ( sysUser.getDeletedFlag() != null ) {
            userInfoEntity.setDeletedFlag( sysUser.getDeletedFlag() );
        }
        userInfoEntity.setRegion( sysUser.getRegion() );
        userInfoEntity.setJobNumber( sysUser.getJobNumber() );

        return userInfoEntity;
    }

    protected List<UserInfoEntity> sysUserListToUserInfoEntityList(List<SysUser> list) {
        if ( list == null ) {
            return null;
        }

        List<UserInfoEntity> list1 = new ArrayList<UserInfoEntity>( list.size() );
        for ( SysUser sysUser : list ) {
            list1.add( sysUserToUserInfoEntity( sysUser ) );
        }

        return list1;
    }
}
