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

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

    public static final String TABLENAME = "wms_area";

    /**
     * Properties of entity WmsArea.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property AreaId = new Property(0, Long.class, "areaId", false, "area_id");
        public final static Property AreaCode = new Property(1, String.class, "areaCode", false, "area_code");
        public final static Property AreaName = new Property(2, String.class, "areaName", false, "area_name");
        public final static Property WarehouseId = new Property(3, Integer.class, "warehouseId", false, "warehouse_id");
        public final static Property ParentId = new Property(4, Integer.class, "parentId", false, "parent_id");
        public final static Property AreaType = new Property(5, String.class, "areaType", false, "area_type");
        public final static Property TemperatureRange = new Property(6, String.class, "temperatureRange", false, "temperature_range");
        public final static Property HumidityRange = new Property(7, String.class, "humidityRange", false, "humidity_range");
        public final static Property Capacity = new Property(8, Float.class, "capacity", false, "capacity");
        public final static Property SortOrder = new Property(9, Integer.class, "sortOrder", false, "sort_order");
        public final static Property Status = new Property(10, String.class, "status", false, "status");
        public final static Property CreateBy = new Property(11, String.class, "createBy", false, "create_by");
        public final static Property CreateTime = new Property(12, String.class, "createTime", false, "create_time");
        public final static Property UpdateBy = new Property(13, String.class, "updateBy", false, "update_by");
        public final static Property UpdateTime = new Property(14, String.class, "updateTime", false, "update_time");
        public final static Property Remark = new Property(15, String.class, "remark", false, "remark");
        public final static Property DelFlag = new Property(16, String.class, "delFlag", false, "del_flag");
    }


    public WmsAreaDao(DaoConfig config) {
        super(config);
    }
    
    public WmsAreaDao(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_area\" (" + //
                "\"area_id\" INTEGER," + // 0: areaId
                "\"area_code\" TEXT," + // 1: areaCode
                "\"area_name\" TEXT," + // 2: areaName
                "\"warehouse_id\" INTEGER," + // 3: warehouseId
                "\"parent_id\" INTEGER," + // 4: parentId
                "\"area_type\" TEXT," + // 5: areaType
                "\"temperature_range\" TEXT," + // 6: temperatureRange
                "\"humidity_range\" TEXT," + // 7: humidityRange
                "\"capacity\" REAL," + // 8: capacity
                "\"sort_order\" INTEGER," + // 9: sortOrder
                "\"status\" TEXT," + // 10: status
                "\"create_by\" TEXT," + // 11: createBy
                "\"create_time\" TEXT," + // 12: createTime
                "\"update_by\" TEXT," + // 13: updateBy
                "\"update_time\" TEXT," + // 14: updateTime
                "\"remark\" TEXT," + // 15: remark
                "\"del_flag\" TEXT);"); // 16: delFlag
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, WmsArea entity) {
        stmt.clearBindings();
 
        Long areaId = entity.getAreaId();
        if (areaId != null) {
            stmt.bindLong(1, areaId);
        }
 
        String areaCode = entity.getAreaCode();
        if (areaCode != null) {
            stmt.bindString(2, areaCode);
        }
 
        String areaName = entity.getAreaName();
        if (areaName != null) {
            stmt.bindString(3, areaName);
        }
 
        Integer warehouseId = entity.getWarehouseId();
        if (warehouseId != null) {
            stmt.bindLong(4, warehouseId);
        }
 
        Integer parentId = entity.getParentId();
        if (parentId != null) {
            stmt.bindLong(5, parentId);
        }
 
        String areaType = entity.getAreaType();
        if (areaType != null) {
            stmt.bindString(6, areaType);
        }
 
        String temperatureRange = entity.getTemperatureRange();
        if (temperatureRange != null) {
            stmt.bindString(7, temperatureRange);
        }
 
        String humidityRange = entity.getHumidityRange();
        if (humidityRange != null) {
            stmt.bindString(8, humidityRange);
        }
 
        Float capacity = entity.getCapacity();
        if (capacity != null) {
            stmt.bindDouble(9, capacity);
        }
 
        Integer sortOrder = entity.getSortOrder();
        if (sortOrder != null) {
            stmt.bindLong(10, sortOrder);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(11, status);
        }
 
        String createBy = entity.getCreateBy();
        if (createBy != null) {
            stmt.bindString(12, createBy);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(13, createTime);
        }
 
        String updateBy = entity.getUpdateBy();
        if (updateBy != null) {
            stmt.bindString(14, updateBy);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(15, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(16, remark);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(17, delFlag);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, WmsArea entity) {
        stmt.clearBindings();
 
        Long areaId = entity.getAreaId();
        if (areaId != null) {
            stmt.bindLong(1, areaId);
        }
 
        String areaCode = entity.getAreaCode();
        if (areaCode != null) {
            stmt.bindString(2, areaCode);
        }
 
        String areaName = entity.getAreaName();
        if (areaName != null) {
            stmt.bindString(3, areaName);
        }
 
        Integer warehouseId = entity.getWarehouseId();
        if (warehouseId != null) {
            stmt.bindLong(4, warehouseId);
        }
 
        Integer parentId = entity.getParentId();
        if (parentId != null) {
            stmt.bindLong(5, parentId);
        }
 
        String areaType = entity.getAreaType();
        if (areaType != null) {
            stmt.bindString(6, areaType);
        }
 
        String temperatureRange = entity.getTemperatureRange();
        if (temperatureRange != null) {
            stmt.bindString(7, temperatureRange);
        }
 
        String humidityRange = entity.getHumidityRange();
        if (humidityRange != null) {
            stmt.bindString(8, humidityRange);
        }
 
        Float capacity = entity.getCapacity();
        if (capacity != null) {
            stmt.bindDouble(9, capacity);
        }
 
        Integer sortOrder = entity.getSortOrder();
        if (sortOrder != null) {
            stmt.bindLong(10, sortOrder);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(11, status);
        }
 
        String createBy = entity.getCreateBy();
        if (createBy != null) {
            stmt.bindString(12, createBy);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(13, createTime);
        }
 
        String updateBy = entity.getUpdateBy();
        if (updateBy != null) {
            stmt.bindString(14, updateBy);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(15, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(16, remark);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(17, delFlag);
        }
    }

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

    @Override
    public WmsArea readEntity(Cursor cursor, int offset) {
        WmsArea entity = new WmsArea( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // areaId
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // areaCode
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // areaName
            cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3), // warehouseId
            cursor.isNull(offset + 4) ? null : cursor.getInt(offset + 4), // parentId
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // areaType
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // temperatureRange
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // humidityRange
            cursor.isNull(offset + 8) ? null : cursor.getFloat(offset + 8), // capacity
            cursor.isNull(offset + 9) ? null : cursor.getInt(offset + 9), // sortOrder
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // status
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // createBy
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // createTime
            cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // updateBy
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // updateTime
            cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // remark
            cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16) // delFlag
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, WmsArea entity, int offset) {
        entity.setAreaId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setAreaCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setAreaName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setWarehouseId(cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3));
        entity.setParentId(cursor.isNull(offset + 4) ? null : cursor.getInt(offset + 4));
        entity.setAreaType(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setTemperatureRange(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setHumidityRange(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setCapacity(cursor.isNull(offset + 8) ? null : cursor.getFloat(offset + 8));
        entity.setSortOrder(cursor.isNull(offset + 9) ? null : cursor.getInt(offset + 9));
        entity.setStatus(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setCreateBy(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setCreateTime(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setUpdateBy(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
        entity.setUpdateTime(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setRemark(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
        entity.setDelFlag(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
     }
    
    @Override
    protected final Void updateKeyAfterInsert(WmsArea entity, long rowId) {
        // Unsupported or missing PK type
        return null;
    }
    
    @Override
    public Void getKey(WmsArea entity) {
        return null;
    }

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

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