package cn.estsh.i3plus.pojo.platform.platbean;

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;

/**
 * @Description : 系统日志表
 * @Reference   :
 * @Author      : wei.peng
 * @Date        : 2018-10-22 16:58:42.784
 * @Modify      :
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="SYS_LOG_SYSTEM",
        indexes = {
                @Index(columnList = "CREATE_DATE_TIME", name = "LOG_INDEX_CREATE_DATE_TIME"),
                @Index(columnList = "LOG_LEVEL", name = "LOG_INDEX_LOG_LEVEL"),
                @Index(columnList = "LOG_MODULE_ID", name = "LOG_INDEX_LOG_MODULE_ID")
        })
@Api(value="系统日志表",description = "系统日志表")
public class SysLogSystem extends BaseBean {

    @Column(name="LOG_LEVEL")
    @ApiParam(value ="日志级别" , example ="1")
    //ImppEnumUtil.LOG_LEVEL
    @AnnoOutputColumn(refClass = ImppEnumUtil.LOG_LEVEL.class,refForeignKey = "value",value = "name")
    private Integer logLevel;

    @Column(name="LOG_MODULE_ID")
    @ApiParam(value ="系统模块（枚举）", example = "1")
    //CommonEnumUtil.SOFT_TYPE
    @AnnoOutputColumn(refClass = CommonEnumUtil.SOFT_TYPE.class,refForeignKey = "value",value = "description")
    private Integer logModuleId;

    @Column(name="REMOTE_IP")
    @ApiParam(value ="请求IP" , access ="请求IP")
    private String remoteIp;

    @Column(name="REQUEST_URL")
    @ApiParam(value ="请求路径" , access ="请求路径")
    private String requestUrl;

    @Column(name="HTTP_METHOD")
    @ApiParam(value ="http请求方法" , access ="http请求方法")
    private String httpMethod;

    @Column(name="LOG_CLASS")
    @ApiParam(value ="触发类路径" , access ="触发类路径")
    private String logClass;

    @Column(name="LOG_METHOD")
    @ApiParam(value ="触发方法" , access ="触发方法")
    private String logMethod;

    @Column(name="ARGS_COUNT")
    @ApiParam(value ="入参数量" , access ="入参数量", example = "0")
    private Integer argsCount;

    @Column(name="LOG_ARGS")
    @ApiParam(value ="方法入参" , access ="方法入参")
    private String logArgs;

    @Column(name="LOG_TITLE")
    @ApiParam(value ="日志标题")
    private String logTitle;

    @Column(name="LOG_DETAIL")
    @ApiParam(value ="日志详情")
    private String logDetail;

    @Column(name="SERVER_HOST")
    @ApiParam(value ="服务器")
    private String serverHost;

    @Column(name="EXECUTE_TIME")
    @ApiParam(value ="执行耗时")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long executeTime;
}
