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

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

    public static final String TABLENAME = "wms_location";

    /**
     * Properties of entity WmsLocation.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property LocationId = new Property(0, Long.class, "locationId", false, "location_id");
        public final static Property LocationCode = new Property(1, String.class, "locationCode", false, "location_code");
        public final static Property LocationName = new Property(2, String.class, "locationName", false, "location_name");
        public final static Property AreaId = new Property(3, Integer.class, "areaId", false, "area_id");
        public final static Property LocationType = new Property(4, String.class, "locationType", false, "location_type");
        public final static Property XCoordinate = new Property(5, Integer.class, "xCoordinate", false, "x_coordinate");
        public final static Property YCoordinate = new Property(6, Integer.class, "yCoordinate", false, "y_coordinate");
        public final static Property ZCoordinate = new Property(7, Integer.class, "zCoordinate", false, "z_coordinate");
        public final static Property MaxCapacity = new Property(8, Float.class, "maxCapacity", false, "max_capacity");
        public final static Property CurrentCapacity = new Property(9, Float.class, "currentCapacity", false, "current_capacity");
        public final static Property WeightLimit = new Property(10, Float.class, "weightLimit", false, "weight_limit");
        public final static Property Length = new Property(11, Float.class, "length", false, "length");
        public final static Property Width = new Property(12, Float.class, "width", false, "width");
        public final static Property Height = new Property(13, Float.class, "height", false, "height");
        public final static Property Status = new Property(14, String.class, "status", false, "status");
        public final static Property RfidAntennaId = new Property(15, String.class, "rfidAntennaId", false, "rfid_antenna_id");
        public final static Property LastInventoryTime = new Property(16, String.class, "lastInventoryTime", false, "last_inventory_time");
        public final static Property DelFlag = new Property(17, String.class, "delFlag", false, "del_flag");
        public final static Property CreateTime = new Property(18, String.class, "createTime", false, "create_time");
        public final static Property UpdateTime = new Property(19, String.class, "updateTime", false, "update_time");
        public final static Property Remark = new Property(20, String.class, "remark", false, "remark");
    }


    public WmsLocationDao(DaoConfig config) {
        super(config);
    }
    
    public WmsLocationDao(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_location\" (" + //
                "\"location_id\" INTEGER," + // 0: locationId
                "\"location_code\" TEXT," + // 1: locationCode
                "\"location_name\" TEXT," + // 2: locationName
                "\"area_id\" INTEGER," + // 3: areaId
                "\"location_type\" TEXT," + // 4: locationType
                "\"x_coordinate\" INTEGER," + // 5: xCoordinate
                "\"y_coordinate\" INTEGER," + // 6: yCoordinate
                "\"z_coordinate\" INTEGER," + // 7: zCoordinate
                "\"max_capacity\" REAL," + // 8: maxCapacity
                "\"current_capacity\" REAL," + // 9: currentCapacity
                "\"weight_limit\" REAL," + // 10: weightLimit
                "\"length\" REAL," + // 11: length
                "\"width\" REAL," + // 12: width
                "\"height\" REAL," + // 13: height
                "\"status\" TEXT," + // 14: status
                "\"rfid_antenna_id\" TEXT," + // 15: rfidAntennaId
                "\"last_inventory_time\" TEXT," + // 16: lastInventoryTime
                "\"del_flag\" TEXT," + // 17: delFlag
                "\"create_time\" TEXT," + // 18: createTime
                "\"update_time\" TEXT," + // 19: updateTime
                "\"remark\" TEXT);"); // 20: remark
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, WmsLocation entity) {
        stmt.clearBindings();
 
        Long locationId = entity.getLocationId();
        if (locationId != null) {
            stmt.bindLong(1, locationId);
        }
 
        String locationCode = entity.getLocationCode();
        if (locationCode != null) {
            stmt.bindString(2, locationCode);
        }
 
        String locationName = entity.getLocationName();
        if (locationName != null) {
            stmt.bindString(3, locationName);
        }
 
        Integer areaId = entity.getAreaId();
        if (areaId != null) {
            stmt.bindLong(4, areaId);
        }
 
        String locationType = entity.getLocationType();
        if (locationType != null) {
            stmt.bindString(5, locationType);
        }
 
        Integer xCoordinate = entity.getXCoordinate();
        if (xCoordinate != null) {
            stmt.bindLong(6, xCoordinate);
        }
 
        Integer yCoordinate = entity.getYCoordinate();
        if (yCoordinate != null) {
            stmt.bindLong(7, yCoordinate);
        }
 
        Integer zCoordinate = entity.getZCoordinate();
        if (zCoordinate != null) {
            stmt.bindLong(8, zCoordinate);
        }
 
        Float maxCapacity = entity.getMaxCapacity();
        if (maxCapacity != null) {
            stmt.bindDouble(9, maxCapacity);
        }
 
        Float currentCapacity = entity.getCurrentCapacity();
        if (currentCapacity != null) {
            stmt.bindDouble(10, currentCapacity);
        }
 
        Float weightLimit = entity.getWeightLimit();
        if (weightLimit != null) {
            stmt.bindDouble(11, weightLimit);
        }
 
        Float length = entity.getLength();
        if (length != null) {
            stmt.bindDouble(12, length);
        }
 
        Float width = entity.getWidth();
        if (width != null) {
            stmt.bindDouble(13, width);
        }
 
        Float height = entity.getHeight();
        if (height != null) {
            stmt.bindDouble(14, height);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(15, status);
        }
 
        String rfidAntennaId = entity.getRfidAntennaId();
        if (rfidAntennaId != null) {
            stmt.bindString(16, rfidAntennaId);
        }
 
        String lastInventoryTime = entity.getLastInventoryTime();
        if (lastInventoryTime != null) {
            stmt.bindString(17, lastInventoryTime);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(18, delFlag);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(19, createTime);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(20, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(21, remark);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, WmsLocation entity) {
        stmt.clearBindings();
 
        Long locationId = entity.getLocationId();
        if (locationId != null) {
            stmt.bindLong(1, locationId);
        }
 
        String locationCode = entity.getLocationCode();
        if (locationCode != null) {
            stmt.bindString(2, locationCode);
        }
 
        String locationName = entity.getLocationName();
        if (locationName != null) {
            stmt.bindString(3, locationName);
        }
 
        Integer areaId = entity.getAreaId();
        if (areaId != null) {
            stmt.bindLong(4, areaId);
        }
 
        String locationType = entity.getLocationType();
        if (locationType != null) {
            stmt.bindString(5, locationType);
        }
 
        Integer xCoordinate = entity.getXCoordinate();
        if (xCoordinate != null) {
            stmt.bindLong(6, xCoordinate);
        }
 
        Integer yCoordinate = entity.getYCoordinate();
        if (yCoordinate != null) {
            stmt.bindLong(7, yCoordinate);
        }
 
        Integer zCoordinate = entity.getZCoordinate();
        if (zCoordinate != null) {
            stmt.bindLong(8, zCoordinate);
        }
 
        Float maxCapacity = entity.getMaxCapacity();
        if (maxCapacity != null) {
            stmt.bindDouble(9, maxCapacity);
        }
 
        Float currentCapacity = entity.getCurrentCapacity();
        if (currentCapacity != null) {
            stmt.bindDouble(10, currentCapacity);
        }
 
        Float weightLimit = entity.getWeightLimit();
        if (weightLimit != null) {
            stmt.bindDouble(11, weightLimit);
        }
 
        Float length = entity.getLength();
        if (length != null) {
            stmt.bindDouble(12, length);
        }
 
        Float width = entity.getWidth();
        if (width != null) {
            stmt.bindDouble(13, width);
        }
 
        Float height = entity.getHeight();
        if (height != null) {
            stmt.bindDouble(14, height);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(15, status);
        }
 
        String rfidAntennaId = entity.getRfidAntennaId();
        if (rfidAntennaId != null) {
            stmt.bindString(16, rfidAntennaId);
        }
 
        String lastInventoryTime = entity.getLastInventoryTime();
        if (lastInventoryTime != null) {
            stmt.bindString(17, lastInventoryTime);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(18, delFlag);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(19, createTime);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(20, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(21, remark);
        }
    }

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

    @Override
    public WmsLocation readEntity(Cursor cursor, int offset) {
        WmsLocation entity = new WmsLocation( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // locationId
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // locationCode
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationName
            cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3), // areaId
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // locationType
            cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5), // xCoordinate
            cursor.isNull(offset + 6) ? null : cursor.getInt(offset + 6), // yCoordinate
            cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7), // zCoordinate
            cursor.isNull(offset + 8) ? null : cursor.getFloat(offset + 8), // maxCapacity
            cursor.isNull(offset + 9) ? null : cursor.getFloat(offset + 9), // currentCapacity
            cursor.isNull(offset + 10) ? null : cursor.getFloat(offset + 10), // weightLimit
            cursor.isNull(offset + 11) ? null : cursor.getFloat(offset + 11), // length
            cursor.isNull(offset + 12) ? null : cursor.getFloat(offset + 12), // width
            cursor.isNull(offset + 13) ? null : cursor.getFloat(offset + 13), // height
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // status
            cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // rfidAntennaId
            cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lastInventoryTime
            cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // delFlag
            cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // createTime
            cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // updateTime
            cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20) // remark
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, WmsLocation entity, int offset) {
        entity.setLocationId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setLocationCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setLocationName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setAreaId(cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3));
        entity.setLocationType(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setXCoordinate(cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5));
        entity.setYCoordinate(cursor.isNull(offset + 6) ? null : cursor.getInt(offset + 6));
        entity.setZCoordinate(cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7));
        entity.setMaxCapacity(cursor.isNull(offset + 8) ? null : cursor.getFloat(offset + 8));
        entity.setCurrentCapacity(cursor.isNull(offset + 9) ? null : cursor.getFloat(offset + 9));
        entity.setWeightLimit(cursor.isNull(offset + 10) ? null : cursor.getFloat(offset + 10));
        entity.setLength(cursor.isNull(offset + 11) ? null : cursor.getFloat(offset + 11));
        entity.setWidth(cursor.isNull(offset + 12) ? null : cursor.getFloat(offset + 12));
        entity.setHeight(cursor.isNull(offset + 13) ? null : cursor.getFloat(offset + 13));
        entity.setStatus(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setRfidAntennaId(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
        entity.setLastInventoryTime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
        entity.setDelFlag(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
        entity.setCreateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
        entity.setUpdateTime(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
        entity.setRemark(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20));
     }
    
    @Override
    protected final Void updateKeyAfterInsert(WmsLocation entity, long rowId) {
        // Unsupported or missing PK type
        return null;
    }
    
    @Override
    public Void getKey(WmsLocation entity) {
        return null;
    }

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

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