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.rushrepair.domain.RushRepairBean;

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

    public static final String TABLENAME = "DB_RUSH_REPAIR";

    /**
     * Properties of entity RushRepairBean.<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 Address = new Property(1, String.class, "address", false, "ADDRESS");
        public final static Property Contact = new Property(2, String.class, "contact", false, "CONTACT");
        public final static Property ContactPhone = new Property(3, String.class, "contactPhone", false, "CONTACT_PHONE");
        public final static Property DispatchDate = new Property(4, String.class, "dispatchDate", false, "DISPATCH_DATE");
        public final static Property DelFlag = new Property(5, String.class, "delFlag", false, "DEL_FLAG");
        public final static Property Description = new Property(6, String.class, "description", false, "DESCRIPTION");
        public final static Property DispatchUserId = new Property(7, String.class, "dispatchUserId", false, "DISPATCH_USER_ID");
        public final static Property CreatTime = new Property(8, String.class, "creatTime", false, "CREAT_TIME");
        public final static Property CreatUser = new Property(9, String.class, "creatUser", false, "CREAT_USER");
        public final static Property DispatchUserName = new Property(10, String.class, "dispatchUserName", false, "DISPATCH_USER_NAME");
        public final static Property WorkOrderStateName = new Property(11, String.class, "workOrderStateName", false, "WORK_ORDER_STATE_NAME");
        public final static Property RowId = new Property(12, int.class, "rowId", false, "ROW_ID");
        public final static Property Introduction = new Property(13, String.class, "introduction", false, "INTRODUCTION");
        public final static Property NoteTaker = new Property(14, String.class, "noteTaker", false, "NOTE_TAKER");
        public final static Property RushRepairPersons = new Property(15, String.class, "rushRepairPersons", false, "RUSH_REPAIR_PERSONS");
        public final static Property RushRepairPersonsName = new Property(16, String.class, "rushRepairPersonsName", false, "RUSH_REPAIR_PERSONS_NAME");
        public final static Property ResponsibleName = new Property(17, String.class, "responsibleName", false, "RESPONSIBLE_NAME");
        public final static Property RushRepairResponsible = new Property(18, String.class, "rushRepairResponsible", false, "RUSH_REPAIR_RESPONSIBLE");
        public final static Property WorkOrderId = new Property(19, String.class, "workOrderId", false, "WORK_ORDER_ID");
        public final static Property WorkOrderTypeName = new Property(20, String.class, "workOrderTypeName", false, "WORK_ORDER_TYPE_NAME");
        public final static Property WorkOrderSource = new Property(21, String.class, "workOrderSource", false, "WORK_ORDER_SOURCE");
        public final static Property WorkOrderState = new Property(22, String.class, "workOrderState", false, "WORK_ORDER_STATE");
        public final static Property WorkOrderType = new Property(23, String.class, "workOrderType", false, "WORK_ORDER_TYPE");
        public final static Property X = new Property(24, double.class, "x", false, "X");
        public final static Property Y = new Property(25, double.class, "y", false, "Y");
        public final static Property Submit_state = new Property(26, String.class, "submit_state", false, "SUBMIT_STATE");
        public final static Property Department = new Property(27, String.class, "department", false, "DEPARTMENT");
    }


    public RushRepairBeanDao(DaoConfig config) {
        super(config);
    }
    
    public RushRepairBeanDao(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_RUSH_REPAIR\" (" + //
                "\"ID\" TEXT PRIMARY KEY NOT NULL UNIQUE ," + // 0: id
                "\"ADDRESS\" TEXT," + // 1: address
                "\"CONTACT\" TEXT," + // 2: contact
                "\"CONTACT_PHONE\" TEXT," + // 3: contactPhone
                "\"DISPATCH_DATE\" TEXT," + // 4: dispatchDate
                "\"DEL_FLAG\" TEXT," + // 5: delFlag
                "\"DESCRIPTION\" TEXT," + // 6: description
                "\"DISPATCH_USER_ID\" TEXT," + // 7: dispatchUserId
                "\"CREAT_TIME\" TEXT," + // 8: creatTime
                "\"CREAT_USER\" TEXT," + // 9: creatUser
                "\"DISPATCH_USER_NAME\" TEXT," + // 10: dispatchUserName
                "\"WORK_ORDER_STATE_NAME\" TEXT," + // 11: workOrderStateName
                "\"ROW_ID\" INTEGER NOT NULL ," + // 12: rowId
                "\"INTRODUCTION\" TEXT," + // 13: introduction
                "\"NOTE_TAKER\" TEXT," + // 14: noteTaker
                "\"RUSH_REPAIR_PERSONS\" TEXT," + // 15: rushRepairPersons
                "\"RUSH_REPAIR_PERSONS_NAME\" TEXT," + // 16: rushRepairPersonsName
                "\"RESPONSIBLE_NAME\" TEXT," + // 17: responsibleName
                "\"RUSH_REPAIR_RESPONSIBLE\" TEXT," + // 18: rushRepairResponsible
                "\"WORK_ORDER_ID\" TEXT," + // 19: workOrderId
                "\"WORK_ORDER_TYPE_NAME\" TEXT," + // 20: workOrderTypeName
                "\"WORK_ORDER_SOURCE\" TEXT," + // 21: workOrderSource
                "\"WORK_ORDER_STATE\" TEXT," + // 22: workOrderState
                "\"WORK_ORDER_TYPE\" TEXT," + // 23: workOrderType
                "\"X\" REAL NOT NULL ," + // 24: x
                "\"Y\" REAL NOT NULL ," + // 25: y
                "\"SUBMIT_STATE\" TEXT," + // 26: submit_state
                "\"DEPARTMENT\" TEXT);"); // 27: department
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, RushRepairBean entity) {
        stmt.clearBindings();
        stmt.bindString(1, entity.getId());
 
        String address = entity.getAddress();
        if (address != null) {
            stmt.bindString(2, address);
        }
 
        String contact = entity.getContact();
        if (contact != null) {
            stmt.bindString(3, contact);
        }
 
        String contactPhone = entity.getContactPhone();
        if (contactPhone != null) {
            stmt.bindString(4, contactPhone);
        }
 
        String dispatchDate = entity.getDispatchDate();
        if (dispatchDate != null) {
            stmt.bindString(5, dispatchDate);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(6, delFlag);
        }
 
        String description = entity.getDescription();
        if (description != null) {
            stmt.bindString(7, description);
        }
 
        String dispatchUserId = entity.getDispatchUserId();
        if (dispatchUserId != null) {
            stmt.bindString(8, dispatchUserId);
        }
 
        String creatTime = entity.getCreatTime();
        if (creatTime != null) {
            stmt.bindString(9, creatTime);
        }
 
        String creatUser = entity.getCreatUser();
        if (creatUser != null) {
            stmt.bindString(10, creatUser);
        }
 
        String dispatchUserName = entity.getDispatchUserName();
        if (dispatchUserName != null) {
            stmt.bindString(11, dispatchUserName);
        }
 
        String workOrderStateName = entity.getWorkOrderStateName();
        if (workOrderStateName != null) {
            stmt.bindString(12, workOrderStateName);
        }
        stmt.bindLong(13, entity.getRowId());
 
        String introduction = entity.getIntroduction();
        if (introduction != null) {
            stmt.bindString(14, introduction);
        }
 
        String noteTaker = entity.getNoteTaker();
        if (noteTaker != null) {
            stmt.bindString(15, noteTaker);
        }
 
        String rushRepairPersons = entity.getRushRepairPersons();
        if (rushRepairPersons != null) {
            stmt.bindString(16, rushRepairPersons);
        }
 
        String rushRepairPersonsName = entity.getRushRepairPersonsName();
        if (rushRepairPersonsName != null) {
            stmt.bindString(17, rushRepairPersonsName);
        }
 
        String responsibleName = entity.getResponsibleName();
        if (responsibleName != null) {
            stmt.bindString(18, responsibleName);
        }
 
        String rushRepairResponsible = entity.getRushRepairResponsible();
        if (rushRepairResponsible != null) {
            stmt.bindString(19, rushRepairResponsible);
        }
 
        String workOrderId = entity.getWorkOrderId();
        if (workOrderId != null) {
            stmt.bindString(20, workOrderId);
        }
 
        String workOrderTypeName = entity.getWorkOrderTypeName();
        if (workOrderTypeName != null) {
            stmt.bindString(21, workOrderTypeName);
        }
 
        String workOrderSource = entity.getWorkOrderSource();
        if (workOrderSource != null) {
            stmt.bindString(22, workOrderSource);
        }
 
        String workOrderState = entity.getWorkOrderState();
        if (workOrderState != null) {
            stmt.bindString(23, workOrderState);
        }
 
        String workOrderType = entity.getWorkOrderType();
        if (workOrderType != null) {
            stmt.bindString(24, workOrderType);
        }
        stmt.bindDouble(25, entity.getX());
        stmt.bindDouble(26, entity.getY());
 
        String submit_state = entity.getSubmit_state();
        if (submit_state != null) {
            stmt.bindString(27, submit_state);
        }
 
        String department = entity.getDepartment();
        if (department != null) {
            stmt.bindString(28, department);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, RushRepairBean entity) {
        stmt.clearBindings();
        stmt.bindString(1, entity.getId());
 
        String address = entity.getAddress();
        if (address != null) {
            stmt.bindString(2, address);
        }
 
        String contact = entity.getContact();
        if (contact != null) {
            stmt.bindString(3, contact);
        }
 
        String contactPhone = entity.getContactPhone();
        if (contactPhone != null) {
            stmt.bindString(4, contactPhone);
        }
 
        String dispatchDate = entity.getDispatchDate();
        if (dispatchDate != null) {
            stmt.bindString(5, dispatchDate);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(6, delFlag);
        }
 
        String description = entity.getDescription();
        if (description != null) {
            stmt.bindString(7, description);
        }
 
        String dispatchUserId = entity.getDispatchUserId();
        if (dispatchUserId != null) {
            stmt.bindString(8, dispatchUserId);
        }
 
        String creatTime = entity.getCreatTime();
        if (creatTime != null) {
            stmt.bindString(9, creatTime);
        }
 
        String creatUser = entity.getCreatUser();
        if (creatUser != null) {
            stmt.bindString(10, creatUser);
        }
 
        String dispatchUserName = entity.getDispatchUserName();
        if (dispatchUserName != null) {
            stmt.bindString(11, dispatchUserName);
        }
 
        String workOrderStateName = entity.getWorkOrderStateName();
        if (workOrderStateName != null) {
            stmt.bindString(12, workOrderStateName);
        }
        stmt.bindLong(13, entity.getRowId());
 
        String introduction = entity.getIntroduction();
        if (introduction != null) {
            stmt.bindString(14, introduction);
        }
 
        String noteTaker = entity.getNoteTaker();
        if (noteTaker != null) {
            stmt.bindString(15, noteTaker);
        }
 
        String rushRepairPersons = entity.getRushRepairPersons();
        if (rushRepairPersons != null) {
            stmt.bindString(16, rushRepairPersons);
        }
 
        String rushRepairPersonsName = entity.getRushRepairPersonsName();
        if (rushRepairPersonsName != null) {
            stmt.bindString(17, rushRepairPersonsName);
        }
 
        String responsibleName = entity.getResponsibleName();
        if (responsibleName != null) {
            stmt.bindString(18, responsibleName);
        }
 
        String rushRepairResponsible = entity.getRushRepairResponsible();
        if (rushRepairResponsible != null) {
            stmt.bindString(19, rushRepairResponsible);
        }
 
        String workOrderId = entity.getWorkOrderId();
        if (workOrderId != null) {
            stmt.bindString(20, workOrderId);
        }
 
        String workOrderTypeName = entity.getWorkOrderTypeName();
        if (workOrderTypeName != null) {
            stmt.bindString(21, workOrderTypeName);
        }
 
        String workOrderSource = entity.getWorkOrderSource();
        if (workOrderSource != null) {
            stmt.bindString(22, workOrderSource);
        }
 
        String workOrderState = entity.getWorkOrderState();
        if (workOrderState != null) {
            stmt.bindString(23, workOrderState);
        }
 
        String workOrderType = entity.getWorkOrderType();
        if (workOrderType != null) {
            stmt.bindString(24, workOrderType);
        }
        stmt.bindDouble(25, entity.getX());
        stmt.bindDouble(26, entity.getY());
 
        String submit_state = entity.getSubmit_state();
        if (submit_state != null) {
            stmt.bindString(27, submit_state);
        }
 
        String department = entity.getDepartment();
        if (department != null) {
            stmt.bindString(28, department);
        }
    }

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

    @Override
    public RushRepairBean readEntity(Cursor cursor, int offset) {
        RushRepairBean entity = new RushRepairBean( //
            cursor.getString(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // address
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // contact
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // contactPhone
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // dispatchDate
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // delFlag
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // description
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // dispatchUserId
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // creatTime
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // creatUser
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // dispatchUserName
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // workOrderStateName
            cursor.getInt(offset + 12), // rowId
            cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // introduction
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // noteTaker
            cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // rushRepairPersons
            cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // rushRepairPersonsName
            cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // responsibleName
            cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // rushRepairResponsible
            cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // workOrderId
            cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // workOrderTypeName
            cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // workOrderSource
            cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // workOrderState
            cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // workOrderType
            cursor.getDouble(offset + 24), // x
            cursor.getDouble(offset + 25), // y
            cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // submit_state
            cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27) // department
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, RushRepairBean entity, int offset) {
        entity.setId(cursor.getString(offset + 0));
        entity.setAddress(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setContact(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setContactPhone(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setDispatchDate(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setDelFlag(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setDescription(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setDispatchUserId(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setCreatTime(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setCreatUser(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setDispatchUserName(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setWorkOrderStateName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setRowId(cursor.getInt(offset + 12));
        entity.setIntroduction(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
        entity.setNoteTaker(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setRushRepairPersons(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
        entity.setRushRepairPersonsName(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
        entity.setResponsibleName(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
        entity.setRushRepairResponsible(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
        entity.setWorkOrderId(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
        entity.setWorkOrderTypeName(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20));
        entity.setWorkOrderSource(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21));
        entity.setWorkOrderState(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22));
        entity.setWorkOrderType(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23));
        entity.setX(cursor.getDouble(offset + 24));
        entity.setY(cursor.getDouble(offset + 25));
        entity.setSubmit_state(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26));
        entity.setDepartment(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27));
     }
    
    @Override
    protected final String updateKeyAfterInsert(RushRepairBean entity, long rowId) {
        return entity.getId();
    }
    
    @Override
    public String getKey(RushRepairBean entity) {
        if(entity != null) {
            return entity.getId();
        } else {
            return null;
        }
    }

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

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