package com.izouma.nineth.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.time.LocalDateTime;

@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(value = {"hibernateLazyInitializer"}, ignoreUnknown = true)
@ApiModel("操作日志")
public class OperationLog {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @ApiModelProperty("操作名称")
    private String name;

    @ApiModelProperty("操作类型")
    private String type;

    @ApiModelProperty("用户ID")
    private String userId;

    @ApiModelProperty("用户名")
    private String username;

    @ApiModelProperty("描述")
    @Column(name = "description")
    private String desc;

    @ApiModelProperty("调用方法")
    private String reqMethod;

    @ApiModelProperty("请求地址")
    private String reqUrl;

    @ApiModelProperty("请求参数")
    @Lob
    private String reqParams;

    @ApiModelProperty("请求ip")
    private String reqIp;

    @ApiModelProperty("返回结果")
    @Lob
    private String resp;

    @ApiModelProperty("操作时间")
    private LocalDateTime time;
}
