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 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 org.springframework.data.mongodb.core.index.Indexed;

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

/**
 * @Description : 系统异常
 * @Reference   :
 * @Author      : Frin
 * @Date        : 2018-11-8 12:30:00
 * @Modify      :
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="SYS_LOG_EXCEPTION")
@Api(value="系统异常表",description = "记录系统出现的异常")
public class SysLogException extends BaseBean {

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

    private String excModuleName;
    public String getExcModuleName(){
        if(this.excModule != null){
            return CommonEnumUtil.SOFT_TYPE.valueOfDescription(this.excModule);
        }
        return excModuleName;
    }

    @Column(name="EXC_CLASS_NAME")
    @ApiParam(value ="异常类名")
    private String excClassName;

    @Column(name="EXC_MESSAGE")
    @ApiParam(value ="异常信息")
    private String excMessage;

    @Column(name="EXC_STACK")
    @ApiParam(value ="堆栈信息")
    private String excStack;
}
