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.WmsWarehouse;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "wms_warehouse".
*/
public class WmsWarehouseDao extends AbstractDao<WmsWarehouse, Void> {

    public static final String TABLENAME = "wms_warehouse";

    /**
     * Properties of entity WmsWarehouse.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property WarehouseId = new Property(0, Long.class, "warehouseId", false, "warehouse_id");
        public final static Property WarehouseCode = new Property(1, String.class, "warehouseCode", false, "warehouse_code");
        public final static Property WarehouseName = new Property(2, String.class, "warehouseName", false, "warehouse_name");
        public final static Property WarehouseType = new Property(3, String.class, "warehouseType", false, "warehouse_type");
        public final static Property Area = new Property(4, Float.class, "area", false, "area");
        public final static Property Capacity = new Property(5, Float.class, "capacity", false, "capacity");
        public final static Property Location = new Property(6, String.class, "location", false, "location");
        public final static Property ManagerId = new Property(7, Long.class, "managerId", false, "manager_id");
        public final static Property Status = new Property(8, String.class, "status", false, "status");
        public final static Property DelFlag = new Property(9, String.class, "delFlag", false, "del_flag");
        public final static Property CreateTime = new Property(10, String.class, "createTime", false, "create_time");
        public final static Property UpdateTime = new Property(11, String.class, "updateTime", false, "update_time");
        public final static Property Remark = new Property(12, String.class, "remark", false, "remark");
    }


    public WmsWarehouseDao(DaoConfig config) {
        super(config);
    }
    
    public WmsWarehouseDao(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_warehouse\" (" + //
                "\"warehouse_id\" INTEGER," + // 0: warehouseId
                "\"warehouse_code\" TEXT," + // 1: warehouseCode
                "\"warehouse_name\" TEXT," + // 2: warehouseName
                "\"warehouse_type\" TEXT," + // 3: warehouseType
                "\"area\" REAL," + // 4: area
                "\"capacity\" REAL," + // 5: capacity
                "\"location\" TEXT," + // 6: location
                "\"manager_id\" INTEGER," + // 7: managerId
                "\"status\" TEXT," + // 8: status
                "\"del_flag\" TEXT," + // 9: delFlag
                "\"create_time\" TEXT," + // 10: createTime
                "\"update_time\" TEXT," + // 11: updateTime
                "\"remark\" TEXT);"); // 12: remark
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, WmsWarehouse entity) {
        stmt.clearBindings();
 
        Long warehouseId = entity.getWarehouseId();
        if (warehouseId != null) {
            stmt.bindLong(1, warehouseId);
        }
 
        String warehouseCode = entity.getWarehouseCode();
        if (warehouseCode != null) {
            stmt.bindString(2, warehouseCode);
        }
 
        String warehouseName = entity.getWarehouseName();
        if (warehouseName != null) {
            stmt.bindString(3, warehouseName);
        }
 
        String warehouseType = entity.getWarehouseType();
        if (warehouseType != null) {
            stmt.bindString(4, warehouseType);
        }
 
        Float area = entity.getArea();
        if (area != null) {
            stmt.bindDouble(5, area);
        }
 
        Float capacity = entity.getCapacity();
        if (capacity != null) {
            stmt.bindDouble(6, capacity);
        }
 
        String location = entity.getLocation();
        if (location != null) {
            stmt.bindString(7, location);
        }
 
        Long managerId = entity.getManagerId();
        if (managerId != null) {
            stmt.bindLong(8, managerId);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(9, status);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(10, delFlag);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(11, createTime);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(12, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(13, remark);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, WmsWarehouse entity) {
        stmt.clearBindings();
 
        Long warehouseId = entity.getWarehouseId();
        if (warehouseId != null) {
            stmt.bindLong(1, warehouseId);
        }
 
        String warehouseCode = entity.getWarehouseCode();
        if (warehouseCode != null) {
            stmt.bindString(2, warehouseCode);
        }
 
        String warehouseName = entity.getWarehouseName();
        if (warehouseName != null) {
            stmt.bindString(3, warehouseName);
        }
 
        String warehouseType = entity.getWarehouseType();
        if (warehouseType != null) {
            stmt.bindString(4, warehouseType);
        }
 
        Float area = entity.getArea();
        if (area != null) {
            stmt.bindDouble(5, area);
        }
 
        Float capacity = entity.getCapacity();
        if (capacity != null) {
            stmt.bindDouble(6, capacity);
        }
 
        String location = entity.getLocation();
        if (location != null) {
            stmt.bindString(7, location);
        }
 
        Long managerId = entity.getManagerId();
        if (managerId != null) {
            stmt.bindLong(8, managerId);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(9, status);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(10, delFlag);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(11, createTime);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(12, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(13, remark);
        }
    }

    @Override
    public Void readKey(Cursor cursor, int offset) {
        return null;
    }    

    @Override
    public WmsWarehouse readEntity(Cursor cursor, int offset) {
        WmsWarehouse entity = new WmsWarehouse( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // warehouseId
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // warehouseCode
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // warehouseName
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // warehouseType
            cursor.isNull(offset + 4) ? null : cursor.getFloat(offset + 4), // area
            cursor.isNull(offset + 5) ? null : cursor.getFloat(offset + 5), // capacity
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // location
            cursor.isNull(offset + 7) ? null : cursor.getLong(offset + 7), // managerId
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // status
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // delFlag
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // createTime
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // updateTime
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12) // remark
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, WmsWarehouse entity, int offset) {
        entity.setWarehouseId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setWarehouseCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setWarehouseName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setWarehouseType(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setArea(cursor.isNull(offset + 4) ? null : cursor.getFloat(offset + 4));
        entity.setCapacity(cursor.isNull(offset + 5) ? null : cursor.getFloat(offset + 5));
        entity.setLocation(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setManagerId(cursor.isNull(offset + 7) ? null : cursor.getLong(offset + 7));
        entity.setStatus(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setDelFlag(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setCreateTime(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setUpdateTime(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setRemark(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
     }
    
    @Override
    protected final Void updateKeyAfterInsert(WmsWarehouse entity, long rowId) {
        // Unsupported or missing PK type
        return null;
    }
    
    @Override
    public Void getKey(WmsWarehouse entity) {
        return null;
    }

    @Override
    public boolean hasKey(WmsWarehouse entity) {
        // TODO
        return false;
    }

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