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.Table;

/**
 * @Description : 用户操作日志表
 * @Reference   :
 * @Author      : wei.peng
 * @Date        : 2018-10-22 16:58:42.720
 * @Modify      :
 **/
@Data
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="SYS_LOG_OPERATE")
@Api(value="操作日志表",description = "操作日志表")
public class SysLogOperate extends BaseBean {

    private static final long serialVersionUID = 1515035521283176727L;
    @ApiParam(value ="系统模块（枚举）", example = "1")
    @AnnoOutputColumn(refClass = CommonEnumUtil.SOFT_TYPE.class,refForeignKey = "value",value = "description")
    private Integer softType;
    public String getSoftTypeTxt() {
        return softType == null ? null : CommonEnumUtil.SOFT_TYPE.valueOfDescription(softType);
    }

    @ApiParam(value ="操作类型" , example = "-1")
    @AnnoOutputColumn(refClass = ImppEnumUtil.OPERATE_TYPE.class,refForeignKey = "value",value = "description")
    private Integer operateType;

    public String getOperateTypeTxt(){
        return operateType == null ? null : ImppEnumUtil.OPERATE_TYPE.valueOfDescription(operateType);
    }

    @ApiParam(value ="操作信息" , access ="操作信息")
    private String operateMessage;

    @ApiParam(value ="登录用户名称" , access ="登录用户名称")
    private String userLoginName;

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

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

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

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

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