package com.phlx.anchorcollect_p.db.gen;

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.phlx.anchorcollect_p.entity.DictEntity;

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

    public static final String TABLENAME = "DICT_ENTITY";

    /**
     * Properties of entity DictEntity.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property DictCode = new Property(0, String.class, "dictCode", false, "DICT_CODE");
        public final static Property DictSort = new Property(1, String.class, "dictSort", false, "DICT_SORT");
        public final static Property DictLabel = new Property(2, String.class, "dictLabel", false, "DICT_LABEL");
        public final static Property DictValue = new Property(3, String.class, "dictValue", false, "DICT_VALUE");
        public final static Property DictType = new Property(4, String.class, "dictType", false, "DICT_TYPE");
        public final static Property CssClass = new Property(5, String.class, "cssClass", false, "CSS_CLASS");
        public final static Property ListClass = new Property(6, String.class, "listClass", false, "LIST_CLASS");
        public final static Property IsDefault = new Property(7, String.class, "isDefault", false, "IS_DEFAULT");
        public final static Property Status = new Property(8, String.class, "status", false, "STATUS");
        public final static Property CreateBy = new Property(9, String.class, "createBy", false, "CREATE_BY");
        public final static Property CreateTime = new Property(10, String.class, "createTime", false, "CREATE_TIME");
        public final static Property UpdateBy = new Property(11, String.class, "updateBy", false, "UPDATE_BY");
        public final static Property UpdateTime = new Property(12, String.class, "updateTime", false, "UPDATE_TIME");
        public final static Property Remark = new Property(13, String.class, "remark", false, "REMARK");
    }


    public DictEntityDao(DaoConfig config) {
        super(config);
    }
    
    public DictEntityDao(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 + "\"DICT_ENTITY\" (" + //
                "\"DICT_CODE\" TEXT," + // 0: dictCode
                "\"DICT_SORT\" TEXT," + // 1: dictSort
                "\"DICT_LABEL\" TEXT," + // 2: dictLabel
                "\"DICT_VALUE\" TEXT," + // 3: dictValue
                "\"DICT_TYPE\" TEXT," + // 4: dictType
                "\"CSS_CLASS\" TEXT," + // 5: cssClass
                "\"LIST_CLASS\" TEXT," + // 6: listClass
                "\"IS_DEFAULT\" TEXT," + // 7: isDefault
                "\"STATUS\" TEXT," + // 8: status
                "\"CREATE_BY\" TEXT," + // 9: createBy
                "\"CREATE_TIME\" TEXT," + // 10: createTime
                "\"UPDATE_BY\" TEXT," + // 11: updateBy
                "\"UPDATE_TIME\" TEXT," + // 12: updateTime
                "\"REMARK\" TEXT);"); // 13: remark
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, DictEntity entity) {
        stmt.clearBindings();
 
        String dictCode = entity.getDictCode();
        if (dictCode != null) {
            stmt.bindString(1, dictCode);
        }
 
        String dictSort = entity.getDictSort();
        if (dictSort != null) {
            stmt.bindString(2, dictSort);
        }
 
        String dictLabel = entity.getDictLabel();
        if (dictLabel != null) {
            stmt.bindString(3, dictLabel);
        }
 
        String dictValue = entity.getDictValue();
        if (dictValue != null) {
            stmt.bindString(4, dictValue);
        }
 
        String dictType = entity.getDictType();
        if (dictType != null) {
            stmt.bindString(5, dictType);
        }
 
        String cssClass = entity.getCssClass();
        if (cssClass != null) {
            stmt.bindString(6, cssClass);
        }
 
        String listClass = entity.getListClass();
        if (listClass != null) {
            stmt.bindString(7, listClass);
        }
 
        String isDefault = entity.getIsDefault();
        if (isDefault != null) {
            stmt.bindString(8, isDefault);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(9, status);
        }
 
        String createBy = entity.getCreateBy();
        if (createBy != null) {
            stmt.bindString(10, createBy);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(11, createTime);
        }
 
        String updateBy = entity.getUpdateBy();
        if (updateBy != null) {
            stmt.bindString(12, updateBy);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(13, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(14, remark);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, DictEntity entity) {
        stmt.clearBindings();
 
        String dictCode = entity.getDictCode();
        if (dictCode != null) {
            stmt.bindString(1, dictCode);
        }
 
        String dictSort = entity.getDictSort();
        if (dictSort != null) {
            stmt.bindString(2, dictSort);
        }
 
        String dictLabel = entity.getDictLabel();
        if (dictLabel != null) {
            stmt.bindString(3, dictLabel);
        }
 
        String dictValue = entity.getDictValue();
        if (dictValue != null) {
            stmt.bindString(4, dictValue);
        }
 
        String dictType = entity.getDictType();
        if (dictType != null) {
            stmt.bindString(5, dictType);
        }
 
        String cssClass = entity.getCssClass();
        if (cssClass != null) {
            stmt.bindString(6, cssClass);
        }
 
        String listClass = entity.getListClass();
        if (listClass != null) {
            stmt.bindString(7, listClass);
        }
 
        String isDefault = entity.getIsDefault();
        if (isDefault != null) {
            stmt.bindString(8, isDefault);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(9, status);
        }
 
        String createBy = entity.getCreateBy();
        if (createBy != null) {
            stmt.bindString(10, createBy);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(11, createTime);
        }
 
        String updateBy = entity.getUpdateBy();
        if (updateBy != null) {
            stmt.bindString(12, updateBy);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(13, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(14, remark);
        }
    }

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

    @Override
    public DictEntity readEntity(Cursor cursor, int offset) {
        DictEntity entity = new DictEntity( //
            cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // dictCode
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // dictSort
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // dictLabel
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // dictValue
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // dictType
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cssClass
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // listClass
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // isDefault
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // status
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // createBy
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // createTime
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // updateBy
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // updateTime
            cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13) // remark
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, DictEntity entity, int offset) {
        entity.setDictCode(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
        entity.setDictSort(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setDictLabel(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setDictValue(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setDictType(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setCssClass(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setListClass(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setIsDefault(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setStatus(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setCreateBy(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setCreateTime(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setUpdateBy(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setUpdateTime(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setRemark(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
     }
    
    @Override
    protected final Void updateKeyAfterInsert(DictEntity entity, long rowId) {
        // Unsupported or missing PK type
        return null;
    }
    
    @Override
    public Void getKey(DictEntity entity) {
        return null;
    }

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

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