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.domain.BuildManageBean;

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

    public static final String TABLENAME = "DB_BUILD_MANAGE";

    /**
     * Properties of entity BuildManageBean.<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 Note = new Property(1, String.class, "note", false, "NOTE");
        public final static Property DispatchDate = new Property(2, String.class, "dispatchDate", false, "DISPATCH_DATE");
        public final static Property ConstructionAddress = new Property(3, String.class, "constructionAddress", false, "CONSTRUCTION_ADDRESS");
        public final static Property SiteName = new Property(4, String.class, "siteName", false, "SITE_NAME");
        public final static Property Description = new Property(5, String.class, "description", false, "DESCRIPTION");
        public final static Property DelFlag = new Property(6, String.class, "delFlag", false, "DEL_FLAG");
        public final static Property DispatchUserName = new Property(7, String.class, "dispatchUserName", false, "DISPATCH_USER_NAME");
        public final static Property ConstructionUnit = new Property(8, String.class, "constructionUnit", false, "CONSTRUCTION_UNIT");
        public final static Property ConstructionPersonName = new Property(9, String.class, "constructionPersonName", false, "CONSTRUCTION_PERSON_NAME");
        public final static Property PersonInCharge = new Property(10, String.class, "personInCharge", false, "PERSON_IN_CHARGE");
        public final static Property DispatchUserId = new Property(11, String.class, "dispatchUserId", false, "DISPATCH_USER_ID");
        public final static Property SiteType = new Property(12, String.class, "siteType", false, "SITE_TYPE");
        public final static Property SiteTypeName = new Property(13, String.class, "siteTypeName", false, "SITE_TYPE_NAME");
        public final static Property ManageUnit = new Property(14, String.class, "manageUnit", false, "MANAGE_UNIT");
        public final static Property Manager = new Property(15, String.class, "manager", false, "MANAGER");
        public final static Property ConstructionState = new Property(16, String.class, "constructionState", false, "CONSTRUCTION_STATE");
        public final static Property RowId = new Property(17, int.class, "rowId", false, "ROW_ID");
        public final static Property ConstructionStateName = new Property(18, String.class, "constructionStateName", false, "CONSTRUCTION_STATE_NAME");
        public final static Property X = new Property(19, double.class, "x", false, "X");
        public final static Property Y = new Property(20, double.class, "y", false, "Y");
        public final static Property ConstructionPerson = new Property(21, String.class, "constructionPerson", false, "CONSTRUCTION_PERSON");
        public final static Property PersonInChargePhone = new Property(22, String.class, "personInChargePhone", false, "PERSON_IN_CHARGE_PHONE");
        public final static Property Submit_state = new Property(23, String.class, "submit_state", false, "SUBMIT_STATE");
        public final static Property Department = new Property(24, String.class, "department", false, "DEPARTMENT");
    }


    public BuildManageBeanDao(DaoConfig config) {
        super(config);
    }
    
    public BuildManageBeanDao(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 + "\"DB_BUILD_MANAGE\" (" + //
                "\"ID\" TEXT PRIMARY KEY NOT NULL UNIQUE ," + // 0: id
                "\"NOTE\" TEXT," + // 1: note
                "\"DISPATCH_DATE\" TEXT," + // 2: dispatchDate
                "\"CONSTRUCTION_ADDRESS\" TEXT," + // 3: constructionAddress
                "\"SITE_NAME\" TEXT," + // 4: siteName
                "\"DESCRIPTION\" TEXT," + // 5: description
                "\"DEL_FLAG\" TEXT," + // 6: delFlag
                "\"DISPATCH_USER_NAME\" TEXT," + // 7: dispatchUserName
                "\"CONSTRUCTION_UNIT\" TEXT," + // 8: constructionUnit
                "\"CONSTRUCTION_PERSON_NAME\" TEXT," + // 9: constructionPersonName
                "\"PERSON_IN_CHARGE\" TEXT," + // 10: personInCharge
                "\"DISPATCH_USER_ID\" TEXT," + // 11: dispatchUserId
                "\"SITE_TYPE\" TEXT," + // 12: siteType
                "\"SITE_TYPE_NAME\" TEXT," + // 13: siteTypeName
                "\"MANAGE_UNIT\" TEXT," + // 14: manageUnit
                "\"MANAGER\" TEXT," + // 15: manager
                "\"CONSTRUCTION_STATE\" TEXT," + // 16: constructionState
                "\"ROW_ID\" INTEGER NOT NULL ," + // 17: rowId
                "\"CONSTRUCTION_STATE_NAME\" TEXT," + // 18: constructionStateName
                "\"X\" REAL NOT NULL ," + // 19: x
                "\"Y\" REAL NOT NULL ," + // 20: y
                "\"CONSTRUCTION_PERSON\" TEXT," + // 21: constructionPerson
                "\"PERSON_IN_CHARGE_PHONE\" TEXT," + // 22: personInChargePhone
                "\"SUBMIT_STATE\" TEXT," + // 23: submit_state
                "\"DEPARTMENT\" TEXT);"); // 24: department
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, BuildManageBean entity) {
        stmt.clearBindings();
        stmt.bindString(1, entity.getId());
 
        String note = entity.getNote();
        if (note != null) {
            stmt.bindString(2, note);
        }
 
        String dispatchDate = entity.getDispatchDate();
        if (dispatchDate != null) {
            stmt.bindString(3, dispatchDate);
        }
 
        String constructionAddress = entity.getConstructionAddress();
        if (constructionAddress != null) {
            stmt.bindString(4, constructionAddress);
        }
 
        String siteName = entity.getSiteName();
        if (siteName != null) {
            stmt.bindString(5, siteName);
        }
 
        String description = entity.getDescription();
        if (description != null) {
            stmt.bindString(6, description);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(7, delFlag);
        }
 
        String dispatchUserName = entity.getDispatchUserName();
        if (dispatchUserName != null) {
            stmt.bindString(8, dispatchUserName);
        }
 
        String constructionUnit = entity.getConstructionUnit();
        if (constructionUnit != null) {
            stmt.bindString(9, constructionUnit);
        }
 
        String constructionPersonName = entity.getConstructionPersonName();
        if (constructionPersonName != null) {
            stmt.bindString(10, constructionPersonName);
        }
 
        String personInCharge = entity.getPersonInCharge();
        if (personInCharge != null) {
            stmt.bindString(11, personInCharge);
        }
 
        String dispatchUserId = entity.getDispatchUserId();
        if (dispatchUserId != null) {
            stmt.bindString(12, dispatchUserId);
        }
 
        String siteType = entity.getSiteType();
        if (siteType != null) {
            stmt.bindString(13, siteType);
        }
 
        String siteTypeName = entity.getSiteTypeName();
        if (siteTypeName != null) {
            stmt.bindString(14, siteTypeName);
        }
 
        String manageUnit = entity.getManageUnit();
        if (manageUnit != null) {
            stmt.bindString(15, manageUnit);
        }
 
        String manager = entity.getManager();
        if (manager != null) {
            stmt.bindString(16, manager);
        }
 
        String constructionState = entity.getConstructionState();
        if (constructionState != null) {
            stmt.bindString(17, constructionState);
        }
        stmt.bindLong(18, entity.getRowId());
 
        String constructionStateName = entity.getConstructionStateName();
        if (constructionStateName != null) {
            stmt.bindString(19, constructionStateName);
        }
        stmt.bindDouble(20, entity.getX());
        stmt.bindDouble(21, entity.getY());
 
        String constructionPerson = entity.getConstructionPerson();
        if (constructionPerson != null) {
            stmt.bindString(22, constructionPerson);
        }
 
        String personInChargePhone = entity.getPersonInChargePhone();
        if (personInChargePhone != null) {
            stmt.bindString(23, personInChargePhone);
        }
 
        String submit_state = entity.getSubmit_state();
        if (submit_state != null) {
            stmt.bindString(24, submit_state);
        }
 
        String department = entity.getDepartment();
        if (department != null) {
            stmt.bindString(25, department);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, BuildManageBean entity) {
        stmt.clearBindings();
        stmt.bindString(1, entity.getId());
 
        String note = entity.getNote();
        if (note != null) {
            stmt.bindString(2, note);
        }
 
        String dispatchDate = entity.getDispatchDate();
        if (dispatchDate != null) {
            stmt.bindString(3, dispatchDate);
        }
 
        String constructionAddress = entity.getConstructionAddress();
        if (constructionAddress != null) {
            stmt.bindString(4, constructionAddress);
        }
 
        String siteName = entity.getSiteName();
        if (siteName != null) {
            stmt.bindString(5, siteName);
        }
 
        String description = entity.getDescription();
        if (description != null) {
            stmt.bindString(6, description);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(7, delFlag);
        }
 
        String dispatchUserName = entity.getDispatchUserName();
        if (dispatchUserName != null) {
            stmt.bindString(8, dispatchUserName);
        }
 
        String constructionUnit = entity.getConstructionUnit();
        if (constructionUnit != null) {
            stmt.bindString(9, constructionUnit);
        }
 
        String constructionPersonName = entity.getConstructionPersonName();
        if (constructionPersonName != null) {
            stmt.bindString(10, constructionPersonName);
        }
 
        String personInCharge = entity.getPersonInCharge();
        if (personInCharge != null) {
            stmt.bindString(11, personInCharge);
        }
 
        String dispatchUserId = entity.getDispatchUserId();
        if (dispatchUserId != null) {
            stmt.bindString(12, dispatchUserId);
        }
 
        String siteType = entity.getSiteType();
        if (siteType != null) {
            stmt.bindString(13, siteType);
        }
 
        String siteTypeName = entity.getSiteTypeName();
        if (siteTypeName != null) {
            stmt.bindString(14, siteTypeName);
        }
 
        String manageUnit = entity.getManageUnit();
        if (manageUnit != null) {
            stmt.bindString(15, manageUnit);
        }
 
        String manager = entity.getManager();
        if (manager != null) {
            stmt.bindString(16, manager);
        }
 
        String constructionState = entity.getConstructionState();
        if (constructionState != null) {
            stmt.bindString(17, constructionState);
        }
        stmt.bindLong(18, entity.getRowId());
 
        String constructionStateName = entity.getConstructionStateName();
        if (constructionStateName != null) {
            stmt.bindString(19, constructionStateName);
        }
        stmt.bindDouble(20, entity.getX());
        stmt.bindDouble(21, entity.getY());
 
        String constructionPerson = entity.getConstructionPerson();
        if (constructionPerson != null) {
            stmt.bindString(22, constructionPerson);
        }
 
        String personInChargePhone = entity.getPersonInChargePhone();
        if (personInChargePhone != null) {
            stmt.bindString(23, personInChargePhone);
        }
 
        String submit_state = entity.getSubmit_state();
        if (submit_state != null) {
            stmt.bindString(24, submit_state);
        }
 
        String department = entity.getDepartment();
        if (department != null) {
            stmt.bindString(25, department);
        }
    }

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

    @Override
    public BuildManageBean readEntity(Cursor cursor, int offset) {
        BuildManageBean entity = new BuildManageBean( //
            cursor.getString(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // note
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // dispatchDate
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // constructionAddress
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // siteName
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // description
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // delFlag
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // dispatchUserName
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // constructionUnit
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructionPersonName
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // personInCharge
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // dispatchUserId
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // siteType
            cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // siteTypeName
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // manageUnit
            cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // manager
            cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // constructionState
            cursor.getInt(offset + 17), // rowId
            cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // constructionStateName
            cursor.getDouble(offset + 19), // x
            cursor.getDouble(offset + 20), // y
            cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // constructionPerson
            cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // personInChargePhone
            cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // submit_state
            cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24) // department
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, BuildManageBean entity, int offset) {
        entity.setId(cursor.getString(offset + 0));
        entity.setNote(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setDispatchDate(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setConstructionAddress(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setSiteName(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setDescription(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setDelFlag(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setDispatchUserName(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setConstructionUnit(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setConstructionPersonName(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setPersonInCharge(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setDispatchUserId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setSiteType(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setSiteTypeName(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
        entity.setManageUnit(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setManager(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
        entity.setConstructionState(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
        entity.setRowId(cursor.getInt(offset + 17));
        entity.setConstructionStateName(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
        entity.setX(cursor.getDouble(offset + 19));
        entity.setY(cursor.getDouble(offset + 20));
        entity.setConstructionPerson(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21));
        entity.setPersonInChargePhone(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22));
        entity.setSubmit_state(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23));
        entity.setDepartment(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24));
     }
    
    @Override
    protected final String updateKeyAfterInsert(BuildManageBean entity, long rowId) {
        return entity.getId();
    }
    
    @Override
    public String getKey(BuildManageBean entity) {
        if(entity != null) {
            return entity.getId();
        } else {
            return null;
        }
    }

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

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