package sql.com.yz.db;

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.sxyz.rfid.greendao.model.WmsInventoryTask;

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

    public static final String TABLENAME = "wms_inventory_task";

    /**
     * Properties of entity WmsInventoryTask.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property TaskId = new Property(0, Long.class, "taskId", true, "task_id");
        public final static Property PlanId = new Property(1, Integer.class, "planId", false, "plan_id");
        public final static Property TaskNo = new Property(2, String.class, "taskNo", false, "task_no");
        public final static Property TaskName = new Property(3, String.class, "taskName", false, "task_name");
        public final static Property WarehouseId = new Property(4, Integer.class, "warehouseId", false, "warehouse_id");
        public final static Property WarehouseName = new Property(5, String.class, "warehouseName", false, "warehouse_name");
        public final static Property AreaIds = new Property(6, String.class, "areaIds", false, "area_ids");
        public final static Property AreaName = new Property(7, String.class, "areaName", false, "area_name");
        public final static Property MaterialIds = new Property(8, String.class, "materialIds", false, "material_ids");
        public final static Property LocationRange = new Property(9, String.class, "locationRange", false, "location_range");
        public final static Property AssigneeId = new Property(10, Integer.class, "assigneeId", false, "assignee_id");
        public final static Property AssistantIds = new Property(11, String.class, "assistantIds", false, "assistant_ids");
        public final static Property TaskStatus = new Property(12, String.class, "taskStatus", false, "task_status");
        public final static Property StartTime = new Property(13, String.class, "startTime", false, "start_time");
        public final static Property EndTime = new Property(14, String.class, "endTime", false, "end_time");
        public final static Property TotalItems = new Property(15, Integer.class, "totalItems", false, "total_items");
        public final static Property CountedItems = new Property(16, Integer.class, "countedItems", false, "counted_items");
        public final static Property InventoryDevice = new Property(17, String.class, "inventoryDevice", false, "inventory_device");
        public final static Property DelFlag = new Property(18, String.class, "delFlag", false, "del_flag");
        public final static Property CreateTime = new Property(19, String.class, "createTime", false, "create_time");
        public final static Property UpdateTime = new Property(20, String.class, "updateTime", false, "update_time");
        public final static Property Remark = new Property(21, String.class, "remark", false, "remark");
    }


    public WmsInventoryTaskDao(DaoConfig config) {
        super(config);
    }
    
    public WmsInventoryTaskDao(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 + "\"wms_inventory_task\" (" + //
                "\"task_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: taskId
                "\"plan_id\" INTEGER," + // 1: planId
                "\"task_no\" TEXT," + // 2: taskNo
                "\"task_name\" TEXT," + // 3: taskName
                "\"warehouse_id\" INTEGER," + // 4: warehouseId
                "\"warehouse_name\" TEXT," + // 5: warehouseName
                "\"area_ids\" TEXT," + // 6: areaIds
                "\"area_name\" TEXT," + // 7: areaName
                "\"material_ids\" TEXT," + // 8: materialIds
                "\"location_range\" TEXT," + // 9: locationRange
                "\"assignee_id\" INTEGER," + // 10: assigneeId
                "\"assistant_ids\" TEXT," + // 11: assistantIds
                "\"task_status\" TEXT," + // 12: taskStatus
                "\"start_time\" TEXT," + // 13: startTime
                "\"end_time\" TEXT," + // 14: endTime
                "\"total_items\" INTEGER," + // 15: totalItems
                "\"counted_items\" INTEGER," + // 16: countedItems
                "\"inventory_device\" TEXT," + // 17: inventoryDevice
                "\"del_flag\" TEXT," + // 18: delFlag
                "\"create_time\" TEXT," + // 19: createTime
                "\"update_time\" TEXT," + // 20: updateTime
                "\"remark\" TEXT);"); // 21: remark
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, WmsInventoryTask entity) {
        stmt.clearBindings();
 
        Long taskId = entity.getTaskId();
        if (taskId != null) {
            stmt.bindLong(1, taskId);
        }
 
        Integer planId = entity.getPlanId();
        if (planId != null) {
            stmt.bindLong(2, planId);
        }
 
        String taskNo = entity.getTaskNo();
        if (taskNo != null) {
            stmt.bindString(3, taskNo);
        }
 
        String taskName = entity.getTaskName();
        if (taskName != null) {
            stmt.bindString(4, taskName);
        }
 
        Integer warehouseId = entity.getWarehouseId();
        if (warehouseId != null) {
            stmt.bindLong(5, warehouseId);
        }
 
        String warehouseName = entity.getWarehouseName();
        if (warehouseName != null) {
            stmt.bindString(6, warehouseName);
        }
 
        String areaIds = entity.getAreaIds();
        if (areaIds != null) {
            stmt.bindString(7, areaIds);
        }
 
        String areaName = entity.getAreaName();
        if (areaName != null) {
            stmt.bindString(8, areaName);
        }
 
        String materialIds = entity.getMaterialIds();
        if (materialIds != null) {
            stmt.bindString(9, materialIds);
        }
 
        String locationRange = entity.getLocationRange();
        if (locationRange != null) {
            stmt.bindString(10, locationRange);
        }
 
        Integer assigneeId = entity.getAssigneeId();
        if (assigneeId != null) {
            stmt.bindLong(11, assigneeId);
        }
 
        String assistantIds = entity.getAssistantIds();
        if (assistantIds != null) {
            stmt.bindString(12, assistantIds);
        }
 
        String taskStatus = entity.getTaskStatus();
        if (taskStatus != null) {
            stmt.bindString(13, taskStatus);
        }
 
        String startTime = entity.getStartTime();
        if (startTime != null) {
            stmt.bindString(14, startTime);
        }
 
        String endTime = entity.getEndTime();
        if (endTime != null) {
            stmt.bindString(15, endTime);
        }
 
        Integer totalItems = entity.getTotalItems();
        if (totalItems != null) {
            stmt.bindLong(16, totalItems);
        }
 
        Integer countedItems = entity.getCountedItems();
        if (countedItems != null) {
            stmt.bindLong(17, countedItems);
        }
 
        String inventoryDevice = entity.getInventoryDevice();
        if (inventoryDevice != null) {
            stmt.bindString(18, inventoryDevice);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(19, delFlag);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(20, createTime);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(21, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(22, remark);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, WmsInventoryTask entity) {
        stmt.clearBindings();
 
        Long taskId = entity.getTaskId();
        if (taskId != null) {
            stmt.bindLong(1, taskId);
        }
 
        Integer planId = entity.getPlanId();
        if (planId != null) {
            stmt.bindLong(2, planId);
        }
 
        String taskNo = entity.getTaskNo();
        if (taskNo != null) {
            stmt.bindString(3, taskNo);
        }
 
        String taskName = entity.getTaskName();
        if (taskName != null) {
            stmt.bindString(4, taskName);
        }
 
        Integer warehouseId = entity.getWarehouseId();
        if (warehouseId != null) {
            stmt.bindLong(5, warehouseId);
        }
 
        String warehouseName = entity.getWarehouseName();
        if (warehouseName != null) {
            stmt.bindString(6, warehouseName);
        }
 
        String areaIds = entity.getAreaIds();
        if (areaIds != null) {
            stmt.bindString(7, areaIds);
        }
 
        String areaName = entity.getAreaName();
        if (areaName != null) {
            stmt.bindString(8, areaName);
        }
 
        String materialIds = entity.getMaterialIds();
        if (materialIds != null) {
            stmt.bindString(9, materialIds);
        }
 
        String locationRange = entity.getLocationRange();
        if (locationRange != null) {
            stmt.bindString(10, locationRange);
        }
 
        Integer assigneeId = entity.getAssigneeId();
        if (assigneeId != null) {
            stmt.bindLong(11, assigneeId);
        }
 
        String assistantIds = entity.getAssistantIds();
        if (assistantIds != null) {
            stmt.bindString(12, assistantIds);
        }
 
        String taskStatus = entity.getTaskStatus();
        if (taskStatus != null) {
            stmt.bindString(13, taskStatus);
        }
 
        String startTime = entity.getStartTime();
        if (startTime != null) {
            stmt.bindString(14, startTime);
        }
 
        String endTime = entity.getEndTime();
        if (endTime != null) {
            stmt.bindString(15, endTime);
        }
 
        Integer totalItems = entity.getTotalItems();
        if (totalItems != null) {
            stmt.bindLong(16, totalItems);
        }
 
        Integer countedItems = entity.getCountedItems();
        if (countedItems != null) {
            stmt.bindLong(17, countedItems);
        }
 
        String inventoryDevice = entity.getInventoryDevice();
        if (inventoryDevice != null) {
            stmt.bindString(18, inventoryDevice);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(19, delFlag);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(20, createTime);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(21, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(22, remark);
        }
    }

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

    @Override
    public WmsInventoryTask readEntity(Cursor cursor, int offset) {
        WmsInventoryTask entity = new WmsInventoryTask( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // taskId
            cursor.isNull(offset + 1) ? null : cursor.getInt(offset + 1), // planId
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskNo
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // taskName
            cursor.isNull(offset + 4) ? null : cursor.getInt(offset + 4), // warehouseId
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // warehouseName
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // areaIds
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // areaName
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // materialIds
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // locationRange
            cursor.isNull(offset + 10) ? null : cursor.getInt(offset + 10), // assigneeId
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // assistantIds
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // taskStatus
            cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // startTime
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // endTime
            cursor.isNull(offset + 15) ? null : cursor.getInt(offset + 15), // totalItems
            cursor.isNull(offset + 16) ? null : cursor.getInt(offset + 16), // countedItems
            cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // inventoryDevice
            cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // delFlag
            cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // createTime
            cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // updateTime
            cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21) // remark
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, WmsInventoryTask entity, int offset) {
        entity.setTaskId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setPlanId(cursor.isNull(offset + 1) ? null : cursor.getInt(offset + 1));
        entity.setTaskNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setTaskName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setWarehouseId(cursor.isNull(offset + 4) ? null : cursor.getInt(offset + 4));
        entity.setWarehouseName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setAreaIds(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setAreaName(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setMaterialIds(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setLocationRange(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setAssigneeId(cursor.isNull(offset + 10) ? null : cursor.getInt(offset + 10));
        entity.setAssistantIds(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setTaskStatus(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setStartTime(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
        entity.setEndTime(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setTotalItems(cursor.isNull(offset + 15) ? null : cursor.getInt(offset + 15));
        entity.setCountedItems(cursor.isNull(offset + 16) ? null : cursor.getInt(offset + 16));
        entity.setInventoryDevice(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
        entity.setDelFlag(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
        entity.setCreateTime(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
        entity.setUpdateTime(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20));
        entity.setRemark(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(WmsInventoryTask entity, long rowId) {
        entity.setTaskId(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(WmsInventoryTask entity) {
        if(entity != null) {
            return entity.getTaskId();
        } else {
            return null;
        }
    }

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

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