package com.jeeplus.sys.service.mapstruct;

import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jeeplus.sys.domain.SysConfig;
import com.jeeplus.sys.domain.vo.SysConfigVo;
import com.jeeplus.sys.service.dto.SysConfigDTO;
import com.jeeplus.sys.service.dto.TenantDTO;
import com.jeeplus.sys.service.dto.UserDTO;
import org.springframework.stereotype.Component;

import javax.annotation.Generated;
import java.util.ArrayList;
import java.util.List;

@Generated(
        value = "org.mapstruct.ap.MappingProcessor",
        date = "2022-08-18T16:46:54+0800",
        comments = "version: 1.4.1.Final, compiler: javac, environment: Java 1.8.0_221 (Oracle Corporation)"
)
@Component
public class SysConfigWrapperImpl implements SysConfigWrapper {

    @Override
    public SysConfig toEntity(SysConfigDTO arg0) {
        if ( arg0 == null ) {
            return null;
        }

        SysConfig sysConfig = new SysConfig ( );

        sysConfig.setTenantId ( arg0TenantDTOId ( arg0 ) );
        sysConfig.setCreateById ( arg0CreateById ( arg0 ) );
        sysConfig.setUpdateById ( arg0UpdateById ( arg0 ) );
        sysConfig.setId ( arg0.getId ( ) );
        sysConfig.setCreateTime ( arg0.getCreateTime ( ) );
        sysConfig.setUpdateTime ( arg0.getUpdateTime ( ) );
        sysConfig.setDelFlag ( arg0.getDelFlag ( ) );
        sysConfig.setSmtp ( arg0.getSmtp ( ) );
        sysConfig.setPort ( arg0.getPort ( ) );
        sysConfig.setMailName ( arg0.getMailName ( ) );
        sysConfig.setMailPassword ( arg0.getMailPassword ( ) );
        sysConfig.setAccessKeyId ( arg0.getAccessKeyId ( ) );
        sysConfig.setAccessKeySecret ( arg0.getAccessKeySecret ( ) );
        sysConfig.setSignature ( arg0.getSignature ( ) );
        sysConfig.setTemplateCode ( arg0.getTemplateCode ( ) );
        sysConfig.setDefaultTheme ( arg0.getDefaultTheme ( ) );
        sysConfig.setDefaultLayout ( arg0.getDefaultLayout ( ) );
        sysConfig.setProductName ( arg0.getProductName ( ) );
        sysConfig.setLogo ( arg0.getLogo ( ) );
        sysConfig.setHomeUrl ( arg0.getHomeUrl ( ) );
        sysConfig.setMultiAccountLogin ( arg0.getMultiAccountLogin ( ) );
        sysConfig.setSingleLoginType ( arg0.getSingleLoginType ( ) );
        sysConfig.setRemarks ( arg0.getRemarks ( ) );

        return sysConfig;
    }

    @Override
    public SysConfigDTO toDTO(SysConfig arg0) {
        if ( arg0 == null ) {
            return null;
        }

        SysConfigDTO sysConfigDTO = new SysConfigDTO ( );

        sysConfigDTO.setTenantDTO ( sysConfigToTenantDTO ( arg0 ) );
        sysConfigDTO.setCreateBy ( sysConfigToUserDTO ( arg0 ) );
        sysConfigDTO.setUpdateBy ( sysConfigToUserDTO1 ( arg0 ) );
        sysConfigDTO.setId ( arg0.getId ( ) );
        sysConfigDTO.setCreateTime ( arg0.getCreateTime ( ) );
        sysConfigDTO.setUpdateTime ( arg0.getUpdateTime ( ) );
        sysConfigDTO.setDelFlag ( arg0.getDelFlag ( ) );
        sysConfigDTO.setSmtp ( arg0.getSmtp ( ) );
        sysConfigDTO.setPort ( arg0.getPort ( ) );
        sysConfigDTO.setMailName ( arg0.getMailName ( ) );
        sysConfigDTO.setMailPassword ( arg0.getMailPassword ( ) );
        sysConfigDTO.setAccessKeyId ( arg0.getAccessKeyId ( ) );
        sysConfigDTO.setAccessKeySecret ( arg0.getAccessKeySecret ( ) );
        sysConfigDTO.setSignature ( arg0.getSignature ( ) );
        sysConfigDTO.setTemplateCode ( arg0.getTemplateCode ( ) );
        sysConfigDTO.setDefaultTheme ( arg0.getDefaultTheme ( ) );
        sysConfigDTO.setDefaultLayout ( arg0.getDefaultLayout ( ) );
        sysConfigDTO.setProductName ( arg0.getProductName ( ) );
        sysConfigDTO.setLogo ( arg0.getLogo ( ) );
        sysConfigDTO.setHomeUrl ( arg0.getHomeUrl ( ) );
        sysConfigDTO.setMultiAccountLogin ( arg0.getMultiAccountLogin ( ) );
        sysConfigDTO.setSingleLoginType ( arg0.getSingleLoginType ( ) );
        sysConfigDTO.setRemarks ( arg0.getRemarks ( ) );

        return sysConfigDTO;
    }

    @Override
    public List <SysConfig> toEntity(List <SysConfigDTO> arg0) {
        if ( arg0 == null ) {
            return null;
        }

        List <SysConfig> list = new ArrayList <SysConfig> ( arg0.size ( ) );
        for (SysConfigDTO sysConfigDTO : arg0) {
            list.add ( toEntity ( sysConfigDTO ) );
        }

        return list;
    }

