package com.crm.rely.backend.core.entity.base;

import lombok.Data;

import java.util.Date;
@Data
public class BaseAddEntity implements BaseInterfaceEntity {

    private Date addTime;

    private Long addUser;

    private String addIp;
    private Date modifyTime;

    private Long modifyUser;

    private String modifyIp;

    private String note;

    @Override
    public void populateMetadata(String ip, Long userId, String location, Date dateTime) {
        addTime = dateTime;
        addUser = userId;
        addIp = ip;
        modifyTime = dateTime;
        modifyUser = userId;
        modifyIp = ip;
        if (location != null && location.trim().length() > 0) {
            addIp += "-" + location;
            modifyIp += "-" + location;
        }
    }
}
