package cn.iselab.mooctest.user.web.data.wrapper;

import cn.iselab.mooctest.user.model.BankAccountInfo;
import cn.iselab.mooctest.user.web.data.BankAccountInfoVO;
import cn.iselab.mooctest.user.web.wrapper.BaseWrapper;
import org.springframework.stereotype.Service;

/**
 * @Author: xuexb
 * @Date: 2019.2.26 11:28
 */
@Service
public class BankAccountInfoVOWrapper extends BaseWrapper<BankAccountInfoVO, BankAccountInfo> {
    @Override
    public BankAccountInfoVO wrap(BankAccountInfo info) {
        BankAccountInfoVO bankAccountInfoVO = new BankAccountInfoVO();

        bankAccountInfoVO.setUser_id(info.getUserId());
        bankAccountInfoVO.setBank_card_number(info.getBankCardNumber());
        bankAccountInfoVO.setBank_info(info.getBankInfo());
        bankAccountInfoVO.setId_number(info.getIDNumber());
        bankAccountInfoVO.setReal_name(info.getRealName());
        bankAccountInfoVO.setId_card_front_url(info.getIDCardFrontUrl());
        bankAccountInfoVO.setId_card_back_url(info.getIDCardBackUrl());
        return bankAccountInfoVO;
    }

    @Override
    public BankAccountInfo unwrap(BankAccountInfoVO data) {
        BankAccountInfo bankAccountInfo = new BankAccountInfo();

        bankAccountInfo.setBankCardNumber(data.getBank_card_number());
        bankAccountInfo.setBankInfo(data.getBank_card_number());
        bankAccountInfo.setIDCardBackUrl(data.getId_card_back_url());
        bankAccountInfo.setIDCardFrontUrl(data.getId_card_front_url());
        bankAccountInfo.setIDNumber(data.getId_number());
        bankAccountInfo.setRealName(data.getReal_name());
        bankAccountInfo.setUserId(data.getUser_id());
        return bankAccountInfo;
    }
}
