package com.casic.PgInterface.patroler.domain;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * Created by yxw on 2017/11/1.
 */
@Entity
@Table(name = "PG_LOG")
@SequenceGenerator(name = "SEQ_PG_LOG_ID", sequenceName = "SEQ_PG_LOG_ID",allocationSize=1,initialValue=1)
public class PgLog implements Serializable {
    private static final long serialVersionUID = 1L;
    private long id;
    private String operate;//操作
    private Date operateTime;//时间
    private PgUser userId;//操作人员
    private int active;//状态位

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_LOG_ID")
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Column(name = "OPERATE")
    public String getOperate() {
        return operate;
    }

    public void setOperate(String operate) {
        this.operate = operate;
    }

    @Column(name = "OPERATE_TIME")
    public Date getOperateTime() {
        return operateTime;
    }

    public void setOperateTime(Date operateTime) {
        this.operateTime = operateTime;
    }

    @Column(name = "ACTIVE")
    public int getActive() {
        return active;
    }

    public void setActive(int active) {
        this.active = active;
    }

    @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "USERID")
    public PgUser getUserId() {
        return userId;
    }

    public void setUserId(PgUser userId) {
        this.userId = userId;
    }
}
