package com.rf.psychological.opLog.dao;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.rf.psychological.base.model.BaseEntity;
import lombok.*;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import java.util.Date;

/**
 * @author lpf
 * @description:
 * @date 2022/1/1211:08
 */
@Entity
@ToString
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "t_sys_log", indexes = {
        @Index(columnList = "id", unique = true),
        @Index(columnList = "user_id"),
        @Index(columnList = "institution_no")
})
@org.hibernate.annotations.Table(appliesTo = "t_sys_log", comment = "操作日志")
public class SysLogEntity extends BaseEntity {

    @Column(name = "user_id", columnDefinition = "varchar(36) not null comment '操作用户id'")
    private String userId;

    @Column(name = "user_name", columnDefinition = "varchar(50) not null comment '操作用户名'")
    private String userName;

    @Column(name = "institution_no", columnDefinition = "varchar(50) not null comment '机构编号'")
    private String institutionNo;

    @Column(name = "type", columnDefinition = "varchar(10) null comment '用户类别'")
    private String type;

    @Column(name = "operation", columnDefinition = "varchar(100) null comment '用户操作'")
    private String operation;

    @Column(name = "method", columnDefinition = "varchar(100) null comment '操作方法'")
    private String method;

    @Column(name = "url", columnDefinition = "varchar(100) null comment '请求url'")
    private String url;

    @Column(name = "ip", columnDefinition = "varchar(100) null comment '操作ip'")
    private String ip;

    @Column(name = "result", columnDefinition = "varchar(250) null comment '操作结果'")
    private String result;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "createTime", columnDefinition = "timestamp default CURRENT_TIMESTAMP  comment '操作时间'")
    private Date createTime;

    @Column(name = "response_time", columnDefinition = "varchar(250) null comment '响应时长'")
    private String responseTime;

}
