package com.tofly.data.sql.dao;

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.tofly.ghrq_route.module.buildManage.BuildExamineBean;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "BUILD_EXAMINE_BEAN".
*/
public class BuildExamineBeanDao extends AbstractDao<BuildExamineBean, String> {

    public static final String TABLENAME = "BUILD_EXAMINE_BEAN";

    /**
     * Properties of entity BuildExamineBean.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Id = new Property(0, String.class, "id", true, "ID");
        public final static Property Auditor = new Property(1, String.class, "auditor", false, "AUDITOR");
        public final static Property AuditorName = new Property(2, String.class, "auditorName", false, "AUDITOR_NAME");
        public final static Property Auditmind = new Property(3, String.class, "auditmind", false, "AUDITMIND");
        public final static Property AuditMindName = new Property(4, String.class, "auditMindName", false, "AUDIT_MIND_NAME");
        public final static Property WorkOrderId = new Property(5, String.class, "workOrderId", false, "WORK_ORDER_ID");
        public final static Property AuditTime = new Property(6, String.class, "auditTime", false, "AUDIT_TIME");
        public final static Property DelFlag = new Property(7, String.class, "delFlag", false, "DEL_FLAG");
        public final static Property AuditDescription = new Property(8, String.class, "auditDescription", false, "AUDIT_DESCRIPTION");
    }


    public BuildExamineBeanDao(DaoConfig config) {
        super(config);
    }
    
    public BuildExamineBeanDao(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 + "\"BUILD_EXAMINE_BEAN\" (" + //
                "\"ID\" TEXT PRIMARY KEY NOT NULL UNIQUE ," + // 0: id
                "\"AUDITOR\" TEXT," + // 1: auditor
                "\"AUDITOR_NAME\" TEXT," + // 2: auditorName
                "\"AUDITMIND\" TEXT," + // 3: auditmind
                "\"AUDIT_MIND_NAME\" TEXT," + // 4: auditMindName
                "\"WORK_ORDER_ID\" TEXT," + // 5: workOrderId
                "\"AUDIT_TIME\" TEXT," + // 6: auditTime
                "\"DEL_FLAG\" TEXT," + // 7: delFlag
                "\"AUDIT_DESCRIPTION\" TEXT);"); // 8: auditDescription
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, BuildExamineBean entity) {
        stmt.clearBindings();
        stmt.bindString(1, entity.getId());
 
        String auditor = entity.getAuditor();
        if (auditor != null) {
            stmt.bindString(2, auditor);
        }
 
        String auditorName = entity.getAuditorName();
        if (auditorName != null) {
            stmt.bindString(3, auditorName);
        }
 
        String auditmind = entity.getAuditmind();
        if (auditmind != null) {
            stmt.bindString(4, auditmind);
        }
 
        String auditMindName = entity.getAuditMindName();
        if (auditMindName != null) {
            stmt.bindString(5, auditMindName);
        }
 
        String workOrderId = entity.getWorkOrderId();
        if (workOrderId != null) {
            stmt.bindString(6, workOrderId);
        }
 
        String auditTime = entity.getAuditTime();
        if (auditTime != null) {
            stmt.bindString(7, auditTime);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(8, delFlag);
        }
 
        String auditDescription = entity.getAuditDescription();
        if (auditDescription != null) {
            stmt.bindString(9, auditDescription);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, BuildExamineBean entity) {
        stmt.clearBindings();
        stmt.bindString(1, entity.getId());
 
        String auditor = entity.getAuditor();
        if (auditor != null) {
            stmt.bindString(2, auditor);
        }
 
        String auditorName = entity.getAuditorName();
        if (auditorName != null) {
            stmt.bindString(3, auditorName);
        }
 
        String auditmind = entity.getAuditmind();
        if (auditmind != null) {
            stmt.bindString(4, auditmind);
        }
 
        String auditMindName = entity.getAuditMindName();
        if (auditMindName != null) {
            stmt.bindString(5, auditMindName);
        }
 
        String workOrderId = entity.getWorkOrderId();
        if (workOrderId != null) {
            stmt.bindString(6, workOrderId);
        }
 
        String auditTime = entity.getAuditTime();
        if (auditTime != null) {
            stmt.bindString(7, auditTime);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(8, delFlag);
        }
 
        String auditDescription = entity.getAuditDescription();
        if (auditDescription != null) {
            stmt.bindString(9, auditDescription);
        }
    }

    @Override
    public String readKey(Cursor cursor, int offset) {
        return cursor.getString(offset + 0);
    }    

    @Override
    public BuildExamineBean readEntity(Cursor cursor, int offset) {
        BuildExamineBean entity = new BuildExamineBean( //
            cursor.getString(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // auditor
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // auditorName
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // auditmind
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // auditMindName
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // workOrderId
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // auditTime
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // delFlag
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // auditDescription
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, BuildExamineBean entity, int offset) {
        entity.setId(cursor.getString(offset + 0));
        entity.setAuditor(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setAuditorName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setAuditmind(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setAuditMindName(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setWorkOrderId(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setAuditTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setDelFlag(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setAuditDescription(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
     }
    
    @Override
    protected final String updateKeyAfterInsert(BuildExamineBean entity, long rowId) {
        return entity.getId();
    }
    
    @Override
    public String getKey(BuildExamineBean entity) {
        if(entity != null) {
            return entity.getId();
        } else {
            return null;
        }
    }

    @Override
    public boolean hasKey(BuildExamineBean entity) {
        throw new UnsupportedOperationException("Unsupported for entities with a non-null key");
    }

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