package com.njcn.gather.system.log.pojo.po;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author caozehui
 * @date 2024-11-29
 */
@Data
@TableName("sys_log_audit")
public class SysLogAudit implements Serializable {
    private static final long serialVersionUID = -56962081010894238L;
    /**
     * 审计日志Id
     */
    private String id;

    /**
     * 登录名
     */
    @Excel(name = "登录名")
    private String loginName;


    /**
     * 用户名
     */
    @Excel(name = "用户名")
    private String userName;


    /**
     * IP
     */
    @Excel(name = "IP", width = 20)
    private String ip;

    /**
     * 操作内容
     */
    @Excel(name = "操作内容", width = 80)
    private String operate;


    /**
     * 操作类型 （比如：查询、新增、删除、下载等等)
     */
    @Excel(name = "操作类型")
    private String operateType;

    /**
     * 事件结果 0失败 1成功
     */
    @Excel(name = "事件结果", replace = {"失败_0", "成功_1"})
    private String result;

    /**
     * 失败原因
     */
    @Excel(name = "失败原因")
    private String reason;

    /**
     * 事件类型
     */
    @Excel(name = "事件类型", replace = {"业务事件_0", "系统事件_1"})
    private Integer type;


    /**
     * 事件严重度(0.普通 1.中等 2.严重)
     */
    @Excel(name = "事件严重度", replace = {"普通_0", "中等_1", "严重_2"})
    private Integer level;

    /**
     * 告警标志（0：未告警;1：已告警），默认未告警
     */
    @Excel(name = "告警标志", replace = {"未告警_0", "已告警_1"})
    private Integer warn;


    /**
     * 日志发生时间
     */
    @Excel(name = "日志发生时间", width = 30, exportFormat = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime logTime;
}

