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

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

    public static final String TABLENAME = "wms_inventory_result";

    /**
     * Properties of entity WmsInventoryResult.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property ResultId = new Property(0, Long.class, "resultId", true, "result_id");
        public final static Property TaskId = new Property(1, Integer.class, "taskId", false, "task_id");
        public final static Property PlanId = new Property(2, Integer.class, "planId", false, "plan_id");
        public final static Property WarehouseId = new Property(3, Integer.class, "warehouseId", false, "warehouse_id");
        public final static Property WarehouseName = new Property(4, String.class, "warehouseName", false, "warehouse_name");
        public final static Property AreaIds = new Property(5, String.class, "areaIds", false, "area_ids");
        public final static Property AreaName = new Property(6, String.class, "areaName", false, "area_name");
        public final static Property CheckerId = new Property(7, Integer.class, "checkerId", false, "checker_id");
        public final static Property CheckerName = new Property(8, String.class, "checkerName", false, "checker_name");
        public final static Property StartTime = new Property(9, String.class, "startTime", false, "start_time");
        public final static Property EndTime = new Property(10, String.class, "endTime", false, "end_time");
        public final static Property TotalItems = new Property(11, Integer.class, "totalItems", false, "total_items");
        public final static Property CountedItems = new Property(12, Integer.class, "countedItems", false, "counted_items");
        public final static Property SurplusItems = new Property(13, Integer.class, "surplusItems", false, "surplus_items");
        public final static Property DeficitItems = new Property(14, Integer.class, "deficitItems", false, "deficit_items");
        public final static Property TotalSurplus = new Property(15, Double.class, "totalSurplus", false, "total_surplus");
        public final static Property TotalDeficit = new Property(16, Double.class, "totalDeficit", false, "total_deficit");
        public final static Property TotalDifferenceValue = new Property(17, Double.class, "totalDifferenceValue", false, "total_difference_value");
        public final static Property DifferenceRate = new Property(18, Double.class, "differenceRate", false, "difference_rate");
        public final static Property ResultStatus = new Property(19, String.class, "resultStatus", false, "result_status");
        public final static Property AuditStatus = new Property(20, String.class, "auditStatus", false, "audit_status");
        public final static Property AuditorId = new Property(21, Integer.class, "auditorId", false, "auditor_id");
        public final static Property AuditorName = new Property(22, String.class, "auditorName", false, "auditor_name");
        public final static Property AuditTime = new Property(23, String.class, "auditTime", false, "audit_time");
        public final static Property AuditOpinion = new Property(24, String.class, "auditOpinion", false, "audit_opinion");
        public final static Property DelFlag = new Property(25, String.class, "delFlag", false, "del_flag");
        public final static Property CreateTime = new Property(26, String.class, "createTime", false, "create_time");
        public final static Property UpdateTime = new Property(27, String.class, "updateTime", false, "update_time");
        public final static Property Remark = new Property(28, String.class, "remark", false, "remark");
    }


    public WmsInventoryResultDao(DaoConfig config) {
        super(config);
    }
    
    public WmsInventoryResultDao(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_result\" (" + //
                "\"result_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: resultId
                "\"task_id\" INTEGER," + // 1: taskId
                "\"plan_id\" INTEGER," + // 2: planId
                "\"warehouse_id\" INTEGER," + // 3: warehouseId
                "\"warehouse_name\" TEXT," + // 4: warehouseName
                "\"area_ids\" TEXT," + // 5: areaIds
                "\"area_name\" TEXT," + // 6: areaName
                "\"checker_id\" INTEGER," + // 7: checkerId
                "\"checker_name\" TEXT," + // 8: checkerName
                "\"start_time\" TEXT," + // 9: startTime
                "\"end_time\" TEXT," + // 10: endTime
                "\"total_items\" INTEGER," + // 11: totalItems
                "\"counted_items\" INTEGER," + // 12: countedItems
                "\"surplus_items\" INTEGER," + // 13: surplusItems
                "\"deficit_items\" INTEGER," + // 14: deficitItems
                "\"total_surplus\" REAL," + // 15: totalSurplus
                "\"total_deficit\" REAL," + // 16: totalDeficit
                "\"total_difference_value\" REAL," + // 17: totalDifferenceValue
                "\"difference_rate\" REAL," + // 18: differenceRate
                "\"result_status\" TEXT," + // 19: resultStatus
                "\"audit_status\" TEXT," + // 20: auditStatus
                "\"auditor_id\" INTEGER," + // 21: auditorId
                "\"auditor_name\" TEXT," + // 22: auditorName
                "\"audit_time\" TEXT," + // 23: auditTime
                "\"audit_opinion\" TEXT," + // 24: auditOpinion
                "\"del_flag\" TEXT," + // 25: delFlag
                "\"create_time\" TEXT," + // 26: createTime
                "\"update_time\" TEXT," + // 27: updateTime
                "\"remark\" TEXT);"); // 28: remark
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, WmsInventoryResult entity) {
        stmt.clearBindings();
 
        Long resultId = entity.getResultId();
        if (resultId != null) {
            stmt.bindLong(1, resultId);
        }
 
        Integer taskId = entity.getTaskId();
        if (taskId != null) {
            stmt.bindLong(2, taskId);
        }
 
        Integer planId = entity.getPlanId();
        if (planId != null) {
            stmt.bindLong(3, planId);
        }
 
        Integer warehouseId = entity.getWarehouseId();
        if (warehouseId != null) {
            stmt.bindLong(4, warehouseId);
        }
 
        String warehouseName = entity.getWarehouseName();
        if (warehouseName != null) {
            stmt.bindString(5, warehouseName);
        }
 
        String areaIds = entity.getAreaIds();
        if (areaIds != null) {
            stmt.bindString(6, areaIds);
        }
 
        String areaName = entity.getAreaName();
        if (areaName != null) {
            stmt.bindString(7, areaName);
        }
 
        Integer checkerId = entity.getCheckerId();
        if (checkerId != null) {
            stmt.bindLong(8, checkerId);
        }
 
        String checkerName = entity.getCheckerName();
        if (checkerName != null) {
            stmt.bindString(9, checkerName);
        }
 
        String startTime = entity.getStartTime();
        if (startTime != null) {
            stmt.bindString(10, startTime);
        }
 
        String endTime = entity.getEndTime();
        if (endTime != null) {
            stmt.bindString(11, endTime);
        }
 
        Integer totalItems = entity.getTotalItems();
        if (totalItems != null) {
            stmt.bindLong(12, totalItems);
        }
 
        Integer countedItems = entity.getCountedItems();
        if (countedItems != null) {
            stmt.bindLong(13, countedItems);
        }
 
        Integer surplusItems = entity.getSurplusItems();
        if (surplusItems != null) {
            stmt.bindLong(14, surplusItems);
        }
 
        Integer deficitItems = entity.getDeficitItems();
        if (deficitItems != null) {
            stmt.bindLong(15, deficitItems);
        }
 
        Double totalSurplus = entity.getTotalSurplus();
        if (totalSurplus != null) {
            stmt.bindDouble(16, totalSurplus);
        }
 
        Double totalDeficit = entity.getTotalDeficit();
        if (totalDeficit != null) {
            stmt.bindDouble(17, totalDeficit);
        }
 
        Double totalDifferenceValue = entity.getTotalDifferenceValue();
        if (totalDifferenceValue != null) {
            stmt.bindDouble(18, totalDifferenceValue);
        }
 
        Double differenceRate = entity.getDifferenceRate();
        if (differenceRate != null) {
            stmt.bindDouble(19, differenceRate);
        }
 
        String resultStatus = entity.getResultStatus();
        if (resultStatus != null) {
            stmt.bindString(20, resultStatus);
        }
 
        String auditStatus = entity.getAuditStatus();
        if (auditStatus != null) {
            stmt.bindString(21, auditStatus);
        }
 
        Integer auditorId = entity.getAuditorId();
        if (auditorId != null) {
            stmt.bindLong(22, auditorId);
        }
 
        String auditorName = entity.getAuditorName();
        if (auditorName != null) {
            stmt.bindString(23, auditorName);
        }
 
        String auditTime = entity.getAuditTime();
        if (auditTime != null) {
            stmt.bindString(24, auditTime);
        }
 
        String auditOpinion = entity.getAuditOpinion();
        if (auditOpinion != null) {
            stmt.bindString(25, auditOpinion);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(26, delFlag);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(27, createTime);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(28, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(29, remark);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, WmsInventoryResult entity) {
        stmt.clearBindings();
 
        Long resultId = entity.getResultId();
        if (resultId != null) {
            stmt.bindLong(1, resultId);
        }
 
        Integer taskId = entity.getTaskId();
        if (taskId != null) {
            stmt.bindLong(2, taskId);
        }
 
        Integer planId = entity.getPlanId();
        if (planId != null) {
            stmt.bindLong(3, planId);
        }
 
        Integer warehouseId = entity.getWarehouseId();
        if (warehouseId != null) {
            stmt.bindLong(4, warehouseId);
        }
 
        String warehouseName = entity.getWarehouseName();
        if (warehouseName != null) {
            stmt.bindString(5, warehouseName);
        }
 
        String areaIds = entity.getAreaIds();
        if (areaIds != null) {
            stmt.bindString(6, areaIds);
        }
 
        String areaName = entity.getAreaName();
        if (areaName != null) {
            stmt.bindString(7, areaName);
        }
 
        Integer checkerId = entity.getCheckerId();
        if (checkerId != null) {
            stmt.bindLong(8, checkerId);
        }
 
        String checkerName = entity.getCheckerName();
        if (checkerName != null) {
            stmt.bindString(9, checkerName);
        }
 
        String startTime = entity.getStartTime();
        if (startTime != null) {
            stmt.bindString(10, startTime);
        }
 
        String endTime = entity.getEndTime();
        if (endTime != null) {
            stmt.bindString(11, endTime);
        }
 
        Integer totalItems = entity.getTotalItems();
        if (totalItems != null) {
            stmt.bindLong(12, totalItems);
        }
 
        Integer countedItems = entity.getCountedItems();
        if (countedItems != null) {
            stmt.bindLong(13, countedItems);
        }
 
        Integer surplusItems = entity.getSurplusItems();
        if (surplusItems != null) {
            stmt.bindLong(14, surplusItems);
        }
 
        Integer deficitItems = entity.getDeficitItems();
        if (deficitItems != null) {
            stmt.bindLong(15, deficitItems);
        }
 
        Double totalSurplus = entity.getTotalSurplus();
        if (totalSurplus != null) {
            stmt.bindDouble(16, totalSurplus);
        }
 
        Double totalDeficit = entity.getTotalDeficit();
        if (totalDeficit != null) {
            stmt.bindDouble(17, totalDeficit);
        }
 
        Double totalDifferenceValue = entity.getTotalDifferenceValue();
        if (totalDifferenceValue != null) {
            stmt.bindDouble(18, totalDifferenceValue);
        }
 
        Double differenceRate = entity.getDifferenceRate();
        if (differenceRate != null) {
            stmt.bindDouble(19, differenceRate);
        }
 
        String resultStatus = entity.getResultStatus();
        if (resultStatus != null) {
            stmt.bindString(20, resultStatus);
        }
 
        String auditStatus = entity.getAuditStatus();
        if (auditStatus != null) {
            stmt.bindString(21, auditStatus);
        }
 
        Integer auditorId = entity.getAuditorId();
        if (auditorId != null) {
            stmt.bindLong(22, auditorId);
        }
 
        String auditorName = entity.getAuditorName();
        if (auditorName != null) {
            stmt.bindString(23, auditorName);
        }
 
        String auditTime = entity.getAuditTime();
        if (auditTime != null) {
            stmt.bindString(24, auditTime);
        }
 
        String auditOpinion = entity.getAuditOpinion();
        if (auditOpinion != null) {
            stmt.bindString(25, auditOpinion);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(26, delFlag);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(27, createTime);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(28, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(29, remark);
        }
    }

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

    @Override
    public WmsInventoryResult readEntity(Cursor cursor, int offset) {
        WmsInventoryResult entity = new WmsInventoryResult( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // resultId
            cursor.isNull(offset + 1) ? null : cursor.getInt(offset + 1), // taskId
            cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2), // planId
            cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3), // warehouseId
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // warehouseName
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // areaIds
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // areaName
            cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7), // checkerId
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // checkerName
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // startTime
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // endTime
            cursor.isNull(offset + 11) ? null : cursor.getInt(offset + 11), // totalItems
            cursor.isNull(offset + 12) ? null : cursor.getInt(offset + 12), // countedItems
            cursor.isNull(offset + 13) ? null : cursor.getInt(offset + 13), // surplusItems
            cursor.isNull(offset + 14) ? null : cursor.getInt(offset + 14), // deficitItems
            cursor.isNull(offset + 15) ? null : cursor.getDouble(offset + 15), // totalSurplus
            cursor.isNull(offset + 16) ? null : cursor.getDouble(offset + 16), // totalDeficit
            cursor.isNull(offset + 17) ? null : cursor.getDouble(offset + 17), // totalDifferenceValue
            cursor.isNull(offset + 18) ? null : cursor.getDouble(offset + 18), // differenceRate
            cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // resultStatus
            cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // auditStatus
            cursor.isNull(offset + 21) ? null : cursor.getInt(offset + 21), // auditorId
            cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // auditorName
            cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // auditTime
            cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // auditOpinion
            cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // delFlag
            cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // createTime
            cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // updateTime
            cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28) // remark
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, WmsInventoryResult entity, int offset) {
        entity.setResultId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getInt(offset + 1));
        entity.setPlanId(cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2));
        entity.setWarehouseId(cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3));
        entity.setWarehouseName(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setAreaIds(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setAreaName(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setCheckerId(cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7));
        entity.setCheckerName(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setStartTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setEndTime(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setTotalItems(cursor.isNull(offset + 11) ? null : cursor.getInt(offset + 11));
        entity.setCountedItems(cursor.isNull(offset + 12) ? null : cursor.getInt(offset + 12));
        entity.setSurplusItems(cursor.isNull(offset + 13) ? null : cursor.getInt(offset + 13));
        entity.setDeficitItems(cursor.isNull(offset + 14) ? null : cursor.getInt(offset + 14));
        entity.setTotalSurplus(cursor.isNull(offset + 15) ? null : cursor.getDouble(offset + 15));
        entity.setTotalDeficit(cursor.isNull(offset + 16) ? null : cursor.getDouble(offset + 16));
        entity.setTotalDifferenceValue(cursor.isNull(offset + 17) ? null : cursor.getDouble(offset + 17));
        entity.setDifferenceRate(cursor.isNull(offset + 18) ? null : cursor.getDouble(offset + 18));
        entity.setResultStatus(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
        entity.setAuditStatus(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20));
        entity.setAuditorId(cursor.isNull(offset + 21) ? null : cursor.getInt(offset + 21));
        entity.setAuditorName(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22));
        entity.setAuditTime(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23));
        entity.setAuditOpinion(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24));
        entity.setDelFlag(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25));
        entity.setCreateTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26));
        entity.setUpdateTime(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27));
        entity.setRemark(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(WmsInventoryResult entity, long rowId) {
        entity.setResultId(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(WmsInventoryResult entity) {
        if(entity != null) {
            return entity.getResultId();
        } else {
            return null;
        }
    }

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

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