package hf.lskj.com.carstockcount.db;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.OrderBy;
import org.greenrobot.greendao.annotation.ToOne;
import org.greenrobot.greendao.annotation.Transient;

import java.io.Serializable;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;

/**
 * Created by yaoju on 2017/7/31.
 * 记录表 包含盘点记录 绑定记录 解绑记录
 */
@Entity
public class Record implements Serializable{
    static final long serialVersionUID = 43L;
    public static final String TYPE_BANGDING="绑定";
    public static final String TYPE_JIEBANG="解绑";
    public static final String TYPE_PANDIAN="盘点";
    @Id
    private Long id;
    private String rfid;
    private String vin;
    private String status="";
    private String remark;
    private String createTime;
    /*用户的登录名*/
    private String operatorId;
    private String type;
    private String storeId;
    private String color;
    private String carType;
    /**
     * 本表的vin字段关联CarInfo的主键
     */
    @ToOne(joinProperty = "vin")
    public CarInfo carInfo;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 765166123)
    private transient RecordDao myDao;
    @Generated(hash = 1983733318)
    public Record(Long id, String rfid, String vin, String status, String remark, String createTime,
            String operatorId, String type, String storeId, String color, String carType) {
        this.id = id;
        this.rfid = rfid;
        this.vin = vin;
        this.status = status;
        this.remark = remark;
        this.createTime = createTime;
        this.operatorId = operatorId;
        this.type = type;
        this.storeId = storeId;
        this.color = color;
        this.carType = carType;
    }
    @Generated(hash = 477726293)
    public Record() {
    }
    public Long getId() {
        return this.id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getRfid() {
        return this.rfid;
    }
    public void setRfid(String rfid) {
        this.rfid = rfid;
    }
    public String getVin() {
        return this.vin;
    }
    public void setVin(String vin) {
        this.vin = vin;
    }
    public String getStatus() {
        return this.status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getRemark() {
        return this.remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getCreateTime() {
        return this.createTime;
    }
    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
    public String getOperatorId() {
        return this.operatorId;
    }
    public void setOperatorId(String operatorId) {
        this.operatorId = operatorId;
    }
    public String getType() {
        return this.type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getStoreId() {
        return this.storeId;
    }
    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }
    @Generated(hash = 2118934479)
    private transient String carInfo__resolvedKey;
    /** To-one relationship, resolved on first access. */
    @Generated(hash = 1787003779)
    public CarInfo getCarInfo() {
        String __key = this.vin;
        if (carInfo__resolvedKey == null || carInfo__resolvedKey != __key) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            CarInfoDao targetDao = daoSession.getCarInfoDao();
            CarInfo carInfoNew = targetDao.load(__key);
            synchronized (this) {
                carInfo = carInfoNew;
                carInfo__resolvedKey = __key;
            }
        }
        return carInfo;
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1808670039)
    public void setCarInfo(CarInfo carInfo) {
        synchronized (this) {
            this.carInfo = carInfo;
            vin = carInfo == null ? null : carInfo.getVin();
            carInfo__resolvedKey = vin;
        }
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1505145191)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getRecordDao() : null;
    }
    public String getColor() {
        return this.color;
    }
    public void setColor(String color) {
        this.color = color;
    }
    public String getCarType() {
        return this.carType;
    }
    public void setCarType(String carType) {
        this.carType = carType;
    }
   
}
