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.OfflineWork.domain.OfflineJobNeedData;

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

    public static final String TABLENAME = "OFFLINE_JOB_NEED_DATA";

    /**
     * Properties of entity OfflineJobNeedData.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property PlanDate = new Property(0, String.class, "planDate", true, "PLAN_DATE");
        public final static Property Today_sign_history = new Property(1, int.class, "today_sign_history", false, "TODAY_SIGN_HISTORY");
        public final static Property Sign_history_date = new Property(2, String.class, "sign_history_date", false, "SIGN_HISTORY_DATE");
        public final static Property Device_type = new Property(3, int.class, "device_type", false, "DEVICE_TYPE");
        public final static Property Device_type_date = new Property(4, String.class, "device_type_date", false, "DEVICE_TYPE_DATE");
        public final static Property Danger_type = new Property(5, int.class, "danger_type", false, "DANGER_TYPE");
        public final static Property Danger_type_date = new Property(6, String.class, "danger_type_date", false, "DANGER_TYPE_DATE");
        public final static Property Photo_type = new Property(7, int.class, "photo_type", false, "PHOTO_TYPE");
        public final static Property Photo_type_date = new Property(8, String.class, "photo_type_date", false, "PHOTO_TYPE_DATE");
        public final static Property Map_config_type = new Property(9, int.class, "map_config_type", false, "MAP_CONFIG_TYPE");
        public final static Property Map_config_date = new Property(10, String.class, "map_config_date", false, "MAP_CONFIG_DATE");
        public final static Property Plan_list = new Property(11, int.class, "plan_list", false, "PLAN_LIST");
        public final static Property Plan_list_date = new Property(12, String.class, "plan_list_date", false, "PLAN_LIST_DATE");
        public final static Property Danger_info = new Property(13, int.class, "danger_info", false, "DANGER_INFO");
        public final static Property Danger_info_date = new Property(14, String.class, "danger_info_date", false, "DANGER_INFO_DATE");
        public final static Property Adjust_device_route_params = new Property(15, int.class, "adjust_device_route_params", false, "ADJUST_DEVICE_ROUTE_PARAMS");
        public final static Property Adjust_route_params_date = new Property(16, String.class, "adjust_route_params_date", false, "ADJUST_ROUTE_PARAMS_DATE");
        public final static Property Valve_device_route_params = new Property(17, int.class, "valve_device_route_params", false, "VALVE_DEVICE_ROUTE_PARAMS");
        public final static Property Vavle_route_params_date = new Property(18, String.class, "vavle_route_params_date", false, "VAVLE_ROUTE_PARAMS_DATE");
        public final static Property Build_project_list = new Property(19, int.class, "build_project_list", false, "BUILD_PROJECT_LIST");
        public final static Property Build_project_list_date = new Property(20, String.class, "build_project_list_date", false, "BUILD_PROJECT_LIST_DATE");
        public final static Property Build_list = new Property(21, int.class, "build_list", false, "BUILD_LIST");
        public final static Property Build_list_date = new Property(22, String.class, "build_list_date", false, "BUILD_LIST_DATE");
        public final static Property Build_notice_files = new Property(23, int.class, "build_notice_files", false, "BUILD_NOTICE_FILES");
        public final static Property Build_notice_date = new Property(24, String.class, "build_notice_date", false, "BUILD_NOTICE_DATE");
        public final static Property Plan_offline_points = new Property(25, int.class, "plan_offline_points", false, "PLAN_OFFLINE_POINTS");
        public final static Property Plan_offline_date = new Property(26, String.class, "plan_offline_date", false, "PLAN_OFFLINE_DATE");
    }


    public OfflineJobNeedDataDao(DaoConfig config) {
        super(config);
    }
    
    public OfflineJobNeedDataDao(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 + "\"OFFLINE_JOB_NEED_DATA\" (" + //
                "\"PLAN_DATE\" TEXT PRIMARY KEY NOT NULL UNIQUE ," + // 0: planDate
                "\"TODAY_SIGN_HISTORY\" INTEGER NOT NULL ," + // 1: today_sign_history
                "\"SIGN_HISTORY_DATE\" TEXT," + // 2: sign_history_date
                "\"DEVICE_TYPE\" INTEGER NOT NULL ," + // 3: device_type
                "\"DEVICE_TYPE_DATE\" TEXT," + // 4: device_type_date
                "\"DANGER_TYPE\" INTEGER NOT NULL ," + // 5: danger_type
                "\"DANGER_TYPE_DATE\" TEXT," + // 6: danger_type_date
                "\"PHOTO_TYPE\" INTEGER NOT NULL ," + // 7: photo_type
                "\"PHOTO_TYPE_DATE\" TEXT," + // 8: photo_type_date
                "\"MAP_CONFIG_TYPE\" INTEGER NOT NULL ," + // 9: map_config_type
                "\"MAP_CONFIG_DATE\" TEXT," + // 10: map_config_date
                "\"PLAN_LIST\" INTEGER NOT NULL ," + // 11: plan_list
                "\"PLAN_LIST_DATE\" TEXT," + // 12: plan_list_date
                "\"DANGER_INFO\" INTEGER NOT NULL ," + // 13: danger_info
                "\"DANGER_INFO_DATE\" TEXT," + // 14: danger_info_date
                "\"ADJUST_DEVICE_ROUTE_PARAMS\" INTEGER NOT NULL ," + // 15: adjust_device_route_params
                "\"ADJUST_ROUTE_PARAMS_DATE\" TEXT," + // 16: adjust_route_params_date
                "\"VALVE_DEVICE_ROUTE_PARAMS\" INTEGER NOT NULL ," + // 17: valve_device_route_params
                "\"VAVLE_ROUTE_PARAMS_DATE\" TEXT," + // 18: vavle_route_params_date
                "\"BUILD_PROJECT_LIST\" INTEGER NOT NULL ," + // 19: build_project_list
                "\"BUILD_PROJECT_LIST_DATE\" TEXT," + // 20: build_project_list_date
                "\"BUILD_LIST\" INTEGER NOT NULL ," + // 21: build_list
                "\"BUILD_LIST_DATE\" TEXT," + // 22: build_list_date
                "\"BUILD_NOTICE_FILES\" INTEGER NOT NULL ," + // 23: build_notice_files
                "\"BUILD_NOTICE_DATE\" TEXT," + // 24: build_notice_date
                "\"PLAN_OFFLINE_POINTS\" INTEGER NOT NULL ," + // 25: plan_offline_points
                "\"PLAN_OFFLINE_DATE\" TEXT);"); // 26: plan_offline_date
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, OfflineJobNeedData entity) {
        stmt.clearBindings();
        stmt.bindString(1, entity.getPlanDate());
        stmt.bindLong(2, entity.getToday_sign_history());
 
        String sign_history_date = entity.getSign_history_date();
        if (sign_history_date != null) {
            stmt.bindString(3, sign_history_date);
        }
        stmt.bindLong(4, entity.getDevice_type());
 
        String device_type_date = entity.getDevice_type_date();
        if (device_type_date != null) {
            stmt.bindString(5, device_type_date);
        }
        stmt.bindLong(6, entity.getDanger_type());
 
        String danger_type_date = entity.getDanger_type_date();
        if (danger_type_date != null) {
            stmt.bindString(7, danger_type_date);
        }
        stmt.bindLong(8, entity.getPhoto_type());
 
        String photo_type_date = entity.getPhoto_type_date();
        if (photo_type_date != null) {
            stmt.bindString(9, photo_type_date);
        }
        stmt.bindLong(10, entity.getMap_config_type());
 
        String map_config_date = entity.getMap_config_date();
        if (map_config_date != null) {
            stmt.bindString(11, map_config_date);
        }
        stmt.bindLong(12, entity.getPlan_list());
 
        String plan_list_date = entity.getPlan_list_date();
        if (plan_list_date != null) {
            stmt.bindString(13, plan_list_date);
        }
        stmt.bindLong(14, entity.getDanger_info());
 
        String danger_info_date = entity.getDanger_info_date();
        if (danger_info_date != null) {
            stmt.bindString(15, danger_info_date);
        }
        stmt.bindLong(16, entity.getAdjust_device_route_params());
 
        String adjust_route_params_date = entity.getAdjust_route_params_date();
        if (adjust_route_params_date != null) {
            stmt.bindString(17, adjust_route_params_date);
        }
        stmt.bindLong(18, entity.getValve_device_route_params());
 
        String vavle_route_params_date = entity.getVavle_route_params_date();
        if (vavle_route_params_date != null) {
            stmt.bindString(19, vavle_route_params_date);
        }
        stmt.bindLong(20, entity.getBuild_project_list());
 
        String build_project_list_date = entity.getBuild_project_list_date();
        if (build_project_list_date != null) {
            stmt.bindString(21, build_project_list_date);
        }
        stmt.bindLong(22, entity.getBuild_list());
 
        String build_list_date = entity.getBuild_list_date();
        if (build_list_date != null) {
            stmt.bindString(23, build_list_date);
        }
        stmt.bindLong(24, entity.getBuild_notice_files());
 
        String build_notice_date = entity.getBuild_notice_date();
        if (build_notice_date != null) {
            stmt.bindString(25, build_notice_date);
        }
        stmt.bindLong(26, entity.getPlan_offline_points());
 
        String plan_offline_date = entity.getPlan_offline_date();
        if (plan_offline_date != null) {
            stmt.bindString(27, plan_offline_date);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, OfflineJobNeedData entity) {
        stmt.clearBindings();
        stmt.bindString(1, entity.getPlanDate());
        stmt.bindLong(2, entity.getToday_sign_history());
 
        String sign_history_date = entity.getSign_history_date();
        if (sign_history_date != null) {
            stmt.bindString(3, sign_history_date);
        }
        stmt.bindLong(4, entity.getDevice_type());
 
        String device_type_date = entity.getDevice_type_date();
        if (device_type_date != null) {
            stmt.bindString(5, device_type_date);
        }
        stmt.bindLong(6, entity.getDanger_type());
 
        String danger_type_date = entity.getDanger_type_date();
        if (danger_type_date != null) {
            stmt.bindString(7, danger_type_date);
        }
        stmt.bindLong(8, entity.getPhoto_type());
 
        String photo_type_date = entity.getPhoto_type_date();
        if (photo_type_date != null) {
            stmt.bindString(9, photo_type_date);
        }
        stmt.bindLong(10, entity.getMap_config_type());
 
        String map_config_date = entity.getMap_config_date();
        if (map_config_date != null) {
            stmt.bindString(11, map_config_date);
        }
        stmt.bindLong(12, entity.getPlan_list());
 
        String plan_list_date = entity.getPlan_list_date();
        if (plan_list_date != null) {
            stmt.bindString(13, plan_list_date);
        }
        stmt.bindLong(14, entity.getDanger_info());
 
        String danger_info_date = entity.getDanger_info_date();
        if (danger_info_date != null) {
            stmt.bindString(15, danger_info_date);
        }
        stmt.bindLong(16, entity.getAdjust_device_route_params());
 
        String adjust_route_params_date = entity.getAdjust_route_params_date();
        if (adjust_route_params_date != null) {
            stmt.bindString(17, adjust_route_params_date);
        }
        stmt.bindLong(18, entity.getValve_device_route_params());
 
        String vavle_route_params_date = entity.getVavle_route_params_date();
        if (vavle_route_params_date != null) {
            stmt.bindString(19, vavle_route_params_date);
        }
        stmt.bindLong(20, entity.getBuild_project_list());
 
        String build_project_list_date = entity.getBuild_project_list_date();
        if (build_project_list_date != null) {
            stmt.bindString(21, build_project_list_date);
        }
        stmt.bindLong(22, entity.getBuild_list());
 
        String build_list_date = entity.getBuild_list_date();
        if (build_list_date != null) {
            stmt.bindString(23, build_list_date);
        }
        stmt.bindLong(24, entity.getBuild_notice_files());
 
        String build_notice_date = entity.getBuild_notice_date();
        if (build_notice_date != null) {
            stmt.bindString(25, build_notice_date);
        }
        stmt.bindLong(26, entity.getPlan_offline_points());
 
        String plan_offline_date = entity.getPlan_offline_date();
        if (plan_offline_date != null) {
            stmt.bindString(27, plan_offline_date);
        }
    }

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

    @Override
    public OfflineJobNeedData readEntity(Cursor cursor, int offset) {
        OfflineJobNeedData entity = new OfflineJobNeedData( //
            cursor.getString(offset + 0), // planDate
            cursor.getInt(offset + 1), // today_sign_history
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // sign_history_date
            cursor.getInt(offset + 3), // device_type
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // device_type_date
            cursor.getInt(offset + 5), // danger_type
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // danger_type_date
            cursor.getInt(offset + 7), // photo_type
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // photo_type_date
            cursor.getInt(offset + 9), // map_config_type
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // map_config_date
            cursor.getInt(offset + 11), // plan_list
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // plan_list_date
            cursor.getInt(offset + 13), // danger_info
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // danger_info_date
            cursor.getInt(offset + 15), // adjust_device_route_params
            cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // adjust_route_params_date
            cursor.getInt(offset + 17), // valve_device_route_params
            cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // vavle_route_params_date
            cursor.getInt(offset + 19), // build_project_list
            cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // build_project_list_date
            cursor.getInt(offset + 21), // build_list
            cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // build_list_date
            cursor.getInt(offset + 23), // build_notice_files
            cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // build_notice_date
            cursor.getInt(offset + 25), // plan_offline_points
            cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // plan_offline_date
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, OfflineJobNeedData entity, int offset) {
        entity.setPlanDate(cursor.getString(offset + 0));
        entity.setToday_sign_history(cursor.getInt(offset + 1));
        entity.setSign_history_date(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setDevice_type(cursor.getInt(offset + 3));
        entity.setDevice_type_date(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setDanger_type(cursor.getInt(offset + 5));
        entity.setDanger_type_date(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setPhoto_type(cursor.getInt(offset + 7));
        entity.setPhoto_type_date(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setMap_config_type(cursor.getInt(offset + 9));
        entity.setMap_config_date(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setPlan_list(cursor.getInt(offset + 11));
        entity.setPlan_list_date(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setDanger_info(cursor.getInt(offset + 13));
        entity.setDanger_info_date(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setAdjust_device_route_params(cursor.getInt(offset + 15));
        entity.setAdjust_route_params_date(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
        entity.setValve_device_route_params(cursor.getInt(offset + 17));
        entity.setVavle_route_params_date(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
        entity.setBuild_project_list(cursor.getInt(offset + 19));
        entity.setBuild_project_list_date(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20));
        entity.setBuild_list(cursor.getInt(offset + 21));
        entity.setBuild_list_date(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22));
        entity.setBuild_notice_files(cursor.getInt(offset + 23));
        entity.setBuild_notice_date(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24));
        entity.setPlan_offline_points(cursor.getInt(offset + 25));
        entity.setPlan_offline_date(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26));
     }
    
    @Override
    protected final String updateKeyAfterInsert(OfflineJobNeedData entity, long rowId) {
        return entity.getPlanDate();
    }
    
    @Override
    public String getKey(OfflineJobNeedData entity) {
        if(entity != null) {
            return entity.getPlanDate();
        } else {
            return null;
        }
    }

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

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