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

import cn.iselab.mooctest.user.model.OperationRecord;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.sql.Timestamp;

/**
 * @author: Diors.Po
 * @Email: 171256175@qq.com
 * @date 2019-09-15 22:19
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OperationRecordVO {

    private Long id;
    private String ip;
    private Long userId;
    private String operation;
    private String resource;
    private Timestamp createTime;

    public OperationRecordVO(OperationRecord record){
        BeanUtils.copyProperties(record, this);
    }

    public OperationRecord toOperationRecord(){
        OperationRecord record = new OperationRecord();
        BeanUtils.copyProperties(this, record);
        return record;
    }
}