    @Override
    public List <SysConfigDTO> toDTO(List <SysConfig> arg0) {
        if ( arg0 == null ) {
            return null;
        }

        List <SysConfigDTO> list = new ArrayList <SysConfigDTO> ( arg0.size ( ) );
        for (SysConfig sysConfig : arg0) {
            list.add ( toDTO ( sysConfig ) );
        }

        return list;
    }

    @Override
    public Page <SysConfig> toEntity(Page <SysConfigDTO> arg0) {
        if ( arg0 == null ) {
            return null;
        }

        Page <SysConfig> page = new Page <SysConfig> ( );

        page.setPages ( arg0.getPages ( ) );
        page.setRecords ( toEntity ( arg0.getRecords ( ) ) );
        page.setTotal ( arg0.getTotal ( ) );
        page.setSize ( arg0.getSize ( ) );
        page.setCurrent ( arg0.getCurrent ( ) );
        page.setSearchCount ( arg0.isSearchCount ( ) );
        page.setOptimizeCountSql ( arg0.isOptimizeCountSql ( ) );
        page.setHitCount ( arg0.isHitCount ( ) );
        List <OrderItem> list1 = arg0.getOrders ( );
        if ( list1 != null ) {
            page.setOrders ( new ArrayList <OrderItem> ( list1 ) );
        }
        page.setCountId ( arg0.getCountId ( ) );
        page.setMaxLimit ( arg0.getMaxLimit ( ) );

        return page;
    }

    @Override
    public Page <SysConfigDTO> toDTO(Page <SysConfig> arg0) {
        if ( arg0 == null ) {
            return null;
        }

        Page <SysConfigDTO> page = new Page <SysConfigDTO> ( );

        page.setPages ( arg0.getPages ( ) );
        page.setRecords ( toDTO ( arg0.getRecords ( ) ) );
        page.setTotal ( arg0.getTotal ( ) );
        page.setSize ( arg0.getSize ( ) );
        page.setCurrent ( arg0.getCurrent ( ) );
        page.setSearchCount ( arg0.isSearchCount ( ) );
        page.setOptimizeCountSql ( arg0.isOptimizeCountSql ( ) );
        page.setHitCount ( arg0.isHitCount ( ) );
        List <OrderItem> list1 = arg0.getOrders ( );
        if ( list1 != null ) {
            page.setOrders ( new ArrayList <OrderItem> ( list1 ) );
        }
        page.setCountId ( arg0.getCountId ( ) );
        page.setMaxLimit ( arg0.getMaxLimit ( ) );

        return page;
    }

    @Override
    public SysConfigVo toVo(SysConfig sysConfig) {
        if ( sysConfig == null ) {
            return null;
        }

        SysConfigVo sysConfigVo = new SysConfigVo ( );

        sysConfigVo.setDefaultTheme ( sysConfig.getDefaultTheme ( ) );
        sysConfigVo.setDefaultLayout ( sysConfig.getDefaultLayout ( ) );
        sysConfigVo.setProductName ( sysConfig.getProductName ( ) );
        sysConfigVo.setLogo ( sysConfig.getLogo ( ) );

        return sysConfigVo;
    }

    private String arg0TenantDTOId(SysConfigDTO sysConfigDTO) {
        if ( sysConfigDTO == null ) {
            return null;
        }
        TenantDTO tenantDTO = sysConfigDTO.getTenantDTO ( );
        if ( tenantDTO == null ) {
            return null;
        }
        String id = tenantDTO.getId ( );
        if ( id == null ) {
            return null;
        }
        return id;
    }

    private String arg0CreateById(SysConfigDTO sysConfigDTO) {
        if ( sysConfigDTO == null ) {
            return null;
        }
        UserDTO createBy = sysConfigDTO.getCreateBy ( );
        if ( createBy == null ) {
            return null;
        }
        String id = createBy.getId ( );
        if ( id == null ) {
            return null;
        }
        return id;
    }

    private String arg0UpdateById(SysConfigDTO sysConfigDTO) {
        if ( sysConfigDTO == null ) {
            return null;
        }
        UserDTO updateBy = sysConfigDTO.getUpdateBy ( );
        if ( updateBy == null ) {
            return null;
        }
        String id = updateBy.getId ( );
        if ( id == null ) {
            return null;
        }
        return id;
    }

    protected TenantDTO sysConfigToTenantDTO(SysConfig sysConfig) {
        if ( sysConfig == null ) {
            return null;
        }

        TenantDTO tenantDTO = new TenantDTO ( );

        tenantDTO.setId ( sysConfig.getTenantId ( ) );

        return tenantDTO;
    }

    protected UserDTO sysConfigToUserDTO(SysConfig sysConfig) {
        if ( sysConfig == null ) {
            return null;
        }

        UserDTO userDTO = new UserDTO ( );

        userDTO.setId ( sysConfig.getCreateById ( ) );

        return userDTO;
    }

    protected UserDTO sysConfigToUserDTO1(SysConfig sysConfig) {
        if ( sysConfig == null ) {
            return null;
        }

        UserDTO userDTO = new UserDTO ( );

        userDTO.setId ( sysConfig.getUpdateById ( ) );

        return userDTO;
    }
}
