package com.casic.PgInterface.patroler.dto;

import com.casic.PgInterface.patroler.domain.PgLog;

import java.text.SimpleDateFormat;

/**
 * Created by yxw on 2017/11/2.
 */
public class PgLogDto{

    private String id;
    private String operate;//操作
    private String operateTime;//时间
    private String userName;//操作人员
    private String active;//状态位

    public String getId() {
        return id;
    }

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

    public String getOperate() {
        return operate;
    }

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

    public String getOperateTime() {
        return operateTime;
    }

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

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getActive() {
        return active;
    }

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

    public PgLogDto(PgLog pgLog) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        this.setId(String.valueOf(pgLog.getId()));
        this.setOperate(pgLog.getOperate());
        if(pgLog.getUserId()==null)
            this.setUserName("");
        else
        this.setUserName(pgLog.getUserId().getUserName());
        if (pgLog.getOperateTime() != null)
            this.setOperateTime(sdf.format(pgLog.getOperateTime()));
        else
            this.setOperateTime("");
        this.setActive(String.valueOf(pgLog.getActive()));
    }
}
