CarDevice.java 5.16 KB
package com.bsth.entity;

import com.bsth.entity.schedule.BEntity;
import org.hibernate.annotations.Formula;
import org.joda.time.DateTime;

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

/**
 * 车辆设备信息(记录车辆设备变更情况,因为是历史表,字段不做关联)
 */
@Entity
@Table(name = "bsth_c_car_device")
public class CarDevice extends BEntity {

    /** 主键 */
    @Id
    @GeneratedValue
    private Long id;

    /** 公司名称(留着,暂时不用) */
    @Column
    private String gsName;

    /** 所属公司 varchar length(50) */
    private String company;

    /** 分公司  varchar length(50)*/
    private String brancheCompany;

    /** 组合公司分公司编码 */
    @Formula(" concat(company, '_', branche_company) ")
    private String cgsbm;

    /** 车辆id,关联bsth_c_cars */
    @Column(nullable = false)
    private Integer cl;
    /** 内部编号(自编号) */
    @Column(nullable = false)
    private String clZbh;

    /** 关联 bsth_c_line 主键,不做mapping */
    @Column(nullable = false)
    private Integer xl;
    /** 线路名称 */
    @Column(nullable = false)
    private String xlName;
    /** 线路编码 */
    @Column(nullable = false)
    private String xlBm;

    /** 旧终端号 */
    @Column(nullable = false)
    private String oldDeviceNo;
    /** 新终端号 */
    @Column(nullable = false)
    private String newDeviceNo;
    /** 旧SIM卡号 */
    private String oldSimNo;
    /** 新SIM卡号 */
    private String newSimNo;

    /** 故障描述 */
    private String troubleDesc;
    /** 保修描述 */
    private String guaranteeDesc;

    /** 启用日期 */
    @Column(nullable = false)
    private Date qyrq;

    /** 是否删除(标记) */
    @Column(nullable = false)
    private Boolean isCancel = false;

    public CarDevice() {}
    public CarDevice(Object id, Object xlid, Object clid, Object qyrq) {
        if (id != null) {
            this.id = Long.valueOf(id.toString());
        }
        if (xlid != null) {
            this.xl = Integer.valueOf(xlid.toString());
        }
        if (clid != null) {
            this.cl = Integer.valueOf(clid.toString());
        }
        if (qyrq != null) {
            try {
                this.qyrq = new Date();
                this.qyrq.setTime(Long.parseLong(qyrq.toString()));
            } catch (Exception exp) {
                this.qyrq = new DateTime(qyrq.toString()).toDate();
            }
        }
    }

    public Long getId() {
        return id;
    }

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

    public String getGsName() {
        return gsName;
    }

    public void setGsName(String gsName) {
        this.gsName = gsName;
    }

    public Integer getCl() {
        return cl;
    }

    public void setCl(Integer cl) {
        this.cl = cl;
    }

    public String getClZbh() {
        return clZbh;
    }

    public void setClZbh(String clZbh) {
        this.clZbh = clZbh;
    }

    public Integer getXl() {
        return xl;
    }

    public void setXl(Integer xl) {
        this.xl = xl;
    }

    public String getXlName() {
        return xlName;
    }

    public void setXlName(String xlName) {
        this.xlName = xlName;
    }

    public String getXlBm() {
        return xlBm;
    }

    public void setXlBm(String xlBm) {
        this.xlBm = xlBm;
    }

    public String getOldDeviceNo() {
        return oldDeviceNo;
    }

    public void setOldDeviceNo(String oldDeviceNo) {
        this.oldDeviceNo = oldDeviceNo;
    }

    public String getNewDeviceNo() {
        return newDeviceNo;
    }

    public void setNewDeviceNo(String newDeviceNo) {
        this.newDeviceNo = newDeviceNo;
    }

    public String getOldSimNo() {
        return oldSimNo;
    }

    public void setOldSimNo(String oldSimNo) {
        this.oldSimNo = oldSimNo;
    }

    public String getNewSimNo() {
        return newSimNo;
    }

    public void setNewSimNo(String newSimNo) {
        this.newSimNo = newSimNo;
    }

    public String getTroubleDesc() {
        return troubleDesc;
    }

    public void setTroubleDesc(String troubleDesc) {
        this.troubleDesc = troubleDesc;
    }

    public String getGuaranteeDesc() {
        return guaranteeDesc;
    }

    public void setGuaranteeDesc(String guaranteeDesc) {
        this.guaranteeDesc = guaranteeDesc;
    }

    public Date getQyrq() {
        return qyrq;
    }

    public void setQyrq(Date qyrq) {
        this.qyrq = qyrq;
    }

    public Boolean getIsCancel() {
        return isCancel;
    }

    public void setIsCancel(Boolean isCancel) {
        this.isCancel = isCancel;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public String getBrancheCompany() {
        return brancheCompany;
    }

    public void setBrancheCompany(String brancheCompany) {
        this.brancheCompany = brancheCompany;
    }
}