/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.dmRechargeRecord.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.modules.dmuser.domain.DmUser;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author zhirong
* @date 2021-11-23
**/
@Entity
@Data
@Table(name="dm_recharge_record")
public class DmRechargeRecord implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    private Long id;

//    @Column(name = "user_number")
//    @ApiModelProperty(value = "用户")
//    @OneToOne
//    @JoinColumn(name = "user_number", referencedColumnName = "id")
//    private DmUser user;

    @Column(name = "user_name")
    @ApiModelProperty(value = "持卡人姓名")
    private String userName;

    @Column(name = "user_phone")
    @ApiModelProperty(value = "持卡人手机号")
    private String userPhone;

    @Column(name = "card_number")
    @ApiModelProperty(value = "卡号")
    private String cardNumber;

    @Column(name = "recharge_amount")
    @ApiModelProperty(value = "充值金额")
    private BigDecimal rechargeAmount;

    @Column(name = "amount_after_recharge")
    @ApiModelProperty(value = "充值后金额")
    private BigDecimal amountAfterRecharge;

    @Column(name = "recharge_time")
    @ApiModelProperty(value = "充值时间")
    private Timestamp rechargeTime;

    @Column(name = "seq")
    @ApiModelProperty(value = "序列号")
    private String seq;

    public void copy(DmRechargeRecord source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}