package com.qmth.themis.business.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.themis.business.enums.LogEnum;
import com.qmth.themis.business.util.UidUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * <p>
 * 系统日志
 * </p>
 *
 * @author wangliang
 * @since 2022-09-22
 */
@ApiModel(value = "TSLog对象", description = "系统日志")
public class TSLog implements Serializable {

    private static final long serialVersionUID = 1L;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "主键")
    private Long id;

    @ApiModelProperty(value = "实体类别")
    private LogEnum obj;

    @ApiModelProperty(value = "实体名称")
    private String objName;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "实体id")
    private Long objId;

    @ApiModelProperty(value = "更改前内容")
    private String updateBeforeObj;

    @ApiModelProperty(value = "更改后内容")
    private String updateAfterObj;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "创建人id")
    private Long createId;

    @ApiModelProperty(value = "创建时间")
    private Long createTime;

    public TSLog() {

    }

    public TSLog(LogEnum obj, String objName, String updateBeforeObj, String updateAfterObj, Long createId) {
        this.id = UidUtil.nextId();
        this.obj = obj;
        this.objName = objName;
        this.updateBeforeObj = updateBeforeObj;
        this.updateAfterObj = updateAfterObj;
        this.createId = createId;
        this.createTime = System.currentTimeMillis();
    }

    public TSLog(LogEnum obj, String objName, String updateBeforeObj, String updateAfterObj, Long createId, Long objId) {
        this.id = UidUtil.nextId();
        this.obj = obj;
        this.objName = objName;
        this.updateBeforeObj = updateBeforeObj;
        this.updateAfterObj = updateAfterObj;
        this.createId = createId;
        this.createTime = System.currentTimeMillis();
        this.objId = objId;
    }

    public Long getId() {
        return id;
    }

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

    public LogEnum getObj() {
        return obj;
    }

    public void setObj(LogEnum obj) {
        this.obj = obj;
    }

    public String getObjName() {
        return objName;
    }

    public void setObjName(String objName) {
        this.objName = objName;
    }

    public Long getObjId() {
        return objId;
    }

    public void setObjId(Long objId) {
        this.objId = objId;
    }

    public String getUpdateBeforeObj() {
        return updateBeforeObj;
    }

    public void setUpdateBeforeObj(String updateBeforeObj) {
        this.updateBeforeObj = updateBeforeObj;
    }

    public String getUpdateAfterObj() {
        return updateAfterObj;
    }

    public void setUpdateAfterObj(String updateAfterObj) {
        this.updateAfterObj = updateAfterObj;
    }

    public Long getCreateId() {
        return createId;
    }

    public void setCreateId(Long createId) {
        this.createId = createId;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }
}
