package com.chaozhanggui.admin.system.util;

import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.dao.system.entity.DTO.AccountDTO;
import com.chaozhanggui.dao.system.entity.TbPlussAccount;

public class Converter {
    public static TbPlussAccount toEntity(AccountDTO accountDTO) {
        if ( accountDTO == null ) {
            return null;
        }

        TbPlussAccount account = new TbPlussAccount();

        account.setId( accountDTO.getId() );
        account.setUserid( accountDTO.getUserid() );
        account.setCertificateurl( accountDTO.getCertificateurl() );
        account.setSettletype( accountDTO.getSettletype() );
        account.setIdcardid( accountDTO.getIdcardid() );
        account.setBankcardid( accountDTO.getBankcardid() );
        account.setChanneltype( accountDTO.getChanneltype() );
        account.setCreatetime( accountDTO.getCreatetime() );
        account.setCreateTimeStart( accountDTO.getCreateTimeStart() );
        account.setCreateTimeEnd( accountDTO.getCreateTimeEnd() );
        account.setUpdatetime( accountDTO.getUpdatetime() );
        account.setUpdateTimeStart( accountDTO.getUpdateTimeStart() );
        account.setUpdateTimeEnd( accountDTO.getUpdateTimeEnd() );
        String jSONObject = accountDTO.getBak();
        if ( jSONObject != null ) {
            account.setBak( new String( jSONObject ) );
        }
        account.setValid( accountDTO.getValid() );

        return account;
    }
    public static AccountDTO toDTO(TbPlussAccount account) {
        if ( account == null ) {
            return null;
        }

        AccountDTO accountDTO = new AccountDTO();

        accountDTO.setId( account.getId() );
        accountDTO.setUserid( account.getUserid() );
        accountDTO.setCertificateurl( account.getCertificateurl() );
        accountDTO.setSettletype( account.getSettletype() );
        accountDTO.setIdcardid( account.getIdcardid() );
        accountDTO.setBankcardid( account.getBankcardid() );
        accountDTO.setChanneltype( account.getChanneltype() );
        accountDTO.setCreatetime( account.getCreatetime() );
        accountDTO.setCreateTimeStart( account.getCreateTimeStart() );
        accountDTO.setCreateTimeEnd( account.getCreateTimeEnd() );
        accountDTO.setUpdatetime( account.getUpdatetime() );
        accountDTO.setUpdateTimeStart( account.getUpdateTimeStart() );
        accountDTO.setUpdateTimeEnd( account.getUpdateTimeEnd() );
        String jSONObject = account.getBak();
        if ( jSONObject != null ) {
            accountDTO.setBak( new String( jSONObject ) );
        }
        accountDTO.setValid( account.getValid() );

        return accountDTO;
    }
}
