package com.phlx.anchorcollect_p.db.gen;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;

import com.phlx.anchorcollect_p.entity.ImmuneBatchEntity;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "IMMUNE_BATCH_ENTITY".
*/
public class ImmuneBatchEntityDao extends AbstractDao<ImmuneBatchEntity, Long> {

    public static final String TABLENAME = "IMMUNE_BATCH_ENTITY";

    /**
     * Properties of entity ImmuneBatchEntity.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Unid = new Property(0, Long.class, "unid", true, "_id");
        public final static Property CircleNo = new Property(1, String.class, "circleNo", false, "CIRCLE_NO");
        public final static Property ImmuneExp = new Property(2, String.class, "immuneExp", false, "IMMUNE_EXP");
        public final static Property ImmuneDate = new Property(3, String.class, "immuneDate", false, "IMMUNE_DATE");
        public final static Property ImmunePerson = new Property(4, String.class, "immunePerson", false, "IMMUNE_PERSON");
        public final static Property PerinatalPeriod = new Property(5, String.class, "perinatalPeriod", false, "PERINATAL_PERIOD");
        public final static Property VaccineName = new Property(6, String.class, "vaccineName", false, "VACCINE_NAME");
        public final static Property Lotnumber = new Property(7, String.class, "lotnumber", false, "LOTNUMBER");
        public final static Property Manufacturer = new Property(8, String.class, "manufacturer", false, "MANUFACTURER");
        public final static Property Specifications = new Property(9, String.class, "specifications", false, "SPECIFICATIONS");
        public final static Property ImmuneDosage = new Property(10, String.class, "immuneDosage", false, "IMMUNE_DOSAGE");
        public final static Property ImmuneMethod = new Property(11, String.class, "immuneMethod", false, "IMMUNE_METHOD");
        public final static Property UploadStatus = new Property(12, String.class, "uploadStatus", false, "UPLOAD_STATUS");
        public final static Property DeptId = new Property(13, Long.class, "deptId", false, "DEPT_ID");
        public final static Property SearchValue = new Property(14, String.class, "searchValue", false, "SEARCH_VALUE");
        public final static Property CreateBy = new Property(15, String.class, "createBy", false, "CREATE_BY");
        public final static Property CreateTime = new Property(16, String.class, "createTime", false, "CREATE_TIME");
        public final static Property UpdateBy = new Property(17, String.class, "updateBy", false, "UPDATE_BY");
        public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME");
        public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK");
    }


    public ImmuneBatchEntityDao(DaoConfig config) {
        super(config);
    }
    
    public ImmuneBatchEntityDao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /** Creates the underlying database table. */
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "\"IMMUNE_BATCH_ENTITY\" (" + //
                "\"_id\" INTEGER PRIMARY KEY ," + // 0: unid
                "\"CIRCLE_NO\" TEXT," + // 1: circleNo
                "\"IMMUNE_EXP\" TEXT," + // 2: immuneExp
                "\"IMMUNE_DATE\" TEXT," + // 3: immuneDate
                "\"IMMUNE_PERSON\" TEXT," + // 4: immunePerson
                "\"PERINATAL_PERIOD\" TEXT," + // 5: perinatalPeriod
                "\"VACCINE_NAME\" TEXT," + // 6: vaccineName
                "\"LOTNUMBER\" TEXT," + // 7: lotnumber
                "\"MANUFACTURER\" TEXT," + // 8: manufacturer
                "\"SPECIFICATIONS\" TEXT," + // 9: specifications
                "\"IMMUNE_DOSAGE\" TEXT," + // 10: immuneDosage
                "\"IMMUNE_METHOD\" TEXT," + // 11: immuneMethod
                "\"UPLOAD_STATUS\" TEXT," + // 12: uploadStatus
                "\"DEPT_ID\" INTEGER," + // 13: deptId
                "\"SEARCH_VALUE\" TEXT," + // 14: searchValue
                "\"CREATE_BY\" TEXT," + // 15: createBy
                "\"CREATE_TIME\" TEXT," + // 16: createTime
                "\"UPDATE_BY\" TEXT," + // 17: updateBy
                "\"UPDATE_TIME\" TEXT," + // 18: updateTime
                "\"REMARK\" TEXT);"); // 19: remark
    }

    /** Drops the underlying database table. */
    public static void dropTable(Database db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"IMMUNE_BATCH_ENTITY\"";
        db.execSQL(sql);
    }

    @Override
    protected final void bindValues(DatabaseStatement stmt, ImmuneBatchEntity entity) {
        stmt.clearBindings();
 
        Long unid = entity.getUnid();
        if (unid != null) {
            stmt.bindLong(1, unid);
        }
 
        String circleNo = entity.getCircleNo();
        if (circleNo != null) {
            stmt.bindString(2, circleNo);
        }
 
        String immuneExp = entity.getImmuneExp();
        if (immuneExp != null) {
            stmt.bindString(3, immuneExp);
        }
 
        String immuneDate = entity.getImmuneDate();
        if (immuneDate != null) {
            stmt.bindString(4, immuneDate);
        }
 
        String immunePerson = entity.getImmunePerson();
        if (immunePerson != null) {
            stmt.bindString(5, immunePerson);
        }
 
        String perinatalPeriod = entity.getPerinatalPeriod();
        if (perinatalPeriod != null) {
            stmt.bindString(6, perinatalPeriod);
        }
 
        String vaccineName = entity.getVaccineName();
        if (vaccineName != null) {
            stmt.bindString(7, vaccineName);
        }
 
        String lotnumber = entity.getLotnumber();
        if (lotnumber != null) {
            stmt.bindString(8, lotnumber);
        }
 
        String manufacturer = entity.getManufacturer();
        if (manufacturer != null) {
            stmt.bindString(9, manufacturer);
        }
 
        String specifications = entity.getSpecifications();
        if (specifications != null) {
            stmt.bindString(10, specifications);
        }
 
        String immuneDosage = entity.getImmuneDosage();
        if (immuneDosage != null) {
            stmt.bindString(11, immuneDosage);
        }
 
        String immuneMethod = entity.getImmuneMethod();
        if (immuneMethod != null) {
            stmt.bindString(12, immuneMethod);
        }
 
        String uploadStatus = entity.getUploadStatus();
        if (uploadStatus != null) {
            stmt.bindString(13, uploadStatus);
        }
 
        Long deptId = entity.getDeptId();
        if (deptId != null) {
            stmt.bindLong(14, deptId);
        }
 
        String searchValue = entity.getSearchValue();
        if (searchValue != null) {
            stmt.bindString(15, searchValue);
        }
 
        String createBy = entity.getCreateBy();
        if (createBy != null) {
            stmt.bindString(16, createBy);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(17, createTime);
        }
 
        String updateBy = entity.getUpdateBy();
        if (updateBy != null) {
            stmt.bindString(18, updateBy);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(19, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(20, remark);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, ImmuneBatchEntity entity) {
        stmt.clearBindings();
 
        Long unid = entity.getUnid();
        if (unid != null) {
            stmt.bindLong(1, unid);
        }
 
        String circleNo = entity.getCircleNo();
        if (circleNo != null) {
            stmt.bindString(2, circleNo);
        }
 
        String immuneExp = entity.getImmuneExp();
        if (immuneExp != null) {
            stmt.bindString(3, immuneExp);
        }
 
        String immuneDate = entity.getImmuneDate();
        if (immuneDate != null) {
            stmt.bindString(4, immuneDate);
        }
 
        String immunePerson = entity.getImmunePerson();
        if (immunePerson != null) {
            stmt.bindString(5, immunePerson);
        }
 
        String perinatalPeriod = entity.getPerinatalPeriod();
        if (perinatalPeriod != null) {
            stmt.bindString(6, perinatalPeriod);
        }
 
        String vaccineName = entity.getVaccineName();
        if (vaccineName != null) {
            stmt.bindString(7, vaccineName);
        }
 
        String lotnumber = entity.getLotnumber();
        if (lotnumber != null) {
            stmt.bindString(8, lotnumber);
        }
 
        String manufacturer = entity.getManufacturer();
        if (manufacturer != null) {
            stmt.bindString(9, manufacturer);
        }
 
        String specifications = entity.getSpecifications();
        if (specifications != null) {
            stmt.bindString(10, specifications);
        }
 
        String immuneDosage = entity.getImmuneDosage();
        if (immuneDosage != null) {
            stmt.bindString(11, immuneDosage);
        }
 
        String immuneMethod = entity.getImmuneMethod();
        if (immuneMethod != null) {
            stmt.bindString(12, immuneMethod);
        }
 
        String uploadStatus = entity.getUploadStatus();
        if (uploadStatus != null) {
            stmt.bindString(13, uploadStatus);
        }
 
        Long deptId = entity.getDeptId();
        if (deptId != null) {
            stmt.bindLong(14, deptId);
        }
 
        String searchValue = entity.getSearchValue();
        if (searchValue != null) {
            stmt.bindString(15, searchValue);
        }
 
        String createBy = entity.getCreateBy();
        if (createBy != null) {
            stmt.bindString(16, createBy);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(17, createTime);
        }
 
        String updateBy = entity.getUpdateBy();
        if (updateBy != null) {
            stmt.bindString(18, updateBy);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(19, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(20, remark);
        }
    }

    @Override
    public Long readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
    }    

    @Override
    public ImmuneBatchEntity readEntity(Cursor cursor, int offset) {
        ImmuneBatchEntity entity = new ImmuneBatchEntity( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // unid
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // circleNo
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // immuneExp
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // immuneDate
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // immunePerson
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // perinatalPeriod
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // vaccineName
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lotnumber
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // manufacturer
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // specifications
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // immuneDosage
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // immuneMethod
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // uploadStatus
            cursor.isNull(offset + 13) ? null : cursor.getLong(offset + 13), // deptId
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // searchValue
            cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // createBy
            cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // createTime
            cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // updateBy
            cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime
            cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // remark
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, ImmuneBatchEntity entity, int offset) {
        entity.setUnid(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setCircleNo(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setImmuneExp(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setImmuneDate(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setImmunePerson(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setPerinatalPeriod(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setVaccineName(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setLotnumber(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setManufacturer(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setSpecifications(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setImmuneDosage(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setImmuneMethod(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setUploadStatus(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setDeptId(cursor.isNull(offset + 13) ? null : cursor.getLong(offset + 13));
        entity.setSearchValue(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setCreateBy(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
        entity.setCreateTime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
        entity.setUpdateBy(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
        entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
        entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(ImmuneBatchEntity entity, long rowId) {
        entity.setUnid(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(ImmuneBatchEntity entity) {
        if(entity != null) {
            return entity.getUnid();
        } else {
            return null;
        }
    }

    @Override
    public boolean hasKey(ImmuneBatchEntity entity) {
        return entity.getUnid() != null;
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }
    
}
