/**
 * @filename:CustomerOperationLog 2024-05-14
 * @project trade-client V1.0 Copyright(c) 2024 wanglang Co. Ltd. All right reserved.
 */
package com.trade.client.system.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.trade.common.utils.ip.AddressUtils;
import com.trade.common.utils.ip.IpUtils;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;

/**
 * @Description: 客户操作日志实体类
 * @version: V1.0
 * @author: wanglang
 * @Date: 2024/5/14
 */
public class CustomerOperationLog extends Model<CustomerOperationLog> {

    private static final long serialVersionUID = 1715656430846L;
    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(name = "id", value = "主键id")
    private Long id;
    @ApiModelProperty(name = "customerUserId", value = "客户id")
    private Long customerUserId;
    @ApiModelProperty(name = "module", value = "业务模块(菜单)")
    private String module;
    @ApiModelProperty(name = "type", value = "业务类型(新增、修改)")
    private String type;
    @ApiModelProperty(name = "ipaddr", value = "登录IP地址")
    private String ipaddr;
    @ApiModelProperty(name = "content", value = "操作内容")
    private String content;
    @ApiModelProperty(name = "loginLocation", value = "登录地点")
    private String loginLocation;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(name = "gmtCreate", value = "创建时间")
    private Date gmtCreate;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(name = "gmtModified", value = "修改时间")
    private Date gmtModified;

    public CustomerOperationLog(){
    }

    public CustomerOperationLog(Long customerUserId, String module, String type, String content){
        this.customerUserId = customerUserId;
        this.module = module;
        this.type = type;
        this.ipaddr = IpUtils.getIpAddr();
        this.content = content;
        this.loginLocation = AddressUtils.getRealAddressByIP(this.ipaddr);
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getCustomerUserId() {
        return customerUserId;
    }

    public void setCustomerUserId(Long customerUserId) {
        this.customerUserId = customerUserId;
    }

    public String getModule() {
        return module;
    }

    public void setModule(String module) {
        this.module = module;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getIpaddr() {
        return ipaddr;
    }

    public void setIpaddr(String ipaddr) {
        this.ipaddr = ipaddr;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getLoginLocation() {
        return loginLocation;
    }

    public void setLoginLocation(String loginLocation) {
        this.loginLocation = loginLocation;
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Date getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Date gmtModified) {
        this.gmtModified = gmtModified;
    }
}
