RGVUserBeanDao.java 10.9 KB
package com.huaheng.tab.wmsgreendao;

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.huaheng.tab.bean.convert.RolesConvert;
import java.util.List;

import com.huaheng.tab.bean.RGVUserBean;

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

    public static final String TABLENAME = "RGVUSER_BEAN";

    /**
     * Properties of entity RGVUserBean.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property UserCode = new Property(0, String.class, "userCode", false, "USER_CODE");
        public final static Property UserName = new Property(1, String.class, "userName", false, "USER_NAME");
        public final static Property Password = new Property(2, String.class, "password", false, "PASSWORD");
        public final static Property Partment = new Property(3, String.class, "partment", false, "PARTMENT");
        public final static Property Address = new Property(4, String.class, "address", false, "ADDRESS");
        public final static Property Phone = new Property(5, String.class, "phone", false, "PHONE");
        public final static Property Remark = new Property(6, String.class, "remark", false, "REMARK");
        public final static Property Disable = new Property(7, String.class, "disable", false, "DISABLE");
        public final static Property RolesBeans = new Property(8, String.class, "rolesBeans", false, "ROLES_BEANS");
        public final static Property Id = new Property(9, int.class, "id", false, "ID");
        public final static Property Created = new Property(10, String.class, "created", false, "CREATED");
        public final static Property CreatedBy = new Property(11, String.class, "createdBy", false, "CREATED_BY");
        public final static Property Updated = new Property(12, String.class, "updated", false, "UPDATED");
        public final static Property UpdatedBy = new Property(13, String.class, "updatedBy", false, "UPDATED_BY");
    }

    private final RolesConvert rolesBeansConverter = new RolesConvert();

    public RGVUserBeanDao(DaoConfig config) {
        super(config);
    }
    
    public RGVUserBeanDao(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 + "\"RGVUSER_BEAN\" (" + //
                "\"USER_CODE\" TEXT," + // 0: userCode
                "\"USER_NAME\" TEXT," + // 1: userName
                "\"PASSWORD\" TEXT," + // 2: password
                "\"PARTMENT\" TEXT," + // 3: partment
                "\"ADDRESS\" TEXT," + // 4: address
                "\"PHONE\" TEXT," + // 5: phone
                "\"REMARK\" TEXT," + // 6: remark
                "\"DISABLE\" TEXT," + // 7: disable
                "\"ROLES_BEANS\" TEXT," + // 8: rolesBeans
                "\"ID\" INTEGER NOT NULL ," + // 9: id
                "\"CREATED\" TEXT," + // 10: created
                "\"CREATED_BY\" TEXT," + // 11: createdBy
                "\"UPDATED\" TEXT," + // 12: updated
                "\"UPDATED_BY\" TEXT);"); // 13: updatedBy
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, RGVUserBean entity) {
        stmt.clearBindings();
 
        String userCode = entity.getUserCode();
        if (userCode != null) {
            stmt.bindString(1, userCode);
        }
 
        String userName = entity.getUserName();
        if (userName != null) {
            stmt.bindString(2, userName);
        }
 
        String password = entity.getPassword();
        if (password != null) {
            stmt.bindString(3, password);
        }
 
        String partment = entity.getPartment();
        if (partment != null) {
            stmt.bindString(4, partment);
        }
 
        String address = entity.getAddress();
        if (address != null) {
            stmt.bindString(5, address);
        }
 
        String phone = entity.getPhone();
        if (phone != null) {
            stmt.bindString(6, phone);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(7, remark);
        }
 
        String disable = entity.getDisable();
        if (disable != null) {
            stmt.bindString(8, disable);
        }
 
        List rolesBeans = entity.getRolesBeans();
        if (rolesBeans != null) {
            stmt.bindString(9, rolesBeansConverter.convertToDatabaseValue(rolesBeans));
        }
        stmt.bindLong(10, entity.getId());
 
        String created = entity.getCreated();
        if (created != null) {
            stmt.bindString(11, created);
        }
 
        String createdBy = entity.getCreatedBy();
        if (createdBy != null) {
            stmt.bindString(12, createdBy);
        }
 
        String updated = entity.getUpdated();
        if (updated != null) {
            stmt.bindString(13, updated);
        }
 
        String updatedBy = entity.getUpdatedBy();
        if (updatedBy != null) {
            stmt.bindString(14, updatedBy);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, RGVUserBean entity) {
        stmt.clearBindings();
 
        String userCode = entity.getUserCode();
        if (userCode != null) {
            stmt.bindString(1, userCode);
        }
 
        String userName = entity.getUserName();
        if (userName != null) {
            stmt.bindString(2, userName);
        }
 
        String password = entity.getPassword();
        if (password != null) {
            stmt.bindString(3, password);
        }
 
        String partment = entity.getPartment();
        if (partment != null) {
            stmt.bindString(4, partment);
        }
 
        String address = entity.getAddress();
        if (address != null) {
            stmt.bindString(5, address);
        }
 
        String phone = entity.getPhone();
        if (phone != null) {
            stmt.bindString(6, phone);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(7, remark);
        }
 
        String disable = entity.getDisable();
        if (disable != null) {
            stmt.bindString(8, disable);
        }
 
        List rolesBeans = entity.getRolesBeans();
        if (rolesBeans != null) {
            stmt.bindString(9, rolesBeansConverter.convertToDatabaseValue(rolesBeans));
        }
        stmt.bindLong(10, entity.getId());
 
        String created = entity.getCreated();
        if (created != null) {
            stmt.bindString(11, created);
        }
 
        String createdBy = entity.getCreatedBy();
        if (createdBy != null) {
            stmt.bindString(12, createdBy);
        }
 
        String updated = entity.getUpdated();
        if (updated != null) {
            stmt.bindString(13, updated);
        }
 
        String updatedBy = entity.getUpdatedBy();
        if (updatedBy != null) {
            stmt.bindString(14, updatedBy);
        }
    }

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

    @Override
    public RGVUserBean readEntity(Cursor cursor, int offset) {
        RGVUserBean entity = new RGVUserBean( //
            cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // userCode
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // userName
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // password
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // partment
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // address
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // phone
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // remark
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // disable
            cursor.isNull(offset + 8) ? null : rolesBeansConverter.convertToEntityProperty(cursor.getString(offset + 8)), // rolesBeans
            cursor.getInt(offset + 9), // id
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // created
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // createdBy
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // updated
            cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13) // updatedBy
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, RGVUserBean entity, int offset) {
        entity.setUserCode(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
        entity.setUserName(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setPassword(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setPartment(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setAddress(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setPhone(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setRemark(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setDisable(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setRolesBeans(cursor.isNull(offset + 8) ? null : rolesBeansConverter.convertToEntityProperty(cursor.getString(offset + 8)));
        entity.setId(cursor.getInt(offset + 9));
        entity.setCreated(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setCreatedBy(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setUpdated(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setUpdatedBy(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
     }
    
    @Override
    protected final Void updateKeyAfterInsert(RGVUserBean entity, long rowId) {
        // Unsupported or missing PK type
        return null;
    }
    
    @Override
    public Void getKey(RGVUserBean entity) {
        return null;
    }

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

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